Skip to content

Commit 3703757

Browse files
committed
Attempt at solving parsing for emphasis elements (see #10665 (comment))
1 parent a232161 commit 3703757

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Text/Pandoc/Readers/DocBook.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ instance HasMeta DBState where
701701
setMeta field v s = s {dbMeta = setMeta field v (dbMeta s)}
702702
deleteMeta field s = s {dbMeta = deleteMeta field (dbMeta s)}
703703

704+
isEmphElement :: Inline -> Bool
705+
isEmphElement (Emph _) = True
706+
isEmphElement _ = False
707+
704708
isBlockElement :: Content -> Bool
705709
isBlockElement (Elem e) = qName (elName e) `Set.member` blockTags
706710
isBlockElement _ = False
@@ -1334,9 +1338,12 @@ parseInline (Elem e) = do
13341338
-- <?asciidor-br?> to in handleInstructions, above.
13351339
"pi-asciidoc-br" -> return linebreak
13361340
_ -> skip >> innerInlines id
1337-
return $ case qName (elName e) of
1338-
"emphasis" -> parsedInline
1339-
_ -> addPandocAttributes (getRoleAttr e) parsedInline
1341+
return $ if qName (elName e) == "emphasis" then do
1342+
let inlineElement = e :: Inline
1343+
if not (isEmphElement inlineElement)
1344+
then addPandocAttributes (getRoleAttr e) parsedInline
1345+
else parsedInline
1346+
else parsedInline
13401347
where skip = do
13411348
let qn = qName $ elName e
13421349
let name = if "pi-" `T.isPrefixOf` qn

0 commit comments

Comments
 (0)