Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.{rs,toml,json}]
indent_size = 4

[*.{typ,md}]
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.DS_Store

/.luarc.json

.vscode
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ This repository provides Quarto custom formats for the core templates provided b
| [Letter](https://github.com/quarto-ext/typst-templates/tree/main/letter) | `quarto use template quarto-ext/typst-templates/letter` |
| [Fiction](https://github.com/quarto-ext/typst-templates/tree/main/fiction) | `quarto use template quarto-ext/typst-templates/fiction` |
| [Poster](https://github.com/quarto-ext/typst-templates/tree/main/poster) | `quarto use template quarto-ext/typst-templates/poster` |
| [Dept News](https://github.com/quarto-ext/typst-templates/tree/main/dept-news) | `quarto use template quarto-ext/typst-templates/dept-news` |
| [Dashing Dept News](https://github.com/quarto-ext/typst-templates/tree/main/dept-news) | `quarto use template quarto-ext/typst-templates/dept-news` |

These formats are published under the [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) public domain license.
These formats are published under the [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) public domain license.
2 changes: 1 addition & 1 deletion dept-news/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ title: "Chemistry Department"
edition: |
March 18th, 2023 \
Purview College
hero-image:
hero-image:
path: "newsletter-cover.jpg"
caption: "Award winning science"
publication-info: |
Expand Down
4 changes: 2 additions & 2 deletions dept-news/_extensions/dept-news/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: Dept-news
author: J.J. Allaire
version: 0.2.0
quarto-required: ">=1.4.11"
version: 0.3.0
quarto-required: ">=1.7.31"
contributes:
formats:
typst:
Expand Down
17 changes: 17 additions & 0 deletions dept-news/_extensions/dept-news/dept-news.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@


function Div(el)
if el.identifier == "quote" then
local blocks = pandoc.List({})
-- Create the opening part of the quote with optional attribution
local opening = '#quote(block: true'
if el.attributes and el.attributes.attribution then
opening = opening .. ', attribution: [' .. el.attributes.attribution .. ']'
end
-- Complete the opening with the starting bracket for content
opening = opening .. ')['
-- Add the opening to blocks
blocks:insert(pandoc.RawBlock('typst', opening))
-- Add the content
blocks:extend(el.content)
-- Close the quote
blocks:insert(pandoc.RawBlock('typst', ']'))
return blocks
end
if el.classes:includes('article') then
local blocks = pandoc.List({
pandoc.RawBlock('typst', '#article[')
Expand Down
8 changes: 4 additions & 4 deletions dept-news/_extensions/dept-news/typst-show.typ
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#show: dept-news.with(
#show: newsletter.with(
$if(title)$
title: "$title$",
title: [$title$],
$endif$
$if(edition)$
edition: [$edition$],
$endif$
$if(hero-image)$
hero-image: (
path: "$hero-image.path$",
image: image("$hero-image.path$"),
caption: [$hero-image.caption$]
),
),
$endif$
$if(dedication)$
dedication: [$dedication$],
Expand Down
77 changes: 45 additions & 32 deletions dept-news/_extensions/dept-news/typst-template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

// This function gets your whole document as its `body` and formats
// it as the fun newsletter of a college department.
#let dept-news(
#let newsletter(
// The newsletter's title.
title: "Newsletter title",
title: [Newsletter title],

// The edition, displayed at the top of the sidebar.
edition: none,
Expand Down Expand Up @@ -52,6 +52,7 @@
show link: underline

// Configure figures.
set figure(gap: 24pt)
show figure: it => block({
// Display a backdrop rectangle.
move(dx: -3%, dy: 1.5%, rect(
Expand All @@ -62,12 +63,15 @@

// Display caption.
if it.has("caption") {
set align(center)
set text(font: "Syne")
v(if it.has("gap") { it.gap } else { 24pt }, weak: true)
if it.supplement != none and it.numbering != none {
[#it.supplement #counter(figure).display(it.numbering): ]
show figure.caption: caption => {
set align(center)
set text(font: "Syne")
if it.supplement != none and it.numbering != none {
[#it.supplement #counter(figure).display(it.numbering): ]
}
}

v(if it.has("gap") { it.gap } else { 24pt }, weak: true)
it.caption
}

Expand All @@ -88,17 +92,20 @@
text(fill: white, weight: "medium", 14pt, align(right + bottom, edition)),

// Hero image.
style(styles => {
context {
if hero-image == none {
return
}

// Measure the image and text to find out the correct line width.
// The line should always fill the remaining space next to the image.
let img = image(hero-image.path, width: 14cm)
let img = {
set image(width: 14cm)
hero-image.image
}
let text = text(size: 25pt, fill: white, font: "Syne Tactile", hero-image.caption)
let img-size = measure(img, styles)
let text-width = measure(text, styles).width + 12pt
let img-size = measure(img)
let text-width = measure(text).width + 12pt
let line-length = img-size.height - text-width

grid(
Expand All @@ -116,13 +123,36 @@
line(angle: 90deg, length: line-length, stroke: 3pt + white),
),
)
}),
},

// Nothing next to the hero image.
none,

// The main flow with body and publication info.
{
// A stylized block with a quote and its author.
show quote: it => {
if not it.block {
return it
}

box(inset: (x: 0.4em, y: 12pt), width: 100%, {
set text(font: "Syne")
grid(
columns: (1em, auto, 1em),
column-gutter: 12pt,
rows: (1em, auto),
row-gutter: 8pt,
text(5em)["],
line(start: (0pt, 0.45em), length: 100%),
none, none,
text(1.4em, align(center, it.body)),
none, none,
v(8pt) + align(right, text(font: "Barlow")[---#it.attribution]),
)
})
}

set par(justify: true)
body
v(1fr)
Expand All @@ -131,35 +161,18 @@
},

// The sidebar with articles.
locate(loc => {
context {
set text(fill: white, weight: 500)
show heading: underline.with(stroke: 2pt, offset: 4pt)
v(44pt)
for element in articles.final(loc) {
for element in articles.final() {
element
v(24pt, weak: true)
}
}),
},
)
}

// A stylized block with a quote and its author.
#let blockquote(body) = box(inset: (x: 0.4em, y: 12pt), width: 100%, {
set text(font: "Syne")
grid(
columns: (1em, auto, 1em),
column-gutter: 12pt,
rows: (1em, auto),
row-gutter: 8pt,
text(5em)["],
line(start: (0pt, 0.45em), length: 100%),
none, none,
text(1.4em, align(center, body)),
none, none
)
})


// An article that is displayed in the sidebar. Can be added
// anywhere in the document. All articles are collected automatically.
#let article(body) = articles.update(it => it + (body,))
Binary file modified dept-news/dept-news.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions dept-news/template.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Chemistry Department"
edition: |
March 18th, 2023 \
Purview College
hero-image:
hero-image:
path: "newsletter-cover.jpg"
caption: "Award winning science"
publication-info: |
Expand All @@ -18,8 +18,9 @@ format:

It's our pleasure to announce that our department has recently been awarded the highly-coveted Sixtus Award for Excellence in Chemical Research. This is a massive achievement for our department, and we couldn't be prouder.

> Our Lab has synthesized the most elements of them all.\
> --- Prof. Herzog
::: {#quote attribution="Prof. Herzog"}
Our Lab has synthesized the most elements of them all.
:::

The Sixtus Award is a prestigious recognition given to institutions that have demonstrated exceptional performance in chemical research. The award is named after the renowned chemist Sixtus Leung, who made significant contributions to the field of organic chemistry.

Expand All @@ -29,7 +30,7 @@ The award will be presented to our department in a formal ceremony that will tak

::: {.article}
## Guest lecture from Dr. Elizabeth Lee

Elizabeth Lee, a leading researcher in the field of biochemistry, spoke about her recent work on the development of new cancer treatments using small molecule inhibitors, and the lecture was very well-attended by both students and faculty.

In case you missed it, there's a recording on [EDGARP](http://purview.edu/lts/2023-lee")
Expand All @@ -45,6 +46,6 @@ These trainings are crucial for ensuring that all members of the department are

## Another Success

Aliquam sit amet lectus ut libero congue viverra. Morbi quis diam ullamcorper, iaculis ex non, fermentum mauris. Aliquam consectetur vitae purus vitae laoreet. Sed elementum ligula et mauris eleifend dignissim.
Aliquam sit amet lectus ut libero congue viverra. Morbi quis diam ullamcorper, iaculis ex non, fermentum mauris. Aliquam consectetur vitae purus vitae laoreet. Sed elementum ligula et mauris eleifend dignissim.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ultrices, dolor molestie viverra interdum, nibh urna dignissim nisi, et rhoncus libero nibh a nulla. Etiam ac augue vel leo vehicula finibus at non tortor.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ultrices, dolor molestie viverra interdum, nibh urna dignissim nisi, et rhoncus libero nibh a nulla. Etiam ac augue vel leo vehicula finibus at non tortor.