ConTeXt writer: Use itemize options, not sym{}, to produce ordered

lists with custom numbering styles.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@1079 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2007-11-16 06:20:25 +00:00
parent 13d8a75060
commit 780b77c147

View file

@ -129,20 +129,34 @@ blockToConTeXt opts (RawHtml str) = return empty
blockToConTeXt opts (BulletList lst) = do blockToConTeXt opts (BulletList lst) = do
contents <- mapM (listItemToConTeXt opts) lst contents <- mapM (listItemToConTeXt opts) lst
return $ text "\\startltxitem" $$ vcat contents $$ text "\\stopltxitem" return $ text "\\startltxitem" $$ vcat contents $$ text "\\stopltxitem"
blockToConTeXt opts (OrderedList attribs lst) = case attribs of blockToConTeXt opts (OrderedList (start, style, delim) lst) = do
(1, DefaultStyle, DefaultDelim) -> do
contents <- mapM (listItemToConTeXt opts) lst contents <- mapM (listItemToConTeXt opts) lst
return $ text "\\startltxenum"$$ vcat contents $$ text "\\stopltxenum" let start' = if start == 1 then "" else "start=" ++ show start
_ -> do let delim' = case delim of
let markers = take (length lst) $ orderedListMarkers attribs DefaultDelim -> ""
contents <- zipWithM (orderedListItemToConTeXt opts) markers lst Period -> "stopper=."
let markerWidth = maximum $ map length markers OneParen -> "stopper=)"
let markerWidth' = if markerWidth < 3 TwoParens -> "left=(,stopper=)"
let width = maximum $ map length $ take (length contents)
(orderedListMarkers (start, style, delim))
let width' = (toEnum width + 1) / 2
let width'' = if width' > 1.5
then "width=" ++ show width' ++ "em"
else ""
let specs2Items = filter (not . null) [start', delim', width'']
let specs2 = if null specs2Items
then "" then ""
else "[width=" ++ else "[" ++ joinWithSep "," specs2Items ++ "]"
show ((markerWidth + 2) `div` 2) ++ "em]" let style' = case style of
return $ text ("\\startitemize" ++ markerWidth') $$ vcat contents $$ DefaultStyle -> if null specs2 then "" else "[]"
text "\\stopitemize" Decimal -> "[n]"
LowerRoman -> "[r]"
UpperRoman -> "[R]"
LowerAlpha -> "[a]"
UpperAlpha -> "[A]"
let specs = style' ++ specs2
return $ text ("\\startitemize" ++ specs) $$ vcat contents $$
text "\\stopitemize\n"
blockToConTeXt opts (DefinitionList lst) = blockToConTeXt opts (DefinitionList lst) =
mapM (defListItemToConTeXt opts) lst >>= return . (<> char '\n') . vcat mapM (defListItemToConTeXt opts) lst >>= return . (<> char '\n') . vcat
blockToConTeXt opts HorizontalRule = return $ text "\\thinrule\n" blockToConTeXt opts HorizontalRule = return $ text "\\thinrule\n"