git.iko.soy/typeable/pandoc
on master help sign in
Minor changes due to changes in highlighting-kate API.

defaultHighlightingCss now imported rather than duplicated. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1235 788f1e2b-df1e-0410-8736-df70ead52e1b

commit9a7ca4d9aa385d24751652f84273672351b10647 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 10 Feb 2008, 18:59 (19 years ago) parent9c9b41e
3 files changed+8−26
Text/Pandoc/Writers/HTML.hs+2−23 templates/Highlighting.no.hs+4−1 templates/Highlighting.yes.hs+2−2
Text/Pandoc/Writers/HTML.hs+2−23
@@ -33,7 +33,7 @@ import Text.Pandoc.ASCIIMathML
3333import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
3434import Text.Pandoc.Shared
3535import Text.Pandoc.Readers.TeXMath
36−import Text.Pandoc.Highlighting ( highlightHtml )
36+import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss )
3737import Numeric ( showHex )
3838import Data.Char ( ord, toLower, isAlpha )
3939import Data.List ( isPrefixOf, intersperse, find )
@@ -223,27 +223,6 @@ addToCSS item = do
223223 let current = stCSS st
224224 put $ st {stCSS = S.insert item current}
225225
226−-- | Generic CSS for syntax highlighting.
227−highlightingCSS :: String
228−highlightingCSS =
229− "pre.sourceCode { }\n\
230− \pre.sourceCode span.LineNumber { display: none; }\n\
231− \pre.numberLines span.LineNumber { display: inline; color: #AAAAAA; padding-right: 0; border-right: 1px solid #AAAAAA; margin-right: 3px; }\n\
232− \pre.sourceCode span.Normal { }\n\
233− \pre.sourceCode span.Keyword { color: #007020; font-weight: bold; } \n\
234− \pre.sourceCode span.DataType { color: #902000; }\n\
235− \pre.sourceCode span.DecVal { color: #40a070; }\n\
236− \pre.sourceCode span.BaseN { color: #40a070; }\n\
237− \pre.sourceCode span.Float { color: #40a070; }\n\
238− \pre.sourceCode span.Char { color: #4070a0; }\n\
239− \pre.sourceCode span.String { color: #4070a0; }\n\
240− \pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }\n\
241− \pre.sourceCode span.Others { color: #007020; }\n\
242− \pre.sourceCode span.Alert { color: red; font-weight: bold; }\n\
243− \pre.sourceCode span.Function { color: #06287e; }\n\
244− \pre.sourceCode span.RegionMarker { }\n\
245− \pre.sourceCode span.Error { color: red; font-weight: bold; }"
246−
247226-- | Convert Pandoc inline list to plain text identifier.
248227inlineListToIdentifier :: [Inline] -> String
249228inlineListToIdentifier = dropWhile (not . isAlpha) . inlineListToIdentifier'
@@ -298,7 +277,7 @@ blockToHtml opts (CodeBlock attr@(_,classes,_) rawCode) = do
298277 then []
299278 else [theclass $ unwords classes]) $ thecode <<
300279 (rawCode ++ "\n")
301− Right h -> addToCSS highlightingCSS >> return h
280+ Right h -> addToCSS defaultHighlightingCss >> return h
302281blockToHtml opts (BlockQuote blocks) =
303282 -- in S5, treat list in blockquote specially
304283 -- if default is incremental, make it nonincremental;
templates/Highlighting.no.hs+4−1
@@ -28,10 +28,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2828Exports functions for syntax highlighting.
2929-}
3030
31−module Text.Pandoc.Highlighting ( languages, highlightHtml ) where
31+module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss ) where
3232import Text.XHtml
3333import Text.Pandoc.Definition
3434
35+defaultHighlightingCss :: String
36+defaultHighlightingCss = ""
37+
3538languages :: [String]
3639languages = []
3740
templates/Highlighting.yes.hs+2−2
@@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2828Exports functions for syntax highlighting.
2929-}
3030
31−module Text.Pandoc.Highlighting ( languages, highlightHtml ) where
32−import Text.Highlighting.Kate
31+module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss ) where
32+import Text.Highlighting.Kate ( languages, highlightAs, formatAsXHtml, FormatOption (..), defaultHighlightingCss )
3333import Text.XHtml
3434import Data.List (find, lookup)
3535import Data.Maybe (fromMaybe)