git.iko.soy/typeable/pandoc
on master help sign in
RST reader: skip whitespace before note.

RST requires a space before a footnote marker. We discard those spaces so that footnotes will be adjacent to the text that comes before it. This is in line with what rst2latex does. rst2html does not discard the space, but its html output is different than pandoc's, so this seems the most semantically correct approach. Closes #3163

commite666c92bc91a51d49008435dc8555118619037d6 authorJesse Rosenthal <jrosenthal@jhu.edu> dateMon 17 Oct 2016, 09:47 (10 years ago) parentf8603e6
1 file changed+3−2
src/Text/Pandoc/Readers/RST.hs+3−2
src/Text/Pandoc/Readers/RST.hs+3−2
@@ -949,7 +949,8 @@ table = gridTable False <|> simpleTable False <|>
949949--
950950
951951inline :: RSTParser Inlines
952−inline = choice [ whitespace
952+inline = choice [ note -- can start with whitespace, so try before ws
953+ , whitespace
953954 , link
954955 , str
955956 , endline
@@ -958,7 +959,6 @@ inline = choice [ whitespace
958959 , code
959960 , subst
960961 , interpretedRole
961− , note
962962 , smart
963963 , hyphens
964964 , escapedChar
@@ -1174,6 +1174,7 @@ subst = try $ do
11741174
11751175note :: RSTParser Inlines
11761176note = try $ do
1177+ optional whitespace
11771178 ref <- noteMarker
11781179 char '_'
11791180 state <- getState