Txt2Tags reader: Header is now parsed only if standalone flag is set
This commit is contained in:
parent
27ea34489a
commit
2cd049a1bf
4 changed files with 7 additions and 3 deletions
|
@ -91,7 +91,10 @@ readTxt2TagsNoMacros = readTxt2Tags def
|
|||
|
||||
parseT2T :: T2T Pandoc
|
||||
parseT2T = do
|
||||
_ <- (Nothing <$ try blankline) <|> (Just <$> (count 3 anyLine))
|
||||
-- Parse header if standalone flag is set
|
||||
optional ((readerStandalone . stateOptions <$> getState)
|
||||
>>= guard
|
||||
>> (() <$ (try blankline) <|> () <$ (count 3 anyLine)))
|
||||
config <- manyTill setting (notFollowedBy setting)
|
||||
-- TODO: Handle settings better
|
||||
let settings = foldr (\(k,v) -> B.setMeta k (MetaString v)) nullMeta config
|
||||
|
|
|
@ -141,7 +141,7 @@ tests = [ testGroup "markdown"
|
|||
"haddock-reader.haddock" "haddock-reader.native"
|
||||
]
|
||||
, testGroup "txt2tags"
|
||||
[ test "reader" ["-r", "t2t", "-w", "native"]
|
||||
[ test "reader" ["-r", "t2t", "-w", "native", "-s"]
|
||||
"txt2tags.t2t" "txt2tags.native" ]
|
||||
, testGroup "epub" [
|
||||
test "features" ["-r", "epub", "-w", "native"]
|
||||
|
|
|
@ -12,7 +12,7 @@ import Data.Monoid (mempty, mconcat)
|
|||
import Text.Pandoc.Readers.Txt2Tags
|
||||
|
||||
t2t :: String -> Pandoc
|
||||
t2t s = readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def ('\n' : s)
|
||||
t2t s = readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def s
|
||||
|
||||
infix 4 =:
|
||||
(=:) :: ToString c
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Pandoc (Meta {unMeta = fromList []})
|
||||
[Para [Str "This",Space,Str "document",Space,Str "describes",Space,Str "all",Space,Str "the",Space,Str "details",Space,Str "about",Space,Str "each",Space,Str "txt2tags",Space,Str "mark.",Space,Str "The",Space,Str "target",Space,Str "audience",Space,Str "are",Space,Strong [Str "experienced"],Space,Str "users.",Space,Str "You",Space,Str "may",Space,Str "find",Space,Str "it",Space,Str "useful",Space,Str "if",Space,Str "you",Space,Str "want",Space,Str "to",Space,Str "master",Space,Str "the",Space,Str "marks",Space,Str "or",Space,Str "solve",Space,Str "a",Space,Str "specific",Space,Str "problem",Space,Str "about",Space,Str "a",Space,Str "mark."]
|
||||
,Para [Str "If",Space,Str "you",Space,Str "are",Space,Str "new",Space,Str "to",Space,Str "txt2tags",Space,Str "or",Space,Str "just",Space,Str "want",Space,Str "to",Space,Str "know",Space,Str "which",Space,Str "are",Space,Str "the",Space,Str "available",Space,Str "marks,",Space,Str "please",Space,Str "read",Space,Str "the",Space,Link [Str "Markup",Space,Str "Demo"] ("MARKUPDEMO",""),Str "."]
|
||||
,Para [Str "Note",Space,Str "1:",Space,Str "This",Space,Str "document",Space,Str "is",Space,Str "generated",Space,Str "directly",Space,Str "from",Space,Str "the",Space,Str "txt2tags",Space,Str "test-suite.",Space,Str "All",Space,Str "the",Space,Str "rules",Space,Str "mentioned",Space,Str "here",Space,Str "are",Space,Str "100%",Space,Str "in",Space,Str "sync",Space,Str "with",Space,Str "the",Space,Str "current",Space,Str "program",Space,Str "code."]
|
||||
|
|
Loading…
Add table
Reference in a new issue