@@ -26,7 +26,7 @@ import Text.Pandoc.Builder
26import Text.Pandoc.Class.PandocMonad (PandocMonad, report)
26import Text.Pandoc.Class.PandocMonad (PandocMonad, report)
27import Text.Pandoc.Options
27import Text.Pandoc.Options
28import Text.Pandoc.Logging (LogMessage(..))
28import Text.Pandoc.Logging (LogMessage(..))
29−import Text.Pandoc.Shared (crFilter, safeRead)
29+import Text.Pandoc.Shared (crFilter, safeRead, extractSpaces)
30import Text.TeXMath (readMathML, writeTeX)
30import Text.TeXMath (readMathML, writeTeX)
31import Text.XML.Light
31import Text.XML.Light
@@ -1065,19 +1065,19 @@ parseInline (Elem e) =
1065 let ident = attrValue "id" e
1065 let ident = attrValue "id" e
1066 let classes = T.words $ attrValue "class" e
1066 let classes = T.words $ attrValue "class" e
1067 if ident /= "" || classes /= []
1067 if ident /= "" || classes /= []
1068− then spanWith (ident,classes,[]) <$> innerInlines
1068+ then innerInlines (spanWith (ident,classes,[]))
1069− else innerInlines
1069+ else innerInlines id
1070 "equation" -> equation e displayMath
1070 "equation" -> equation e displayMath
1071 "informalequation" -> equation e displayMath
1071 "informalequation" -> equation e displayMath
1072 "inlineequation" -> equation e math
1072 "inlineequation" -> equation e math
1073− "subscript" -> subscript <$> innerInlines
1073+ "subscript" -> innerInlines subscript
1074− "superscript" -> superscript <$> innerInlines
1074+ "superscript" -> innerInlines superscript
1075 "inlinemediaobject" -> getMediaobject e
1075 "inlinemediaobject" -> getMediaobject e
1076 "quote" -> do
1076 "quote" -> do
1077 qt <- gets dbQuoteType
1077 qt <- gets dbQuoteType
1078 let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
1078 let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
1079 modify $ \st -> st{ dbQuoteType = qt' }
1079 modify $ \st -> st{ dbQuoteType = qt' }
1080− contents <- innerInlines
1080+ contents <- innerInlines id
1081 modify $ \st -> st{ dbQuoteType = qt }
1081 modify $ \st -> st{ dbQuoteType = qt }
1082 return $ if qt == SingleQuote
1082 return $ if qt == SingleQuote
1083 then singleQuoted contents
1083 then singleQuoted contents
@@ -1098,7 +1098,7 @@ parseInline (Elem e) =
1098 "replaceable" -> do x <- getInlines e
1098 "replaceable" -> do x <- getInlines e
1099 return $ str "<" <> x <> str ">"
1099 return $ str "<" <> x <> str ">"
1100 "markup" -> codeWithLang
1100 "markup" -> codeWithLang
1101− "wordasword" -> emph <$> innerInlines
1101+ "wordasword" -> innerInlines emph
1102 "command" -> codeWithLang
1102 "command" -> codeWithLang
1103 "varname" -> codeWithLang
1103 "varname" -> codeWithLang
1104 "function" -> codeWithLang
1104 "function" -> codeWithLang
@@ -1126,21 +1126,21 @@ parseInline (Elem e) =
1126 "email" -> return $ link ("mailto:" <> T.pack (strContent e)) ""
1126 "email" -> return $ link ("mailto:" <> T.pack (strContent e)) ""
1127 $ str $ T.pack $ strContent e
1127 $ str $ T.pack $ strContent e
1128 "uri" -> return $ link (T.pack $ strContent e) "" $ str $ T.pack $ strContent e
1128 "uri" -> return $ link (T.pack $ strContent e) "" $ str $ T.pack $ strContent e
1129− "ulink" -> link (attrValue "url" e) "" <$> innerInlines
1129+ "ulink" -> innerInlines (link (attrValue "url" e) "")
1130 "link" -> do
1130 "link" -> do
1131− ils <- innerInlines
1131+ ils <- innerInlines id
1132 let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
1132 let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
1133 Just h -> T.pack h
1133 Just h -> T.pack h
1134 _ -> "#" <> attrValue "linkend" e
1134 _ -> "#" <> attrValue "linkend" e
1135 let ils' = if ils == mempty then str href else ils
1135 let ils' = if ils == mempty then str href else ils
1136 let attr = (attrValue "id" e, T.words $ attrValue "role" e, [])
1136 let attr = (attrValue "id" e, T.words $ attrValue "role" e, [])
1137 return $ linkWith attr href "" ils'
1137 return $ linkWith attr href "" ils'
1138− "foreignphrase" -> emph <$> innerInlines
1138+ "foreignphrase" -> innerInlines emph
1139 "emphasis" -> case attrValue "role" e of
1139 "emphasis" -> case attrValue "role" e of
1140− "bold" -> strong <$> innerInlines
1140+ "bold" -> innerInlines strong
1141− "strong" -> strong <$> innerInlines
1141+ "strong" -> innerInlines strong
1142− "strikethrough" -> strikeout <$> innerInlines
1142+ "strikethrough" -> innerInlines strikeout
1143− _ -> emph <$> innerInlines
1143+ _ -> innerInlines emph
1144 "footnote" -> note . mconcat <$>
1144 "footnote" -> note . mconcat <$>
1145 mapM parseBlock (elContent e)
1145 mapM parseBlock (elContent e)
1146 "title" -> return mempty
1146 "title" -> return mempty
@@ -1149,12 +1149,12 @@ parseInline (Elem e) =
1149 -- <?asciidor-br?> to in handleInstructions, above. A kludge to
1149 -- <?asciidor-br?> to in handleInstructions, above. A kludge to
1150 -- work around xml-light's inability to parse an instruction.
1150 -- work around xml-light's inability to parse an instruction.
1151 "br" -> return linebreak
1151 "br" -> return linebreak
1152− _ -> skip >> innerInlines
1152+ _ -> skip >> innerInlines id
1153 where skip = do
1153 where skip = do
1154 lift $ report $ IgnoredElement $ T.pack $ qName (elName e)
1154 lift $ report $ IgnoredElement $ T.pack $ qName (elName e)
1155 return mempty
1155 return mempty
1157− innerInlines = trimInlines . mconcat <$>
1157+ innerInlines f = extractSpaces f . mconcat <$>
1158 mapM parseInline (elContent e)
1158 mapM parseInline (elContent e)
1159 codeWithLang = do
1159 codeWithLang = do
1160 let classes' = case attrValue "language" e of
1160 let classes' = case attrValue "language" e of