summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-09-13 18:21:03 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-09-13 18:21:03 +0200
commitaca695ab0bb5e18e3a2ea6d7b81d9814885c1b00 (patch)
tree94f1a6fb35d90c97f2f11ce5329bf6513d01e3cc
parent23fb52ef7d0357a0e8abc391f6590e5cbfd606b0 (diff)
TEI writer: remove heuristic to detect book template
TEI doesn't have `<book>` elements but only generic `<divN>` division elements. Checking the template for a trailing `</book>` is nonsensical.
-rw-r--r--src/Text/Pandoc/Writers/TEI.hs14
1 files changed, 5 insertions, 9 deletions
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