diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2011-12-27 23:46:23 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2011-12-27 23:46:47 -0800 |
commit | 16629bf1ce268e86f849ddb44435c6829fd933d2 (patch) | |
tree | 712adaead534d713647424d2153028386d3cd2bf /src/Text | |
parent | 3122959064412a40d650840467f2838326687251 (diff) | |
download | pandoc-16629bf1ce268e86f849ddb44435c6829fd933d2.tar.gz |
Added `--highlight-style` and `--no-highlight` options.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Highlighting.hs | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 3 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 5 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 5 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index 0570fb2d2..276d98529 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -38,6 +38,12 @@ module Text.Pandoc.Highlighting ( languages , formatHtmlBlock , styleToHtml , pygments + , espresso + , tango + , kate + , monochrome + , haddock + , Style ) where import Text.Pandoc.Definition import Text.Highlighting.Kate diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 301848d6e..81a5e6875 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -81,6 +81,7 @@ import System.FilePath ( (</>) ) import Data.Generics (Typeable, Data) import qualified Control.Monad.State as S import Paths_pandoc (getDataFileName) +import Text.Pandoc.Highlighting (Style, pygments) -- -- List processing @@ -479,6 +480,7 @@ data WriterOptions = WriterOptions , writerChapters :: Bool -- ^ Use "chapter" for top-level sects , writerListings :: Bool -- ^ Use listings package for code , writerHighlight :: Bool -- ^ Highlight source code + , writerHighlightStyle :: Style -- ^ Style to use for highlighting } deriving Show {-# DEPRECATED writerXeTeX "writerXeTeX no longer does anything" #-} @@ -513,6 +515,7 @@ defaultWriterOptions = , writerChapters = False , writerListings = False , writerHighlight = False + , writerHighlightStyle = pygments } -- diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index e3ade3c9e..3b926cf06 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -35,7 +35,7 @@ import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.Pandoc.Shared import Text.Pandoc.Templates import Text.Pandoc.Readers.TeXMath -import Text.Pandoc.Highlighting ( highlight, pygments, styleToHtml, +import Text.Pandoc.Highlighting ( highlight, styleToHtml, formatHtmlInline, formatHtmlBlock ) import Text.Pandoc.XML (stripTags, escapeStringForXML) import Network.HTTP ( urlEncode ) @@ -154,7 +154,8 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n") Nothing -> mempty else mempty - let newvars = [("highlighting-css", renderHtml $ styleToHtml pygments) | + let newvars = [("highlighting-css", renderHtml $ styleToHtml + $ writerHighlightStyle opts) | stHighlighting st] ++ [("math", renderHtml math) | stMath st] return (tit, auths, date, toc, thebody, newvars) diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index dd11cd2fe..b0e880bae 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -41,7 +41,7 @@ import Data.Char ( toLower, isPunctuation ) import Control.Monad.State import Text.Pandoc.Pretty import System.FilePath (dropExtension) -import Text.Pandoc.Highlighting (highlight, pygments, styleToLaTeX, +import Text.Pandoc.Highlighting (highlight, styleToLaTeX, formatLaTeXInline, formatLaTeXBlock) data WriterState = @@ -132,7 +132,8 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do [ ("graphics", "yes") | stGraphics st ] ++ [ ("book-class", "yes") | stBook st] ++ [ ("listings", "yes") | writerListings options || stLHS st ] ++ - [ ("highlighting-macros", styleToLaTeX pygments) | stHighlighting st ] ++ + [ ("highlighting-macros", styleToLaTeX + $ writerHighlightStyle opts ) | stHighlighting st ] ++ citecontext return $ if writerStandalone options then renderTemplate context template |