Skip to content

Commit

Permalink
Typst writer: use quote for block quotes.
Browse files Browse the repository at this point in the history
Remove custom definitiion of blockquote in default template.
  • Loading branch information
jgm committed Dec 10, 2023
1 parent d8b5541 commit aa95770
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
5 changes: 0 additions & 5 deletions data/templates/definitions.typst
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
// Some definitions presupposed by pandoc's typst output.
#let blockquote(body) = [
#set text( size: 0.92em )
#block(inset: (left: 1.5em, top: 0.2em, bottom: 0.2em))[#body]
]

#let horizontalrule = [
#line(start: (25%,0%), end: (75%,0%))
]
Expand Down
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Writers/Typst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ blockToTypst block =
return $ contents <> blankline
BlockQuote blocks -> do
contents <- blocksToTypst blocks
return $ "#blockquote[" $$ chomp contents $$ "]" $$ blankline
return $ "#quote(block: true)[" $$ chomp contents $$ "]" $$ blankline
HorizontalRule ->
return $ blankline <> "#horizontalrule" <> blankline
OrderedList attribs items -> do
Expand Down
19 changes: 7 additions & 12 deletions test/writer.typst
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
// Some definitions presupposed by pandoc's typst output.
#let blockquote(body) = [
#set text( size: 0.92em )
#block(inset: (left: 1.5em, top: 0.2em, bottom: 0.2em))[#body]
]

#let horizontalrule = [
#line(start: (25%,0%), end: (75%,0%))
]
Expand Down Expand Up @@ -151,11 +146,11 @@ here.
<block-quotes>
E-mail style:

#blockquote[
#quote(block: true)[
This is a block quote. It is pretty short.
]

#blockquote[
#quote(block: true)[
Code in a block quote:

```
Expand All @@ -171,11 +166,11 @@ A list:

Nested block quotes:

#blockquote[
#quote(block: true)[
nested
]

#blockquote[
#quote(block: true)[
nested
]
]
Expand Down Expand Up @@ -447,7 +442,7 @@ orange fruit
{ orange code block }
```

#blockquote[
#quote(block: true)[
orange block quote
]
]
Expand Down Expand Up @@ -763,7 +758,7 @@ With an ampersand: #link("http://example.com/?foo=1&bar=2")

An e-mail address: #link("mailto:nobody@nowhere.net")[nobody\@nowhere.net]

#blockquote[
#quote(block: true)[
Blockquoted: #link("http://example.com/")
]

Expand Down Expand Up @@ -809,7 +804,7 @@ is #emph[easier] to type. Inline notes may contain
#link("http://google.com")[links] and `]` verbatim characters, as well as
\[bracketed text\].]

#blockquote[
#quote(block: true)[
Notes can go in quotes.#footnote[In quote.]
]

Expand Down

0 comments on commit aa95770

Please sign in to comment.