aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-11-02 10:20:41 -0700
committerJohn MacFarlane <[email protected]>2022-11-02 10:20:41 -0700
commit8718fab96447160486321603e9257f31ae99e4e3 (patch)
tree65d56c3eae9c2da8dd32b10345f8e5b069e39efa
parent56e35cd958878972b8e2b08e07e49469e27acd74 (diff)
EPUB writer: add includeTitlePage param to createNavEntry.
So far this isn't used, but it contributes to solving #6097.
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 553d7dac0..8f03ea211 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -696,7 +696,7 @@ pandocToEPUB version opts doc = do
-- Create the navEntry using the metadata, all of the various writer options,
-- the CSS and HTML helpers, the document and toc title as well as the epub version and all of the sections
- navEntry <- createNavEntry meta metadata opts' vars cssvars writeHtml tocTitle version secs navPointNode
+ navEntry <- createNavEntry meta metadata opts' True vars cssvars writeHtml tocTitle version secs navPointNode
-- mimetype
mimetypeEntry <- mkEntry "mimetype" $
@@ -973,6 +973,7 @@ createNavEntry :: PandocMonad m =>
Meta
-> EPUBMetadata
-> WriterOptions
+ -> Bool
-> Context Text
-> (Bool -> Context Text)
-> (WriterOptions -> Pandoc -> m B8.ByteString)
@@ -981,7 +982,8 @@ createNavEntry :: PandocMonad m =>
-> [Block]
-> ((Int -> [Inline] -> T.Text -> [Element] -> Element) -> Block -> StateT Int m [Element])
-> StateT EPUBState m Entry
-createNavEntry meta metadata opts vars cssvars writeHtml tocTitle version secs navPointNode = do
+createNavEntry meta metadata opts includeTitlePage
+ vars cssvars writeHtml tocTitle version secs navPointNode = do
let navXhtmlFormatter :: Int -> [Inline] -> T.Text -> [Element] -> Element
navXhtmlFormatter n tit src subs = unode "li" !
[("id", "toc-li-" <> tshow n)] $
@@ -1015,11 +1017,12 @@ createNavEntry meta metadata opts vars cssvars writeHtml tocTitle version secs n
[ unode "h1" ! [("id","toc-title")] $ tocTitle
, unode "ol" ! [("class","toc")] $ tocBlocks ]]
let landmarkItems = if version == EPUB3
- then unode "li"
+ then [ unode "li"
[ unode "a" ! [("href",
"text/title_page.xhtml")
,("epub:type", "titlepage")] $
- ("Title Page" :: Text) ] :
+ ("Title Page" :: Text) ] |
+ includeTitlePage ] ++
[ unode "li"
[ unode "a" ! [("href", "text/cover.xhtml")
,("epub:type", "cover")] $