@@ -35,7 +35,7 @@ import Text.Pandoc.Shared
3535import Text.Pandoc.Writers.Shared
3636import Text.Pandoc.Options
3737import Text.Pandoc.Templates (renderTemplate')
38−import Data.List ( stripPrefix, isPrefixOf, isSuffixOf )
38+import Data.List ( stripPrefix, isPrefixOf )
3939import Data.Char ( toLower )
4040import Text.Pandoc.Highlighting ( languages, languagesByExtension )
4141import Text.Pandoc.Pretty
@@ -60,19 +60,15 @@ writeTEI opts (Pandoc meta blocks) =
6060 then Just $ writerColumns opts
6161 else Nothing
6262 render' = render colwidth
63− opts' = if "/book>" `isSuffixOf`
64− (trimr $ writerTemplate opts)
65− then opts{ writerChapters = True }
66− else opts
67− startLvl = if writerChapters opts' then 0 else 1
63+ startLvl = if writerChapters opts then 0 else 1
6864 auths' = map (authorToTEI opts) $ docAuthors meta
6965 meta' = B.setMeta "author" auths' meta
7066 Just metadata = metaToJSON opts
7167 (Just . render colwidth . (vcat .
72− (map (elementToTEI opts' startLvl)) . hierarchicalize))
73− (Just . render colwidth . inlinesToTEI opts')
68+ (map (elementToTEI opts startLvl)) . hierarchicalize))
69+ (Just . render colwidth . inlinesToTEI opts)
7470 meta'
75− main = render' $ vcat (map (elementToTEI opts' startLvl) elements)
71+ main = render' $ vcat (map (elementToTEI opts startLvl) elements)
7672 context = defField "body" main
7773 $ defField "mathml" (case writerHTMLMathMethod opts of
7874 MathML _ -> True