diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-01-29 16:04:07 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-01-29 16:04:07 -0800 |
commit | 9f28acba9dc43a63172e771b57f8a51b6b738d71 (patch) | |
tree | e1854e3a5d312fa48949f26e465d12043fb36387 /src/Text/Pandoc/Highlighting.hs | |
parent | 9e89047518c9fc4278454574d4c0e86fffe75675 (diff) |
Fixed highlighting for inline code.
highlightHtml in Highlighting now has a boolean argument that
selects between inline and block content.
Revised tests for new highlighting-kate.
Diffstat (limited to 'src/Text/Pandoc/Highlighting.hs')
-rw-r--r-- | src/Text/Pandoc/Highlighting.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index f29106262..cf8d37431 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -37,10 +37,14 @@ import Data.List (find) import Data.Maybe (fromMaybe) import Data.Char (toLower) -highlightHtml :: Attr -> String -> Either String Html -highlightHtml (_, classes, keyvals) rawCode = +highlightHtml :: Bool -- ^ True if inline HTML + -> Attr -- ^ Attributes of the Code or CodeBlock + -> String -- ^ Raw contents of the Code or CodeBlock + -> Either String Html -- ^ An error or the formatted Html +highlightHtml inline (_, classes, keyvals) rawCode = let firstNum = read $ fromMaybe "1" $ lookup "startFrom" keyvals fmtOpts = [OptNumberFrom firstNum] ++ + [OptInline | inline] ++ case find (`elem` ["number","numberLines","number-lines"]) classes of Nothing -> [] Just _ -> [OptNumberLines] |