aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-10-17 09:47:31 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-10-17 09:54:59 -0400
commite666c92bc91a51d49008435dc8555118619037d6 (patch)
tree1858764e8facb03db2fec5371fdc120a146fce17
parentf8603e6df5093fb98ccd6fe038686c096b248509 (diff)
downloadpandoc-e666c92bc91a51d49008435dc8555118619037d6.tar.gz
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
-rw-r--r--src/Text/Pandoc/Readers/RST.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 64e564278..1b06c6f23 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -949,7 +949,8 @@ table = gridTable False <|> simpleTable False <|>
--
inline :: RSTParser Inlines
-inline = choice [ whitespace
+inline = choice [ note -- can start with whitespace, so try before ws
+ , whitespace
, link
, str
, endline
@@ -958,7 +959,6 @@ inline = choice [ whitespace
, code
, subst
, interpretedRole
- , note
, smart
, hyphens
, escapedChar
@@ -1174,6 +1174,7 @@ subst = try $ do
note :: RSTParser Inlines
note = try $ do
+ optional whitespace
ref <- noteMarker
char '_'
state <- getState