From fca95bf43c16f19466df26c7875a5c8be144b77e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 22 Dec 2011 13:21:44 -0800 Subject: Removed highlighting flag. Highlighting support is now standard. --- INSTALL | 18 ++---------------- README | 7 ++----- pandoc.cabal | 17 ++++------------- src/Tests/Old.hs | 6 +----- src/Text/Pandoc/Highlighting.hs | 17 ----------------- src/pandoc.hs | 7 +------ tests/lhs-test.nohl.html | 24 ------------------------ tests/lhs-test.nohl.html+lhs | 24 ------------------------ 8 files changed, 10 insertions(+), 110 deletions(-) delete mode 100644 tests/lhs-test.nohl.html delete mode 100644 tests/lhs-test.nohl.html+lhs diff --git a/INSTALL b/INSTALL index 9c16ddc0a..20b89750b 100644 --- a/INSTALL +++ b/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 diff --git a/README b/README index 6b27d59e9..7790c4c8d 100644 --- a/README +++ b/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:
diff --git a/pandoc.cabal b/pandoc.cabal
index 78037a445..d6eb33d41 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -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
diff --git a/src/Tests/Old.hs b/src/Tests/Old.hs
index 71a198ca1..1ec32a30d 100644
--- a/src/Tests/Old.hs
+++ b/src/Tests/Old.hs
@@ -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 =
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs
index 282c13930..60e900333 100644
--- a/src/Text/Pandoc/Highlighting.hs
+++ b/src/Text/Pandoc/Highlighting.hs
@@ -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
diff --git a/src/pandoc.hs b/src/pandoc.hs
index f855e2d3f..3ef82accc 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -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.
diff --git a/tests/lhs-test.nohl.html b/tests/lhs-test.nohl.html
deleted file mode 100644
index ebe437b18..000000000
--- a/tests/lhs-test.nohl.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-  
-  
-  
-  
-
-
-

lhs test

-

unsplit is an arrow that takes a pair of values and combines them to return a single value:

-
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-unsplit = arr . uncurry       
-          -- arr (\op (x,y) -> x `op` y) 
-
-

(***) 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).

-
f *** g = first f >>> second g
-
-

Block quote:

-
-

foo bar

-
- - diff --git a/tests/lhs-test.nohl.html+lhs b/tests/lhs-test.nohl.html+lhs deleted file mode 100644 index c6205530d..000000000 --- a/tests/lhs-test.nohl.html+lhs +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - -

lhs test

-

unsplit is an arrow that takes a pair of values and combines them to return a single value:

-
> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-> unsplit = arr . uncurry       
->           -- arr (\op (x,y) -> x `op` y) 
-
-

(***) 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).

-
f *** g = first f >>> second g
-
-

Block quote:

-
-

foo bar

-
- - -- cgit v1.2.3