Use default highlighting CSS rather than embedding CSS in templates.

This commit is contained in:
John MacFarlane 2010-07-16 00:23:13 -07:00
parent 3adacdb04e
commit 85f8c51b64
5 changed files with 31 additions and 66 deletions

View file

@ -34,7 +34,7 @@ import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
import Text.Pandoc.Shared
import Text.Pandoc.Templates
import Text.Pandoc.Readers.TeXMath
import Text.Pandoc.Highlighting ( highlightHtml )
import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss )
import Text.Pandoc.XML (stripTags, escapeStringForXML)
import Network.HTTP ( urlEncode )
import Numeric ( showHex )
@ -136,7 +136,8 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do
primHtml s
Nothing -> noHtml
else noHtml
let newvars = [("highlighting","yes") | stHighlighting st] ++
let newvars = [("highlighting-css", defaultHighlightingCss) |
stHighlighting st] ++
[("math", renderHtmlFragment math) | stMath st]
return (tit, auths, date, toc, thebody, newvars)

View file

@ -10,26 +10,9 @@ $endfor$
$if(date)$
<meta name="date" content="$date$" />
$endif$
$if(highlighting)$
$if(highlighting-css)$
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
td.lineNumbers { text-align: right; background-color: #EBEBEB; color: black; padding-right: 5px; padding-left: 5px; }
td.sourceCode { padding-left: 5px; }
pre.sourceCode { }
pre.sourceCode span.kw { font-weight: bold; }
pre.sourceCode span.dt { color: #800000; }
pre.sourceCode span.dv { color: #0000FF; }
pre.sourceCode span.bn { color: #0000FF; }
pre.sourceCode span.fl { color: #800080; }
pre.sourceCode span.ch { color: #FF00FF; }
pre.sourceCode span.st { color: #DD0000; }
pre.sourceCode span.co { color: #808080; font-style: italic; }
pre.sourceCode span.ot { }
pre.sourceCode span.al { color: green; font-weight: bold; }
pre.sourceCode span.fu { color: #000080; }
pre.sourceCode span.re { }
pre.sourceCode span.er { color: red; font-weight: bold; }
$highlighting-css$
</style>
$endif$
$for(css)$

View file

@ -12,26 +12,9 @@ $endfor$
$if(date)$
<meta name="date" content="$date$" />
$endif$
$if(highlighting)$
$if(highlighting-css)$
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
td.lineNumbers { text-align: right; background-color: #EBEBEB; color: black; padding-right: 5px; padding-left: 5px; }
td.sourceCode { padding-left: 5px; }
pre.sourceCode { }
pre.sourceCode span.kw { font-weight: bold; }
pre.sourceCode span.dt { color: #800000; }
pre.sourceCode span.dv { color: #0000FF; }
pre.sourceCode span.bn { color: #0000FF; }
pre.sourceCode span.fl { color: #800080; }
pre.sourceCode span.ch { color: #FF00FF; }
pre.sourceCode span.st { color: #DD0000; }
pre.sourceCode span.co { color: #808080; font-style: italic; }
pre.sourceCode span.ot { }
pre.sourceCode span.al { color: green; font-weight: bold; }
pre.sourceCode span.fu { color: #000080; }
pre.sourceCode span.re { }
pre.sourceCode span.er { color: red; font-weight: bold; }
$highlighting-css$
</style>
$endif$
$for(css)$

View file

@ -7,20 +7,19 @@
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
td.lineNumbers { text-align: right; background-color: #EBEBEB; color: black; padding-right: 5px; padding-left: 5px; }
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
td.sourceCode { padding-left: 5px; }
pre.sourceCode { }
pre.sourceCode span.kw { font-weight: bold; }
pre.sourceCode span.dt { color: #800000; }
pre.sourceCode span.dv { color: #0000FF; }
pre.sourceCode span.bn { color: #0000FF; }
pre.sourceCode span.fl { color: #800080; }
pre.sourceCode span.ch { color: #FF00FF; }
pre.sourceCode span.st { color: #DD0000; }
pre.sourceCode span.co { color: #808080; font-style: italic; }
pre.sourceCode span.ot { }
pre.sourceCode span.al { color: green; font-weight: bold; }
pre.sourceCode span.fu { color: #000080; }
pre.sourceCode span.kw { color: #007020; font-weight: bold; }
pre.sourceCode span.dt { color: #902000; }
pre.sourceCode span.dv { color: #40a070; }
pre.sourceCode span.bn { color: #40a070; }
pre.sourceCode span.fl { color: #40a070; }
pre.sourceCode span.ch { color: #4070a0; }
pre.sourceCode span.st { color: #4070a0; }
pre.sourceCode span.co { color: #60a0b0; font-style: italic; }
pre.sourceCode span.ot { color: #007020; }
pre.sourceCode span.al { color: red; font-weight: bold; }
pre.sourceCode span.fu { color: #06287e; }
pre.sourceCode span.re { }
pre.sourceCode span.er { color: red; font-weight: bold; }
</style>

View file

@ -7,20 +7,19 @@
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
td.lineNumbers { text-align: right; background-color: #EBEBEB; color: black; padding-right: 5px; padding-left: 5px; }
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
td.sourceCode { padding-left: 5px; }
pre.sourceCode { }
pre.sourceCode span.kw { font-weight: bold; }
pre.sourceCode span.dt { color: #800000; }
pre.sourceCode span.dv { color: #0000FF; }
pre.sourceCode span.bn { color: #0000FF; }
pre.sourceCode span.fl { color: #800080; }
pre.sourceCode span.ch { color: #FF00FF; }
pre.sourceCode span.st { color: #DD0000; }
pre.sourceCode span.co { color: #808080; font-style: italic; }
pre.sourceCode span.ot { }
pre.sourceCode span.al { color: green; font-weight: bold; }
pre.sourceCode span.fu { color: #000080; }
pre.sourceCode span.kw { color: #007020; font-weight: bold; }
pre.sourceCode span.dt { color: #902000; }
pre.sourceCode span.dv { color: #40a070; }
pre.sourceCode span.bn { color: #40a070; }
pre.sourceCode span.fl { color: #40a070; }
pre.sourceCode span.ch { color: #4070a0; }
pre.sourceCode span.st { color: #4070a0; }
pre.sourceCode span.co { color: #60a0b0; font-style: italic; }
pre.sourceCode span.ot { color: #007020; }
pre.sourceCode span.al { color: red; font-weight: bold; }
pre.sourceCode span.fu { color: #06287e; }
pre.sourceCode span.re { }
pre.sourceCode span.er { color: red; font-weight: bold; }
</style>