Permalink
Browse files

Removed highlighting flag. Highlighting support is now standard.

  • Loading branch information...
John MacFarlane
John MacFarlane committed Dec 22, 2011
1 parent f61e09c commit fca95bf43c16f19466df26c7875a5c8be144b77e
Showing with 10 additions and 110 deletions.
  1. +2 −16 INSTALL
  2. +2 −5 README
  3. +4 −13 pandoc.cabal
  4. +1 −5 src/Tests/Old.hs
  5. +0 −17 src/Text/Pandoc/Highlighting.hs
  6. +1 −6 src/pandoc.hs
  7. +0 −24 tests/lhs-test.nohl.html
  8. +0 −24 tests/lhs-test.nohl.html+lhs
View
18 INSTALL
@@ -15,11 +15,6 @@ the [cabal-install] build tool.
cabal install pandoc
- If you want support for source code syntax highlighting, set
- the `highlighting` flag:
-
- cabal install -fhighlighting pandoc
-
This procedure will install the released version of pandoc,
which will be downloaded automatically from HackageDB.
If you want to install a modified or development version
@@ -28,15 +23,6 @@ the [cabal-install] build tool.
cabal install
- If you are on OSX, you may encounter an error installing highlighting-kate,
-
- ld: scattered reloc r_address too large
-
- The workaround is this:
-
- cabal install highlighting-kate --disable-library-for-ghci
- cabal install pandoc -fhighlighting -f-wrappers
-
3. Make sure the `$CABALDIR/bin` directory is in your path. You should
now be able to run `pandoc`:
@@ -60,8 +46,7 @@ quick install, but this information may be of use to packagers.
For more details, see the [Cabal User's Guide].
1. Install dependencies: in addition to the [Haskell platform],
-you will need [zip-archive] and (if you want syntax highlighting)
-[highlighting-kate].
+you will need [zip-archive], [blaze-html], and [highlighting-kate].
2. Configure:
@@ -114,5 +99,6 @@ you will need [zip-archive] and (if you want syntax highlighting)
[zip-archive]: http://hackage.haskell.org/package/zip-archive
[highlighting-kate]: http://hackage.haskell.org/package/highlighting-kate
+[blaze-html]: http://hackage.haskell.org/package/blaze-html
[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
View
7 README
@@ -842,12 +842,9 @@ this syntax:
Some output formats can use this information to do syntax highlighting.
Currently, the only output format that uses this information is HTML.
-
-If pandoc has been compiled with syntax highlighting support, then the
+If highlighting is supported for your output format and language, then the
code block above will appear highlighted, with numbered lines. (To see
-which languages are supported, do `pandoc --version`.)
-
-If pandoc has not been compiled with syntax highlighting support, the
+which languages are supported, do `pandoc --version`.) Otherwise, the
code block above will appear as follows:
<pre class="haskell">
View
@@ -179,9 +179,6 @@ Source-repository head
Flag threaded
Description: Compile markdown2pdf with -threaded option.
Default: True
-Flag highlighting
- Description: Compile in support for syntax highlighting of code blocks.
- Default: False
Flag executable
Description: Build the pandoc executable.
Default: True
@@ -225,14 +222,12 @@ Library
dlist >= 0.4 && < 0.6,
tagsoup >= 0.12.5 && < 0.13,
base64-bytestring >= 0.1 && < 0.2,
- zlib >= 0.5 && <= 0.6
+ zlib >= 0.5 && <= 0.6,
+ highlighting-kate >= 0.4 && < 0.5
if impl(ghc >= 6.10)
Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4
else
Build-depends: base >= 3 && < 4
- if flag(highlighting)
- Build-depends: highlighting-kate >= 0.4 && < 0.5
- cpp-options: -D_HIGHLIGHTING
if impl(ghc >= 6.12)
Ghc-Options: -O2 -Wall -fno-warn-unused-do-bind
else
@@ -313,14 +308,12 @@ Executable pandoc
dlist >= 0.4 && < 0.6,
tagsoup >= 0.12.5 && < 0.13,
base64-bytestring >= 0.1 && < 0.2,
- zlib >= 0.5 && <= 0.6
+ zlib >= 0.5 && <= 0.6,
+ highlighting-kate >= 0.4 && < 0.5
if impl(ghc >= 6.10)
Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4
else
Build-depends: base >= 3 && < 4
- if flag(highlighting)
- Build-depends: highlighting-kate >= 0.4 && < 0.5
- cpp-options: -D_HIGHLIGHTING
if impl(ghc >= 6.12)
Ghc-Options: -O2 -Wall -fno-warn-unused-do-bind
else
@@ -353,8 +346,6 @@ Executable markdown2pdf
Executable test-pandoc
Hs-Source-Dirs: src
Main-Is: test-pandoc.hs
- if flag(highlighting)
- cpp-options: -D_HIGHLIGHTING
if impl(ghc >= 7)
cpp-options: -D_LIT=lit
else
View
@@ -13,7 +13,6 @@ import Data.Algorithm.Diff
import Text.Pandoc.Shared ( normalize, defaultWriterOptions )
import Text.Pandoc.Writers.Native ( writeNative )
import Text.Pandoc.Readers.Native ( readNative )
-import Text.Pandoc.Highlighting ( languages )
import Prelude hiding ( readFile )
import qualified Data.ByteString.Lazy as B
import Data.ByteString.Lazy.UTF8 (toString)
@@ -121,10 +120,7 @@ lhsWriterTests format
]
where
t n f = test n ["--columns=78", "-r", "native", "-s", "-w", f]
- "lhs-test.native" ("lhs-test" <.> ext f)
- ext f = if null languages && format == "html"
- then "nohl" <.> f
- else f
+ "lhs-test.native" ("lhs-test" <.> f)
lhsReaderTest :: String -> Test
lhsReaderTest format =
@@ -36,7 +36,6 @@ module Text.Pandoc.Highlighting ( languages
) where
import Text.Blaze
import Text.Pandoc.Definition
-#ifdef _HIGHLIGHTING
import Text.Highlighting.Kate ( SourceLine, languages, highlightAs, formatAsHtml,
TokenType(..), formatAsLaTeX, FormatOption (..), defaultHighlightingCss, languagesByExtension )
import Data.List (find)
@@ -82,19 +81,3 @@ highlightLaTeX :: Bool -- ^ True if inline
-> Maybe String -- ^ Maybe formatted LaTeX
highlightLaTeX = highlight formatAsLaTeX
-#else
-defaultHighlightingCss :: String
-defaultHighlightingCss = ""
-
-languages :: [String]
-languages = []
-
-languagesByExtension :: String -> [String]
-languagesByExtension _ = []
-
-highlightHtml :: Bool -> Attr -> String -> Maybe Html
-highlightHtml _ _ _ = Left "Pandoc was not compiled with support for highlighting"
-
-highlightLaTeX :: Bool -> Attr -> String -> Maybe String
-highlightLaTeX _ _ _ = Left "Pandoc was not compiled with support for highlighting"
-#endif
View
@@ -33,9 +33,7 @@ import Text.Pandoc
import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile,
headerShift, findDataFile, normalize )
import Text.Pandoc.SelfContained ( makeSelfContained )
-#ifdef _HIGHLIGHTING
import Text.Pandoc.Highlighting ( languages )
-#endif
import System.Environment ( getArgs, getProgName )
import System.Exit ( exitWith, ExitCode (..) )
import System.FilePath
@@ -65,11 +63,8 @@ copyrightMessage = "\nCopyright (C) 2006-2011 John MacFarlane\n" ++
compileInfo :: String
compileInfo =
"\nCompiled with citeproc support." ++
-#ifdef _HIGHLIGHTING
"\nCompiled with syntax highlighting support for:\n" ++
- wrapWords 78 languages ++
-#endif
- ""
+ wrapWords 78 languages
-- | Converts a list of strings into a single string with the items printed as
-- comma separated words in lines with a maximum line length.
View
@@ -1,24 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <meta name="generator" content="pandoc" />
- <title></title>
-</head>
-<body>
-<h1 id="lhs-test">lhs test</h1>
-<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
-<pre class="sourceCode haskell"><code>unsplit :: (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d
-unsplit = arr . uncurry
- -- arr (\op (x,y) -&gt; x `op` y)
-</code></pre>
-<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>
-<pre><code>f *** g = first f &gt;&gt;&gt; second g
-</code></pre>
-<p>Block quote:</p>
-<blockquote>
-<p>foo bar</p>
-</blockquote>
-</body>
-</html>
@@ -1,24 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <meta name="generator" content="pandoc" />
- <title></title>
-</head>
-<body>
-<h1 id="lhs-test">lhs test</h1>
-<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
-<pre class="sourceCode literate haskell"><code>&gt; unsplit :: (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d
-&gt; unsplit = arr . uncurry
-&gt; -- arr (\op (x,y) -&gt; x `op` y)
-</code></pre>
-<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>
-<pre><code>f *** g = first f &gt;&gt;&gt; second g
-</code></pre>
-<p>Block quote:</p>
-<blockquote>
-<p>foo bar</p>
-</blockquote>
-</body>
-</html>

0 comments on commit fca95bf

Please sign in to comment.