mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 18:26:36 +00:00
Typst writer: fix alignment issue in lists.
It's an aesthetic issue only; the first line had an extra space indent after the list marker.
This commit is contained in:
@@ -146,14 +146,14 @@ blockToTypst block =
|
||||
text (show start) )) $$
|
||||
x $$
|
||||
"]"
|
||||
items' <- mapM (fmap chomp . listItemToTypst 2 ("+ ")) items
|
||||
items' <- mapM (fmap chomp . listItemToTypst 2 ("+")) items
|
||||
return $ addBlock
|
||||
(if isTightList items
|
||||
then vcat items'
|
||||
else vsep items')
|
||||
$$ blankline
|
||||
BulletList items -> do
|
||||
items' <- mapM (fmap chomp . listItemToTypst 2 "- ") items
|
||||
items' <- mapM (fmap chomp . listItemToTypst 2 "-") items
|
||||
return $ (if isTightList items
|
||||
then vcat items'
|
||||
else vsep items') $$ blankline
|
||||
@@ -209,6 +209,7 @@ defListItemToTypst (term, defns) = do
|
||||
defns' <- mapM blocksToTypst defns
|
||||
return $ nowrap ("/ " <> term' <> ": " <> "#block[") $$
|
||||
chomp (vcat defns') $$ "]"
|
||||
|
||||
listItemToTypst :: PandocMonad m => Int -> Doc Text -> [Block] -> TW m (Doc Text)
|
||||
listItemToTypst ind marker blocks = do
|
||||
contents <- blocksToTypst blocks
|
||||
|
||||
+90
-90
@@ -166,8 +166,8 @@ sub status {
|
||||
|
||||
A list:
|
||||
|
||||
+ item one
|
||||
+ item two
|
||||
+ item one
|
||||
+ item two
|
||||
|
||||
Nested block quotes:
|
||||
|
||||
@@ -216,141 +216,141 @@ These should not be escaped: \$ \\ \> \[ \{
|
||||
#label("unordered")
|
||||
Asterisks tight:
|
||||
|
||||
- asterisk 1
|
||||
- asterisk 2
|
||||
- asterisk 3
|
||||
- asterisk 1
|
||||
- asterisk 2
|
||||
- asterisk 3
|
||||
|
||||
Asterisks loose:
|
||||
|
||||
- asterisk 1
|
||||
- asterisk 1
|
||||
|
||||
- asterisk 2
|
||||
- asterisk 2
|
||||
|
||||
- asterisk 3
|
||||
- asterisk 3
|
||||
|
||||
Pluses tight:
|
||||
|
||||
- Plus 1
|
||||
- Plus 2
|
||||
- Plus 3
|
||||
- Plus 1
|
||||
- Plus 2
|
||||
- Plus 3
|
||||
|
||||
Pluses loose:
|
||||
|
||||
- Plus 1
|
||||
- Plus 1
|
||||
|
||||
- Plus 2
|
||||
- Plus 2
|
||||
|
||||
- Plus 3
|
||||
- Plus 3
|
||||
|
||||
Minuses tight:
|
||||
|
||||
- Minus 1
|
||||
- Minus 2
|
||||
- Minus 3
|
||||
- Minus 1
|
||||
- Minus 2
|
||||
- Minus 3
|
||||
|
||||
Minuses loose:
|
||||
|
||||
- Minus 1
|
||||
- Minus 1
|
||||
|
||||
- Minus 2
|
||||
- Minus 2
|
||||
|
||||
- Minus 3
|
||||
- Minus 3
|
||||
|
||||
== Ordered
|
||||
#label("ordered")
|
||||
Tight:
|
||||
|
||||
+ First
|
||||
+ Second
|
||||
+ Third
|
||||
+ First
|
||||
+ Second
|
||||
+ Third
|
||||
|
||||
and:
|
||||
|
||||
+ One
|
||||
+ Two
|
||||
+ Three
|
||||
+ One
|
||||
+ Two
|
||||
+ Three
|
||||
|
||||
Loose using tabs:
|
||||
|
||||
+ First
|
||||
+ First
|
||||
|
||||
+ Second
|
||||
+ Second
|
||||
|
||||
+ Third
|
||||
+ Third
|
||||
|
||||
and using spaces:
|
||||
|
||||
+ One
|
||||
+ One
|
||||
|
||||
+ Two
|
||||
+ Two
|
||||
|
||||
+ Three
|
||||
+ Three
|
||||
|
||||
Multiple paragraphs:
|
||||
|
||||
+ Item 1, graf one.
|
||||
+ Item 1, graf one.
|
||||
|
||||
Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.
|
||||
|
||||
+ Item 2.
|
||||
+ Item 2.
|
||||
|
||||
+ Item 3.
|
||||
+ Item 3.
|
||||
|
||||
== Nested
|
||||
#label("nested")
|
||||
- Tab
|
||||
- Tab
|
||||
- Tab
|
||||
- Tab
|
||||
- Tab
|
||||
- Tab
|
||||
|
||||
Here’s another:
|
||||
|
||||
+ First
|
||||
+ Second:
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
+ Third
|
||||
+ First
|
||||
+ Second:
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
+ Third
|
||||
|
||||
Same thing but with paragraphs:
|
||||
|
||||
+ First
|
||||
+ First
|
||||
|
||||
+ Second:
|
||||
+ Second:
|
||||
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
|
||||
+ Third
|
||||
+ Third
|
||||
|
||||
== Tabs and spaces
|
||||
#label("tabs-and-spaces")
|
||||
- this is a list item indented with tabs
|
||||
- this is a list item indented with tabs
|
||||
|
||||
- this is a list item indented with spaces
|
||||
- this is a list item indented with spaces
|
||||
|
||||
- this is an example list item indented with tabs
|
||||
- this is an example list item indented with tabs
|
||||
|
||||
- this is an example list item indented with spaces
|
||||
- this is an example list item indented with spaces
|
||||
|
||||
== Fancy list markers
|
||||
#label("fancy-list-markers")
|
||||
#block[
|
||||
#set enum(numbering: "(1)", start: 2)
|
||||
+ begins with 2
|
||||
+ begins with 2
|
||||
|
||||
+ and now 3
|
||||
+ and now 3
|
||||
|
||||
with a continuation
|
||||
|
||||
#block[
|
||||
#set enum(numbering: "i.", start: 4)
|
||||
+ sublist with roman numerals, starting with 4
|
||||
+ more items
|
||||
+ sublist with roman numerals, starting with 4
|
||||
+ more items
|
||||
#block[
|
||||
#set enum(numbering: "(A)", start: 1)
|
||||
+ a subsublist
|
||||
+ a subsublist
|
||||
+ a subsublist
|
||||
+ a subsublist
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -359,16 +359,16 @@ Nesting:
|
||||
|
||||
#block[
|
||||
#set enum(numbering: "A.", start: 1)
|
||||
+ Upper Alpha
|
||||
+ Upper Alpha
|
||||
#block[
|
||||
#set enum(numbering: "I.", start: 1)
|
||||
+ Upper Roman.
|
||||
+ Upper Roman.
|
||||
#block[
|
||||
#set enum(numbering: "(1)", start: 6)
|
||||
+ Decimal start with 6
|
||||
+ Decimal start with 6
|
||||
#block[
|
||||
#set enum(numbering: "a)", start: 3)
|
||||
+ Lower alpha with paren
|
||||
+ Lower alpha with paren
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -376,9 +376,9 @@ Nesting:
|
||||
|
||||
Autonumbering:
|
||||
|
||||
+ Autonumber.
|
||||
+ More.
|
||||
+ Nested.
|
||||
+ Autonumber.
|
||||
+ More.
|
||||
+ Nested.
|
||||
|
||||
Should not be a list item:
|
||||
|
||||
@@ -489,8 +489,8 @@ computer
|
||||
/ orange: #block[
|
||||
orange fruit
|
||||
|
||||
+ sublist
|
||||
+ sublist
|
||||
+ sublist
|
||||
+ sublist
|
||||
]
|
||||
|
||||
= HTML Blocks
|
||||
@@ -602,23 +602,23 @@ Ellipses…and…and….
|
||||
|
||||
= LaTeX
|
||||
#label("latex")
|
||||
-
|
||||
- $2 plus 2 eq 4$
|
||||
- $x in y$
|
||||
- $alpha and omega$
|
||||
- $223$
|
||||
- $p$-Tree
|
||||
- Here’s some display math:
|
||||
-
|
||||
- $2 plus 2 eq 4$
|
||||
- $x in y$
|
||||
- $alpha and omega$
|
||||
- $223$
|
||||
- $p$-Tree
|
||||
- Here’s some display math:
|
||||
$ frac(d, d x) f lr((x)) eq lim_(h arrow.r 0) frac(f lr((x plus h)) minus f lr((x)), h) $
|
||||
- Here’s one that has a line break in it: $alpha plus omega times x^2$.
|
||||
- Here’s one that has a line break in it: $alpha plus omega times x^2$.
|
||||
|
||||
These shouldn’t be math:
|
||||
|
||||
- To get the famous equation, write `$e = mc^2$`.
|
||||
- \$22,000 is a #emph[lot] of money. So is \$34,000. (It worked if "lot" is
|
||||
- To get the famous equation, write `$e = mc^2$`.
|
||||
- \$22,000 is a #emph[lot] of money. So is \$34,000. (It worked if "lot" is
|
||||
emphasized.)
|
||||
- Shoes (\$20) and socks (\$5).
|
||||
- Escaped `$`: \$73 #emph[this should be emphasized] 23\$.
|
||||
- Shoes (\$20) and socks (\$5).
|
||||
- Escaped `$`: \$73 #emph[this should be emphasized] 23\$.
|
||||
|
||||
Here’s a LaTeX table:
|
||||
|
||||
@@ -628,11 +628,11 @@ Here’s a LaTeX table:
|
||||
#label("special-characters")
|
||||
Here is some unicode:
|
||||
|
||||
- I hat: Î
|
||||
- o umlaut: ö
|
||||
- section: §
|
||||
- set membership: ∈
|
||||
- copyright: ©
|
||||
- I hat: Î
|
||||
- o umlaut: ö
|
||||
- section: §
|
||||
- set membership: ∈
|
||||
- copyright: ©
|
||||
|
||||
AT&T has an ampersand in their name.
|
||||
|
||||
@@ -740,9 +740,9 @@ Here’s an #link("/script?foo=1&bar=2")[inline link in pointy braces].
|
||||
With an ampersand:
|
||||
#link("http://example.com/?foo=1&bar=2")[http://example.com/?foo\=1&bar\=2]
|
||||
|
||||
- In a list?
|
||||
- #link("http://example.com/")
|
||||
- It should.
|
||||
- In a list?
|
||||
- #link("http://example.com/")
|
||||
- It should.
|
||||
|
||||
An e-mail address: #link("mailto:nobody@nowhere.net")[nobody\@nowhere.net]
|
||||
|
||||
@@ -782,7 +782,7 @@ Here is an inline note.#super[3]
|
||||
Notes can go in quotes.#super[4]
|
||||
]
|
||||
|
||||
+ And in list items.#super[5]
|
||||
+ And in list items.#super[5]
|
||||
|
||||
This paragraph should not be part of the note, as it is not indented.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user