From aca695ab0bb5e18e3a2ea6d7b81d9814885c1b00 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 13 Sep 2016 18:21:03 +0200 Subject: TEI writer: remove heuristic to detect book template TEI doesn't have `` elements but only generic `` division elements. Checking the template for a trailing `` is nonsensical. --- src/Text/Pandoc/Writers/TEI.hs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/TEI.hs b/src/Text/Pandoc/Writers/TEI.hs index 018884202..076c1ae3a 100644 --- a/src/Text/Pandoc/Writers/TEI.hs +++ b/src/Text/Pandoc/Writers/TEI.hs @@ -35,7 +35,7 @@ import Text.Pandoc.Shared import Text.Pandoc.Writers.Shared import Text.Pandoc.Options import Text.Pandoc.Templates (renderTemplate') -import Data.List ( stripPrefix, isPrefixOf, isSuffixOf ) +import Data.List ( stripPrefix, isPrefixOf ) import Data.Char ( toLower ) import Text.Pandoc.Highlighting ( languages, languagesByExtension ) import Text.Pandoc.Pretty @@ -60,19 +60,15 @@ writeTEI opts (Pandoc meta blocks) = then Just $ writerColumns opts else Nothing render' = render colwidth - opts' = if "/book>" `isSuffixOf` - (trimr $ writerTemplate opts) - then opts{ writerChapters = True } - else opts - startLvl = if writerChapters opts' then 0 else 1 + startLvl = if writerChapters opts then 0 else 1 auths' = map (authorToTEI opts) $ docAuthors meta meta' = B.setMeta "author" auths' meta Just metadata = metaToJSON opts (Just . render colwidth . (vcat . - (map (elementToTEI opts' startLvl)) . hierarchicalize)) - (Just . render colwidth . inlinesToTEI opts') + (map (elementToTEI opts startLvl)) . hierarchicalize)) + (Just . render colwidth . inlinesToTEI opts) meta' - main = render' $ vcat (map (elementToTEI opts' startLvl) elements) + main = render' $ vcat (map (elementToTEI opts startLvl) elements) context = defField "body" main $ defField "mathml" (case writerHTMLMathMethod opts of MathML _ -> True -- cgit v1.2.3