+ Fixed bug in RST writer's handling of ordered lists. Previously,
list items with multiple lines would not always line up with single-line list items. Now, list items are nested the length of the list marker + 1. This looks better and ensures that list items all line up. (Note that list markers are padded to the length of the longest list marker in the series.) + Use 3-space indent for unordered lists. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1013 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
4b4060b8ef
commit
9cadf53621
2 changed files with 75 additions and 75 deletions
|
@ -225,7 +225,7 @@ blockToRST opts (DefinitionList items) = do
|
|||
bulletListItemToRST :: WriterOptions -> [Block] -> State WriterState Doc
|
||||
bulletListItemToRST opts items = do
|
||||
contents <- blockListToRST opts items
|
||||
return $ hang (text "- ") (writerTabStop opts) contents
|
||||
return $ hang (text "- ") 3 contents
|
||||
|
||||
-- | Convert ordered list item (a list of blocks) to RST.
|
||||
orderedListItemToRST :: WriterOptions -- ^ options
|
||||
|
@ -234,7 +234,7 @@ orderedListItemToRST :: WriterOptions -- ^ options
|
|||
-> State WriterState Doc
|
||||
orderedListItemToRST opts marker items = do
|
||||
contents <- blockListToRST opts items
|
||||
return $ hang (text marker) (writerTabStop opts) contents
|
||||
return $ hang (text marker) (length marker + 1) contents
|
||||
|
||||
-- | Convert defintion list item (label, list of blocks) to RST.
|
||||
definitionListItemToRST :: WriterOptions -> ([Inline], [Block]) -> State WriterState Doc
|
||||
|
|
146
tests/writer.rst
146
tests/writer.rst
|
@ -155,52 +155,52 @@ 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
|
||||
|
@ -243,10 +243,10 @@ and using spaces:
|
|||
Multiple paragraphs:
|
||||
|
||||
|
||||
1. Item 1, graf one.
|
||||
1. Item 1, graf one.
|
||||
|
||||
Item 1. graf two. The quick brown fox jumped over the lazy dog's
|
||||
back.
|
||||
Item 1. graf two. The quick brown fox jumped over the lazy dog's
|
||||
back.
|
||||
|
||||
2. Item 2.
|
||||
|
||||
|
@ -257,11 +257,11 @@ Nested
|
|||
------
|
||||
|
||||
|
||||
- Tab
|
||||
|
||||
- Tab
|
||||
|
||||
- Tab
|
||||
- Tab
|
||||
|
||||
- Tab
|
||||
|
||||
- Tab
|
||||
|
||||
|
||||
|
||||
|
@ -269,11 +269,11 @@ Here's another:
|
|||
|
||||
|
||||
1. First
|
||||
2. Second:
|
||||
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
2. Second:
|
||||
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
|
||||
3. Third
|
||||
|
||||
|
@ -282,12 +282,12 @@ Same thing but with paragraphs:
|
|||
|
||||
1. First
|
||||
|
||||
2. Second:
|
||||
2. Second:
|
||||
|
||||
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
|
||||
- Fee
|
||||
- Fie
|
||||
- Foe
|
||||
|
||||
3. Third
|
||||
|
||||
|
@ -296,14 +296,14 @@ 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
|
||||
|
||||
|
||||
|
||||
|
@ -328,13 +328,13 @@ Fancy list markers
|
|||
Nesting:
|
||||
|
||||
|
||||
A. Upper Alpha
|
||||
|
||||
I. Upper Roman.
|
||||
|
||||
(6) Decimal start with 6
|
||||
|
||||
c) Lower alpha with paren
|
||||
A. Upper Alpha
|
||||
|
||||
I. Upper Roman.
|
||||
|
||||
(6) Decimal start with 6
|
||||
|
||||
c) Lower alpha with paren
|
||||
|
||||
|
||||
|
||||
|
@ -343,9 +343,9 @@ Autonumbering:
|
|||
|
||||
|
||||
#. Autonumber.
|
||||
#. More.
|
||||
|
||||
#. Nested.
|
||||
#. More.
|
||||
|
||||
#. Nested.
|
||||
|
||||
|
||||
Should not be a list item:
|
||||
|
@ -642,24 +642,24 @@ LaTeX
|
|||
=====
|
||||
|
||||
|
||||
- \cite[22-23]{smith.1899}
|
||||
- \doublespacing
|
||||
- $2+2=4$
|
||||
- $x \in y$
|
||||
- $\alpha \wedge \omega$
|
||||
- $223$
|
||||
- $p$-Tree
|
||||
- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
|
||||
- Here's one that has a line break in it:
|
||||
$\alpha + \omega \times x^2$.
|
||||
- \cite[22-23]{smith.1899}
|
||||
- \doublespacing
|
||||
- $2+2=4$
|
||||
- $x \in y$
|
||||
- $\alpha \wedge \omega$
|
||||
- $223$
|
||||
- $p$-Tree
|
||||
- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
|
||||
- Here's one that has a line break in it:
|
||||
$\alpha + \omega \times x^2$.
|
||||
|
||||
These shouldn't be math:
|
||||
|
||||
|
||||
- To get the famous equation, write ``$e = mc^2$``.
|
||||
- $22,000 is a *lot* of money. So is $34,000. (It worked if "lot"
|
||||
is emphasized.)
|
||||
- Escaped ``$``: $73 *this should be emphasized* 23$.
|
||||
- To get the famous equation, write ``$e = mc^2$``.
|
||||
- $22,000 is a *lot* of money. So is $34,000. (It worked if "lot"
|
||||
is emphasized.)
|
||||
- Escaped ``$``: $73 *this should be emphasized* 23$.
|
||||
|
||||
Here's a LaTeX table:
|
||||
|
||||
|
@ -680,11 +680,11 @@ 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.
|
||||
|
||||
|
@ -802,9 +802,9 @@ Autolinks
|
|||
With an ampersand: http://example.com/?foo=1&bar=2
|
||||
|
||||
|
||||
- In a list?
|
||||
- http://example.com/
|
||||
- It should.
|
||||
- In a list?
|
||||
- http://example.com/
|
||||
- It should.
|
||||
|
||||
An e-mail address: nobody@nowhere.net
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue