Skip to content

Commit

Permalink
✨ Implemented border function
Browse files Browse the repository at this point in the history
  • Loading branch information
BestUsernamEver committed Jan 14, 2024
1 parent 337b061 commit 5326ead
Showing 1 changed file with 64 additions and 7 deletions.
71 changes: 64 additions & 7 deletions themes/linear/linear.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,46 @@
*Linear Cover*
]

#let border(x, y) = {
set line(stroke: 1.5pt)
let borderTL = 0% + 30%
let borderTR = 100% - 30%
place(
// Left border line
line(start: (0% + x, 5%), end: (0% + x, 90%))
)
place(
// Right border line
line(start: (100% - x, 5%), end: (100% - x, 90%))
)
place(
// Bottom border line
line(start: (0% + x, 100% - y), end: (100% - x, 100% - y))
)
place(
// Top left border line -> ——
line(start: (0% + x, 5%), end: (borderTL + x, 5%))
)
place(
// Top right border line -> ——
line(start: (100% - x, 5%), end: (borderTR - x, 5%))
)
place(
// Top left border line -> ︱
line(start: (borderTL + x, 4%), end: (borderTL + x, 6%))
)
place(
// Top left border line -> ︱
line(start: (borderTR - x, 4%), end: (borderTR - x, 6%))
)
}

#let heading(context: (:)) = {
box(inset: 0.5em, fill: red)[context]
h(5pt)
box(baseline: -10pt, width: 1fr, line(length: 100%))
}

#let toc() = {
utils.print_toc(context => [
#context.title
Expand All @@ -24,23 +64,40 @@
}

#let frontmatter_entry(context: (:), body) = {
show: page.with(header: [ = Frontmatter header ], footer: [Frontmatter footer])

show: page.with(
header: [
#set align(center)
= Frontmatter header
],
footer: [ Frontmatter footer ],
background: border(5%, 10%)
)
body
}

#let body_entry(context: (:), body) = {
show: page.with(header: [ = Body header ], footer: [Body footer])

show: page.with(
header: [
#set align(center)
= Body header
],
footer: [ Body footer ],
background: border(5%, 10%)
)
body
}
#let appendix_entry(context: (:), body) = {
show: page.with(header: [ = Appendix header ], footer: [Appendix footer])

show: page.with(header: [
#set align(center)
= Appendix header
],
footer: [ Appendix footer ],
background: border(5%, 10%)
)
body
}

#let default_theme = (
#let linear_theme = (
// Global show rules
rules: rules, cover: cover,
// Entry pages
Expand Down

0 comments on commit 5326ead

Please sign in to comment.