Merge pull request #1528 from mpickering/epubtitlepage

EPUB Reader: Ignores titlepage attribute
This commit is contained in:
John MacFarlane 2014-08-12 16:56:38 -07:00
commit 7684b24959
5 changed files with 22 additions and 6 deletions

View file

@ -158,8 +158,7 @@ Extra-Source-Files:
tests/lhs-test.html+lhs,
tests/lhs-test.fragment.html+lhs,
tests/pipe-tables.txt,
tests/epub.formatting.epub,
tests/epub.features.epub,
tests/*.epub
tests/fb2.basic.markdown,
tests/fb2.basic.fb2,
tests/fb2.titles.markdown,

View file

@ -131,6 +131,7 @@ block = do
, eSwitch B.para block
, mempty <$ eFootnote
, mempty <$ eTOC
, mempty <$ eTitlePage
, pPara
, pHeader
, pBlockQuote
@ -334,9 +335,13 @@ headerLevel tagtype = do
<|>
return level
eTitlePage :: TagParser ()
eTitlePage = try $ do
let isTitlePage as = maybe False (isInfixOf "titlepage") (lookup "type" as)
let groupTag = tagOpen (\x -> x `elem` groupingContent || x == "section")
isTitlePage
TagOpen tag _ <- lookAhead $ pSatisfy groupTag
() <$ pInTags tag block
pHeader :: TagParser Blocks
pHeader = try $ do
@ -922,13 +927,14 @@ instance HasLastStrPosition HTMLState where
sectioningContent :: [String]
sectioningContent = ["article", "aside", "nav", "section"]
{-
groupingContent :: [String]
groupingContent = ["p", "hr", "pre", "blockquote", "ol"
, "ul", "li", "dl", "dt", "dt", "dd"
, "figure", "figcaption", "div", "main"]
{-
types :: [(String, ([String], Int))]
types = -- Document divisions

View file

@ -148,6 +148,8 @@ tests = [ testGroup "markdown"
, testGroup "epub" [
test "features" ["-r", "epub", "-w", "native"]
"epub.features.epub" "epub.features.native"
, test "wasteland" ["-r", "epub", "-w", "native"]
"epub.wasteland.epub" "epub.wasteland.native"
, test "formatting" ["-r", "epub", "-w", "native"]
"epub.formatting.epub" "epub.formatting.native"
]

BIN
tests/epub.wasteland.epub Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long