diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-08 02:43:15 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-08 02:43:15 +0000 |
commit | e814a3f6d23f640b1aed5b7cb949459d514a3e33 (patch) | |
tree | 4c9f89c85d5e050f27b4a732c7bad0542b5c9928 /src/Text/Pandoc/Writers/Man.hs | |
parent | 22a65385571737b6232debac884184d6504222fc (diff) | |
download | pandoc-e814a3f6d23f640b1aed5b7cb949459d514a3e33.tar.gz |
Major change in the way ordered lists are handled:
+ The changes are documented in README, under Lists.
+ The OrderedList block element now stores information
about list number style, list number delimiter, and
starting number.
+ The readers parse this information, when possible.
+ The writers use this information to style ordered
lists.
+ Test suites have been changed accordingly.
Motivation: It's often useful to start lists with
numbers other than 1, and to have control over the
style of the list.
Added to Text.Pandoc.Shared:
+ camelCaseToHyphenated
+ toRomanNumeral
+ anyOrderedListMarker
+ orderedListMarker
+ orderedListMarkers
Added to Text.Pandoc.ParserCombinators:
+ charsInBalanced'
+ withHorizDisplacement
+ romanNumeral
RST writer:
+ Force blank line before lists, so that sublists will be handled
correctly.
LaTeX reader:
+ Fixed bug in parsing of footnotes containing multiple paragraphs,
introduced by use of charsInBalanced. Fix: use charsInBalanced'
instead.
LaTeX header:
+ use mathletters option in ucs package, so that basic unicode Greek
letters will work properly.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@834 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/Man.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/Man.hs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 8c0f6e1b3..3232a454a 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -173,9 +173,11 @@ blockToMan opts (Table caption alignments widths headers rows) = blockToMan opts (BulletList items) = do contents <- mapM (bulletListItemToMan opts) items return (vcat contents) -blockToMan opts (OrderedList items) = do - contents <- mapM (\(item, num) -> orderedListItemToMan opts item num) $ - zip [1..] items +blockToMan opts (OrderedList attribs items) = do + let markers = take (length items) $ orderedListMarkers attribs + let indent = 1 + (maximum $ map length markers) + contents <- mapM (\(num, item) -> orderedListItemToMan opts num indent item) $ + zip markers items return (vcat contents) blockToMan opts (DefinitionList items) = do contents <- mapM (definitionListItemToMan opts) items @@ -201,25 +203,22 @@ bulletListItemToMan opts (first:rest) = do -- | Convert ordered list item (a list of blocks) to man. orderedListItemToMan :: WriterOptions -- ^ options - -> Int -- ^ ordinal number of list item - -> [Block] -- ^ list item (list of blocks) + -> String -- ^ order marker for list item + -> Int -- ^ number of spaces to indent + -> [Block] -- ^ list item (list of blocks) -> State WriterState Doc -orderedListItemToMan _ _ [] = return empty -orderedListItemToMan opts num ((Para first):rest) = - orderedListItemToMan opts num ((Plain first):rest) -orderedListItemToMan opts num ((Plain first):rest) = do - first' <- blockToMan opts (Plain first) +orderedListItemToMan _ _ _ [] = return empty +orderedListItemToMan opts num indent ((Para first):rest) = + orderedListItemToMan opts num indent ((Plain first):rest) +orderedListItemToMan opts num indent (first:rest) = do + first' <- blockToMan opts first rest' <- blockListToMan opts rest - let first'' = text (".IP " ++ show num ++ "." ++ " 4") $$ first' + let num' = printf ("%" ++ show (indent - 1) ++ "s") num + let first'' = text (".IP \"" ++ num' ++ "\" " ++ show indent) $$ first' let rest'' = if null rest then empty else text ".RS 4" $$ rest' $$ text ".RE" - return (first'' $$ rest'') -orderedListItemToMan opts num (first:rest) = do - first' <- blockToMan opts first - rest' <- blockListToMan opts rest - return $ text (".IP " ++ show num ++ "." ++ " 4") $$ first' $$ - rest' $$ text ".RE" + return $ first'' $$ rest'' -- | Convert definition list item (label, list of blocks) to man. definitionListItemToMan :: WriterOptions |