summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2014-07-20 17:00:38 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2014-07-27 00:12:56 +0100
commit43304d6bd6ab920a150b0e27d24239151015ddb2 (patch)
tree0b20281aa0f2aed7c5588c456dc5dc60c4fd2ea1 /pandoc.hs
parentab3589ff0bc2c66c711e7a92021edd79bf52046a (diff)
Txt2Tags Reader: Added recognition of macros
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/pandoc.hs b/pandoc.hs
index b16bfab78..908643a1f 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -65,6 +65,9 @@ import qualified Data.Map as M
import Data.Yaml (decode)
import qualified Data.Yaml as Yaml
import qualified Data.Text as T
+import Control.Applicative ((<$>))
+import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
+import Data.List (intersperse)
copyrightMessage :: String
copyrightMessage = "\nCopyright (C) 2006-2014 John MacFarlane\n" ++
@@ -180,7 +183,7 @@ data Opt = Opt
, optTeXLigatures :: Bool -- ^ Use TeX ligatures for quotes/dashes
, optDefaultImageExtension :: String -- ^ Default image extension
, optTrace :: Bool -- ^ Print debug information
- , optTrackChanges :: TrackChanges -- ^ Accept or reject MS Word track-changes.
+ , optTrackChanges :: TrackChanges -- ^ Accept or reject MS Word track-changes.
}
-- | Defaults for command-line options.
@@ -1055,9 +1058,14 @@ main = do
else e
Right w -> return w
- reader <- case getReader readerName' of
- Right r -> return r
- Left e -> err 7 e
+ let concatInput = concat (intersperse ", " sources)
+ reader <- if "t2t" == readerName'
+ then (mkStringReader .
+ readTxt2Tags) <$>
+ (getT2TMeta concatInput outputFile)
+ else case getReader readerName' of
+ Right r -> return r
+ Left e -> err 7 e
let standalone' = standalone || not (isTextFormat writerName') || pdfOutput
@@ -1189,11 +1197,11 @@ main = do
else return
doc <- case reader of
- StringReader r->
+ StringReader r->
readSources sources >>=
handleIncludes' . convertTabs . intercalate "\n" >>=
r readerOpts
- ByteStringReader r -> readFiles sources >>= r readerOpts
+ ByteStringReader r -> readFiles sources >>= r readerOpts
let doc0 = M.foldWithKey setMeta doc metadata