git.iko.soy/typeable/pandoc
on master help sign in
Revert "Added `--filter` option."

This reverts commit 85dacbb282f34dc45a810d7c7b5a2d639b70e1f5.

commit2e5edbb27837372f658b1abbe05371be57415847 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 23 Jul 2013, 23:17 (13 years ago) parent85dacbb
3 files changed+4−30
README−8 pandoc.cabal−1 pandoc.hs+4−21
README−8
@@ -259,14 +259,6 @@ Reader options
259259 require different kinds of images. Currently this option only affects
260260 the markdown and LaTeX readers.
261261
262−`--filter=`*PATH*
263−: Specify an executable to be used as a filter transforming the
264− Pandoc AST after the input is parsed and before the output is
265− written. The executable should read JSON from stdin and write
266− JSON to stdout. The JSON must be formatted like pandoc's own
267− JSON input and output. Filters may be most easily created in Haskell,
268− using the utility function `toJsonFilter` from `Text.Pandoc`.
269−
270262`--normalize`
271263: Normalize the document after reading: merge adjacent
272264 `Str` or `Emph` elements, for example, and remove repeated `Space`s.
pandoc.cabal−1
@@ -360,7 +360,6 @@ Executable pandoc
360360 extensible-exceptions >= 0.1 && < 0.2,
361361 highlighting-kate >= 0.5.5 && < 0.6,
362362 HTTP >= 4000.0.5 && < 4000.3,
363− process >= 1 && < 1.2,
364363 citeproc-hs >= 0.3.7 && < 0.4
365364 if impl(ghc >= 7.0.1)
366365 Ghc-Options: -rtsopts -with-rtsopts=-K16m -Wall -fno-warn-unused-do-bind
pandoc.hs+4−21
@@ -43,7 +43,6 @@ import System.Environment ( getArgs, getProgName )
4343import System.Exit ( exitWith, ExitCode (..) )
4444import System.FilePath
4545import System.Console.GetOpt
46−import System.Process (readProcess)
4746import Data.Char ( toLower )
4847import Data.List ( intercalate, isPrefixOf, sort )
4948import System.Directory ( getAppUserDataDirectory, doesFileExist, findExecutable )
@@ -54,7 +53,6 @@ import Control.Exception.Extensible ( throwIO )
5453import qualified Text.Pandoc.UTF8 as UTF8
5554import qualified Text.CSL as CSL
5655import Control.Monad (when, unless, liftM)
57−import Data.Foldable (foldrM)
5856import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..))
5957import Network.URI (parseURI, isURI, URI(..))
6058import qualified Data.ByteString.Lazy as B
@@ -88,12 +86,6 @@ wrapWords indent c = wrap' (c - indent) (c - indent)
8886isTextFormat :: String -> Bool
8987isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","epub3"]
9088
91−externalFilter :: FilePath -> Pandoc -> IO Pandoc
92−externalFilter f d = E.catch
93− (readJSON def `fmap` readProcess f [] (writeJSON def d))
94− (\e -> let _ = (e :: E.SomeException)
95− in err 83 $ "Error running filter `" ++ f ++ "'")
96−
9789-- | Data structure for command line options.
9890data Opt = Opt
9991 { optTabStop :: Int -- ^ Number of spaces per tab
@@ -280,13 +272,6 @@ options =
280272 "STRING")
281273 "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks"
282274
283− , Option "" ["filter"]
284− (ReqArg
285− (\arg opt -> return opt { optPlugins = externalFilter arg :
286− optPlugins opt })
287− "PROGRAM")
288− "" -- "External JSON filter"
289−
290275 , Option "" ["normalize"]
291276 (NoArg
292277 (\opt -> return opt { optTransforms =
@@ -891,7 +876,6 @@ main = do
891876 , optReferenceLinks = referenceLinks
892877 , optWrapText = wrap
893878 , optColumns = columns
894− , optPlugins = plugins
895879 , optEmailObfuscation = obfuscationMethod
896880 , optIdentifierPrefix = idPrefix
897881 , optIndentedCodeClasses = codeBlockClasses
@@ -1115,7 +1099,6 @@ main = do
11151099 reader readerOpts
11161100
11171101 let doc0 = foldr ($) doc transforms
1118− doc1 <- foldrM ($) doc0 plugins
11191102
11201103 let writeBinary :: B.ByteString -> IO ()
11211104 writeBinary = B.writeFile (UTF8.encodePath outputFile)
@@ -1126,15 +1109,15 @@ main = do
11261109
11271110 case getWriter writerName' of
11281111 Left e -> err 9 e
1129− Right (IOStringWriter f) -> f writerOptions doc1 >>= writerFn outputFile
1130− Right (IOByteStringWriter f) -> f writerOptions doc1 >>= writeBinary
1112+ Right (IOStringWriter f) -> f writerOptions doc0 >>= writerFn outputFile
1113+ Right (IOByteStringWriter f) -> f writerOptions doc0 >>= writeBinary
11311114 Right (PureStringWriter f)
11321115 | pdfOutput -> do
1133− res <- makePDF latexEngine f writerOptions doc1
1116+ res <- makePDF latexEngine f writerOptions doc0
11341117 case res of
11351118 Right pdf -> writeBinary pdf
11361119 Left err' -> err 43 $ UTF8.toStringLazy err'
1137− | otherwise -> selfcontain (f writerOptions doc1 ++
1120+ | otherwise -> selfcontain (f writerOptions doc0 ++
11381121 ['\n' | not standalone'])
11391122 >>= writerFn outputFile . handleEntities
11401123 where htmlFormat = writerName' `elem`