Skip to content

Commit

Permalink
Refactoring header
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-gimenez committed Oct 5, 2024
1 parent e3b8957 commit 7308f04
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 195 deletions.
210 changes: 114 additions & 96 deletions src/auxiliary.typ
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#import "./global.typ" : *

#let __g-student-data(show-line-two: true) = {
#let __g-student-data(show-line-two: true, show-group: true, show-date:true) = {
locate(loc => {
[#__g-localization.final(loc).family-name: #box(width: 2fr, repeat[.]) #__g-localization.final(loc).given-name: #box(width:1fr, repeat[.])]
[
#__g-localization.final(loc).family-name: #box(width: 2fr, repeat[.])
#__g-localization.final(loc).given-name: #box(width:1fr, repeat[.])
]

if show-line-two {
v(1pt)
align(right, [#__g-localization.final(loc).group: #box(width:2.5cm, repeat[.]) #__g-localization.final(loc).date: #box(width:3cm, repeat[.])])
align(right, {
if show-group {
__g-localization.final(loc).group
[: ]
box(width:2.5cm, repeat[.])
[ ]
}
if show-date {
__g-localization.final(loc).date
[: ]
box(width:4cm, repeat[.])
}
}
)
}
}
)
Expand Down Expand Up @@ -207,105 +224,106 @@
),
show-student-data: "first-page",
) => {
if (page-number==1) {
align(right)[#box(
width:108%,
grid(
columns: (auto, auto),
gutter:0.7em,
align(left + top)[
#if(type(school) == "dictionary"){
if(school.at("logo", default : none) != none) {
set image(height:2.5cm, width: 2.7cm, fit:"contain")
if(type(school.logo) == "content") {
school.logo
}
else if(type(school.logo) == "bytes") {
image.decode(school.logo, height:2.5cm, fit:"contain")
}
else {
assert(type(school.logo) in (none, "content", "bytes") , message: "school.logo be of type content or bytes.")
}
if (page-number==1) {
align(right)[#box(
width:108%,
grid(
columns: (auto, auto),
gutter:0.7em,
align(left + top)[
#if(type(school) == "dictionary") {
if(school.at("logo", default : none) != none) {
set image(height:2.5cm, width: 2.7cm, fit:"contain")
if(type(school.logo) == "content") {
school.logo
}
}
],
grid(
rows: (auto, auto, auto),
gutter:1em,
grid(
columns: (auto, 1fr, auto),
align(left + top)[
#if(type(school) == "dictionary") [
#school.at("name", default : none) \
]
#exam-info.academic-period \
#exam-info.academic-level
],
align(center + top)[
// #exam-info.number #exam-info.content \
],
align(right + top)[
#exam-info.at("academic-subject", default: none) \
#exam-info.number \
#exam-info.content
],
),
line(length: 100%, stroke: 1pt + gray),
if show-student-data in (true, "first-page", "odd-pages") {
__g-student-data()
else if(type(school.logo) == "bytes") {
image.decode(school.logo, height:2.5cm, fit:"contain")
}
)
)
)]
}
else if calc.rem-euclid(page-number, 2) == 1 {
else {
assert(type(school.logo) in (none, "content", "bytes") , message: "school.logo be of type content or bytes.")
}
}
}
],
grid(
columns: (auto, 1fr, auto),
gutter:0.3em,
align(left + top)[
#if(type(school) == "dictionary") [
#school.at("name", default : none) \
]
#exam-info.academic-period \
#exam-info.academic-level
],
align(center + top)[
// #exam-info.number #exam-info.content \
],
align(right + top)[
#exam-info.at("academic-subject", default: none) \
#exam-info.number \
#exam-info.content
]
rows: (auto, auto, auto),
gutter:1em,
grid(
columns: (auto, 1fr, auto),
align(left + top)[
#if(type(school) == "dictionary") [
#school.at("name", default : none) \
]
#exam-info.academic-period \
#exam-info.academic-level
],
align(center + top)[
// #exam-info.number #exam-info.content \
],
align(right + top)[
#exam-info.at("academic-subject", default: none) \
#exam-info.number \
#exam-info.content
],
),
line(length: 100%, stroke: 1pt + gray),
if show-student-data in (true, "first-page", "odd-pages") {
__g-student-data()
}
)
line(length: 100%, stroke: 1pt + gray)
if show-student-data == "odd-pages" {
__g-student-data(show-line-two: false)
}
}
else {
grid(
columns: (auto, 1fr, auto),
gutter:0.3em,
align(left + top)[
#if(type(school) == "dictionary") [
#school.at("name", default : none) \
]
#exam-info.academic-period \
#exam-info.academic-level
],
align(center + top)[
// #exam-info.number #exam-info.content \
],
align(right + top)[
#exam-info.at("academic-subject", default: none) \
#exam-info.number \
#exam-info.content \
)
)]
}
else if calc.rem-euclid(page-number, 2) == 1 {
grid(
columns: (auto, 1fr, auto),
gutter:0.3em,
align(left + top)[
#if type(school) == "dictionary" [
#school.at("name", default : none) \
]
)
line(length: 100%, stroke: 1pt + gray)
}
#exam-info.academic-period \
#exam-info.academic-level
],
align(center + top)[
// #exam-info.number #exam-info.content \
],
align(right + top)[
#exam-info.at("academic-subject", default: none) \
#exam-info.number \
#exam-info.content
]
)
line(length: 100%, stroke: 1pt + gray)
if show-student-data == "odd-pages" {
__g-student-data(show-line-two: false)
}
}
else {
grid(
columns: (auto, 1fr, auto),
gutter:0.3em,
align(left + top)[
#if type(school) == "dictionary" [
#school.at("name", default : none) \
]
#exam-info.academic-period \
#exam-info.academic-level
],
align(center + top)[
// #exam-info.number #exam-info.content \
],
align(right + top)[
#exam-info.at("academic-subject", default: none) \
#exam-info.number \
#exam-info.content \
]
)
line(length: 100%, stroke: 1pt + gray)
}
}
}

#let __show-watermark = (
author: (
Expand Down
Loading

0 comments on commit 7308f04

Please sign in to comment.