git.iko.soy/typeable/pandoc
on master help sign in
Removed highlighting flag. Highlighting support is now standard.
commitfca95bf43c16f19466df26c7875a5c8be144b77e authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 22 Dec 2011, 13:21 (15 years ago) parentf61e09c
8 files changed+10−110
INSTALL+2−16 README+2−5 pandoc.cabal+4−13 src/Tests/Old.hs+1−5 src/Text/Pandoc/Highlighting.hs−17 src/pandoc.hs+1−6 tests/lhs-test.nohl.html−24 tests/lhs-test.nohl.html+lhs−24
INSTALL+2−16
@@ -15,11 +15,6 @@ the [cabal-install] build tool.
1515
1616 cabal install pandoc
1717
18− If you want support for source code syntax highlighting, set
19− the `highlighting` flag:
20−
21− cabal install -fhighlighting pandoc
22−
2318 This procedure will install the released version of pandoc,
2419 which will be downloaded automatically from HackageDB.
2520 If you want to install a modified or development version
@@ -28,15 +23,6 @@ the [cabal-install] build tool.
2823
2924 cabal install
3025
31− If you are on OSX, you may encounter an error installing highlighting-kate,
32−
33− ld: scattered reloc r_address too large
34−
35− The workaround is this:
36−
37− cabal install highlighting-kate --disable-library-for-ghci
38− cabal install pandoc -fhighlighting -f-wrappers
39−
40263. Make sure the `$CABALDIR/bin` directory is in your path. You should
4127now be able to run `pandoc`:
4228
@@ -60,8 +46,7 @@ quick install, but this information may be of use to packagers.
6046For more details, see the [Cabal User's Guide].
6147
62481. Install dependencies: in addition to the [Haskell platform],
63−you will need [zip-archive] and (if you want syntax highlighting)
64−[highlighting-kate].
49+you will need [zip-archive], [blaze-html], and [highlighting-kate].
6550
66512. Configure:
6752
@@ -114,5 +99,6 @@ you will need [zip-archive] and (if you want syntax highlighting)
11499
115100[zip-archive]: http://hackage.haskell.org/package/zip-archive
116101[highlighting-kate]: http://hackage.haskell.org/package/highlighting-kate
102+[blaze-html]: http://hackage.haskell.org/package/blaze-html
117103[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
118104
README+2−5
@@ -842,12 +842,9 @@ this syntax:
842842
843843Some output formats can use this information to do syntax highlighting.
844844Currently, the only output format that uses this information is HTML.
845−
846−If pandoc has been compiled with syntax highlighting support, then the
845+If highlighting is supported for your output format and language, then the
847846code block above will appear highlighted, with numbered lines. (To see
848−which languages are supported, do `pandoc --version`.)
849−
850−If pandoc has not been compiled with syntax highlighting support, the
847+which languages are supported, do `pandoc --version`.) Otherwise, the
851848code block above will appear as follows:
852849
853850 <pre class="haskell">
pandoc.cabal+4−13
@@ -179,9 +179,6 @@ Source-repository head
179179Flag threaded
180180 Description: Compile markdown2pdf with -threaded option.
181181 Default: True
182−Flag highlighting
183− Description: Compile in support for syntax highlighting of code blocks.
184− Default: False
185182Flag executable
186183 Description: Build the pandoc executable.
187184 Default: True
@@ -225,14 +222,12 @@ Library
225222 dlist >= 0.4 && < 0.6,
226223 tagsoup >= 0.12.5 && < 0.13,
227224 base64-bytestring >= 0.1 && < 0.2,
228− zlib >= 0.5 && <= 0.6
225+ zlib >= 0.5 && <= 0.6,
226+ highlighting-kate >= 0.4 && < 0.5
229227 if impl(ghc >= 6.10)
230228 Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4
231229 else
232230 Build-depends: base >= 3 && < 4
233− if flag(highlighting)
234− Build-depends: highlighting-kate >= 0.4 && < 0.5
235− cpp-options: -D_HIGHLIGHTING
236231 if impl(ghc >= 6.12)
237232 Ghc-Options: -O2 -Wall -fno-warn-unused-do-bind
238233 else
@@ -313,14 +308,12 @@ Executable pandoc
313308 dlist >= 0.4 && < 0.6,
314309 tagsoup >= 0.12.5 && < 0.13,
315310 base64-bytestring >= 0.1 && < 0.2,
316− zlib >= 0.5 && <= 0.6
311+ zlib >= 0.5 && <= 0.6,
312+ highlighting-kate >= 0.4 && < 0.5
317313 if impl(ghc >= 6.10)
318314 Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4
319315 else
320316 Build-depends: base >= 3 && < 4
321− if flag(highlighting)
322− Build-depends: highlighting-kate >= 0.4 && < 0.5
323− cpp-options: -D_HIGHLIGHTING
324317 if impl(ghc >= 6.12)
325318 Ghc-Options: -O2 -Wall -fno-warn-unused-do-bind
326319 else
@@ -353,8 +346,6 @@ Executable markdown2pdf
353346Executable test-pandoc
354347 Hs-Source-Dirs: src
355348 Main-Is: test-pandoc.hs
356− if flag(highlighting)
357− cpp-options: -D_HIGHLIGHTING
358349 if impl(ghc >= 7)
359350 cpp-options: -D_LIT=lit
360351 else
src/Tests/Old.hs+1−5
@@ -13,7 +13,6 @@ import Data.Algorithm.Diff
1313import Text.Pandoc.Shared ( normalize, defaultWriterOptions )
1414import Text.Pandoc.Writers.Native ( writeNative )
1515import Text.Pandoc.Readers.Native ( readNative )
16−import Text.Pandoc.Highlighting ( languages )
1716import Prelude hiding ( readFile )
1817import qualified Data.ByteString.Lazy as B
1918import Data.ByteString.Lazy.UTF8 (toString)
@@ -121,10 +120,7 @@ lhsWriterTests format
121120 ]
122121 where
123122 t n f = test n ["--columns=78", "-r", "native", "-s", "-w", f]
124− "lhs-test.native" ("lhs-test" <.> ext f)
125− ext f = if null languages && format == "html"
126− then "nohl" <.> f
127− else f
123+ "lhs-test.native" ("lhs-test" <.> f)
128124
129125lhsReaderTest :: String -> Test
130126lhsReaderTest format =
src/Text/Pandoc/Highlighting.hs−17
@@ -36,7 +36,6 @@ module Text.Pandoc.Highlighting ( languages
3636 ) where
3737import Text.Blaze
3838import Text.Pandoc.Definition
39−#ifdef _HIGHLIGHTING
4039import Text.Highlighting.Kate ( SourceLine, languages, highlightAs, formatAsHtml,
4140 TokenType(..), formatAsLaTeX, FormatOption (..), defaultHighlightingCss, languagesByExtension )
4241import Data.List (find)
@@ -82,19 +81,3 @@ highlightLaTeX :: Bool -- ^ True if inline
8281 -> Maybe String -- ^ Maybe formatted LaTeX
8382highlightLaTeX = highlight formatAsLaTeX
8483
85−#else
86−defaultHighlightingCss :: String
87−defaultHighlightingCss = ""
88−
89−languages :: [String]
90−languages = []
91−
92−languagesByExtension :: String -> [String]
93−languagesByExtension _ = []
94−
95−highlightHtml :: Bool -> Attr -> String -> Maybe Html
96−highlightHtml _ _ _ = Left "Pandoc was not compiled with support for highlighting"
97−
98−highlightLaTeX :: Bool -> Attr -> String -> Maybe String
99−highlightLaTeX _ _ _ = Left "Pandoc was not compiled with support for highlighting"
100−#endif
src/pandoc.hs+1−6
@@ -33,9 +33,7 @@ import Text.Pandoc
3333import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile,
3434 headerShift, findDataFile, normalize )
3535import Text.Pandoc.SelfContained ( makeSelfContained )
36−#ifdef _HIGHLIGHTING
3736import Text.Pandoc.Highlighting ( languages )
38−#endif
3937import System.Environment ( getArgs, getProgName )
4038import System.Exit ( exitWith, ExitCode (..) )
4139import System.FilePath
@@ -65,11 +63,8 @@ copyrightMessage = "\nCopyright (C) 2006-2011 John MacFarlane\n" ++
6563compileInfo :: String
6664compileInfo =
6765 "\nCompiled with citeproc support." ++
68−#ifdef _HIGHLIGHTING
6966 "\nCompiled with syntax highlighting support for:\n" ++
70− wrapWords 78 languages ++
71−#endif
72− ""
67+ wrapWords 78 languages
7368
7469-- | Converts a list of strings into a single string with the items printed as
7570-- comma separated words in lines with a maximum line length.
tests/lhs-test.nohl.htmldeleted−24
@@ -1,24 +0,0 @@
1−<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2−<html xmlns="http://www.w3.org/1999/xhtml">
3−<head>
4− <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5− <meta http-equiv="Content-Style-Type" content="text/css" />
6− <meta name="generator" content="pandoc" />
7− <title></title>
8−</head>
9−<body>
10−<h1 id="lhs-test">lhs test</h1>
11−<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
12−<pre class="sourceCode haskell"><code>unsplit :: (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d
13−unsplit = arr . uncurry
14− -- arr (\op (x,y) -&gt; x `op` y)
15−</code></pre>
16−<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p>
17−<pre><code>f *** g = first f &gt;&gt;&gt; second g
18−</code></pre>
19−<p>Block quote:</p>
20−<blockquote>
21−<p>foo bar</p>
22−</blockquote>
23−</body>
24−</html>
tests/lhs-test.nohl.html+lhsdeleted−24
@@ -1,24 +0,0 @@
1−<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2−<html xmlns="http://www.w3.org/1999/xhtml">
3−<head>
4− <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5− <meta http-equiv="Content-Style-Type" content="text/css" />
6− <meta name="generator" content="pandoc" />
7− <title></title>
8−</head>
9−<body>
10−<h1 id="lhs-test">lhs test</h1>
11−<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
12−<pre class="sourceCode literate haskell"><code>&gt; unsplit :: (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d
13−&gt; unsplit = arr . uncurry
14−&gt; -- arr (\op (x,y) -&gt; x `op` y)
15−</code></pre>
16−<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p>
17−<pre><code>f *** g = first f &gt;&gt;&gt; second g
18−</code></pre>
19−<p>Block quote:</p>
20−<blockquote>
21−<p>foo bar</p>
22−</blockquote>
23−</body>
24−</html>