git.iko.soy/typeable/pandoc
on master help sign in
Really fix #3989.

The previous fix only worked in certain cases. Other cases with `>` in an HTML attribute broke.

commited3d46638425825de30aaa3d1152b9343292c315 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 1 Nov 2017, 09:27 (9 years ago) parentf1ebdb8
2 files changed+13−6
src/Text/Pandoc/Readers/HTML.hs+12−5 test/command/3989.md+1−1
src/Text/Pandoc/Readers/HTML.hs+12−5
@@ -1133,6 +1133,7 @@ htmlTag :: (HasReaderOptions st, Monad m)
11331133 -> ParserT [Char] st m (Tag String, String)
11341134htmlTag f = try $ do
11351135 lookAhead (char '<')
1136+ startpos <- getPosition
11361137 inp <- getInput
11371138 let ts = canonicalizeTags $ parseTagsOptions
11381139 parseOptions{ optTagWarning = False
@@ -1153,11 +1154,17 @@ htmlTag f = try $ do
11531154 [] -> False
11541155 (c:cs) -> isLetter c && all isNameChar cs
11551156
1156− let endAngle = try $ do char '>'
1157− pos <- getPosition
1158− guard $ (sourceLine pos == ln &&
1159− sourceColumn pos >= col) ||
1160− sourceLine pos > ln
1157+ let endpos = if ln == 1
1158+ then setSourceColumn startpos
1159+ (sourceColumn startpos + (col - 1))
1160+ else setSourceColumn (setSourceLine startpos
1161+ (sourceLine startpos + (ln - 1)))
1162+ col
1163+ let endAngle = try $
1164+ do char '>'
1165+ pos <- getPosition
1166+ guard $ pos >= endpos
1167+
11611168 let handleTag tagname = do
11621169 -- basic sanity check, since the parser is very forgiving
11631170 -- and finds tags in stuff like x<y)
test/command/3989.md+1−1
@@ -1,7 +1,7 @@
11```
22pandoc -f markdown -t native
33<span title="1st line of text <br> 2nd line of text">foo</span>
4−<span title="1st line of text <br> 2nd line of text">foo</span>
4+ <span title="1st line of text <br> 2nd line of text">foo</span>
55^D
66[Para [Span ("",[],[("title","1st line of text <br> 2nd line of text")]) [Str "foo"],SoftBreak,Span ("",[],[("title","1st line of text <br> 2nd line of text")]) [Str "foo"]]]
77```