@@ -26,7 +26,7 @@ import Text.HTML.TagSoup.Entity (lookupEntity)
2626import Text.Pandoc.Builder
2727import Text.Pandoc.Class.PandocMonad (PandocMonad)
2828import Text.Pandoc.Options
29−import Text.Pandoc.Shared (crFilter, safeRead)
29+import Text.Pandoc.Shared (crFilter, safeRead, extractSpaces)
3030import Text.TeXMath (readMathML, writeTeX)
3131import Text.XML.Light
3232import qualified Data.Set as S (fromList, member)
@@ -460,14 +460,14 @@ parseInline (CRef ref) =
460460 return . text . maybe (T.toUpper $ T.pack ref) T.pack $ lookupEntity ref
461461parseInline (Elem e) =
462462 case qName (elName e) of
463− "italic" -> emph <$> innerInlines
464− "bold" -> strong <$> innerInlines
465− "strike" -> strikeout <$> innerInlines
466− "sub" -> subscript <$> innerInlines
467− "sup" -> superscript <$> innerInlines
468− "underline" -> underline <$> innerInlines
463+ "italic" -> innerInlines emph
464+ "bold" -> innerInlines strong
465+ "strike" -> innerInlines strikeout
466+ "sub" -> innerInlines subscript
467+ "sup" -> innerInlines superscript
468+ "underline" -> innerInlines underline
469469 "break" -> return linebreak
470− "sc" -> smallcaps <$> innerInlines
470+ "sc" -> innerInlines smallcaps
471471
472472 "code" -> codeWithLang
473473 "monospace" -> codeWithLang
@@ -477,14 +477,14 @@ parseInline (Elem e) =
477477 qt <- gets jatsQuoteType
478478 let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
479479 modify $ \st -> st{ jatsQuoteType = qt' }
480− contents <- innerInlines
480+ contents <- innerInlines id
481481 modify $ \st -> st{ jatsQuoteType = qt }
482482 return $ if qt == SingleQuote
483483 then singleQuoted contents
484484 else doubleQuoted contents
485485
486486 "xref" -> do
487− ils <- innerInlines
487+ ils <- innerInlines id
488488 let rid = attrValue "rid" e
489489 let rids = T.words rid
490490 let refType = ("ref-type",) <$> maybeAttrValue "ref-type" e
@@ -501,7 +501,7 @@ parseInline (Elem e) =
501501 ils
502502 else linkWith attr ("#" <> rid) "" ils
503503 "ext-link" -> do
504− ils <- innerInlines
504+ ils <- innerInlines id
505505 let title = fromMaybe "" $ findAttrText (QName "title" (Just "http://www.w3.org/1999/xlink") Nothing) e
506506 let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
507507 Just h -> T.pack h
@@ -520,8 +520,8 @@ parseInline (Elem e) =
520520 "uri" -> return $ link (textContent e) "" $ str $ textContent e
521521 "fn" -> note . mconcat <$>
522522 mapM parseBlock (elContent e)
523− _ -> innerInlines
524− where innerInlines = trimInlines . mconcat <$>
523+ _ -> innerInlines id
524+ where innerInlines f = extractSpaces f . mconcat <$>
525525 mapM parseInline (elContent e)
526526 mathML x =
527527 case readMathML . T.pack . showElement $ everywhere (mkT removePrefix) x of