mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
RST reader: treat undefined substitution references as plain text.
This mirrors rst2html behavior. Closes #11727.
This commit is contained in:
@@ -170,7 +170,7 @@ parseRST = do
|
||||
return doc
|
||||
|
||||
resolveBlockSubstitutions :: PandocMonad m => Block -> RSTParser m Block
|
||||
resolveBlockSubstitutions x@(Para [Link _attr _ (s,_)])
|
||||
resolveBlockSubstitutions (Para [Link _attr ils (s,_)])
|
||||
| Just ref <- T.stripPrefix "##SUBST##" s = do
|
||||
substTable <- stateSubstitutions <$> getState
|
||||
let key@(Key key') = toKey $ stripFirstAndLast ref
|
||||
@@ -178,7 +178,7 @@ resolveBlockSubstitutions x@(Para [Link _attr _ (s,_)])
|
||||
Nothing -> do
|
||||
pos <- getPosition
|
||||
logMessage $ ReferenceNotFound (tshow key') pos
|
||||
return x
|
||||
return $ Para ils
|
||||
Just target -> case
|
||||
B.toList target of
|
||||
[bl] -> return bl
|
||||
@@ -233,7 +233,7 @@ resolveReferences x@(Link _ ils (s,_))
|
||||
Nothing -> do
|
||||
pos <- getPosition
|
||||
logMessage $ ReferenceNotFound (tshow key') pos
|
||||
return x
|
||||
return $ Span ("",[],[]) ils
|
||||
Just target -> case
|
||||
B.toList target of
|
||||
[Para [t]] -> return t
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
```
|
||||
% pandoc -f rst -t markdown
|
||||
[file|URL|PLAYLIST]
|
||||
|
||||
^D
|
||||
2> [WARNING] Reference not found for '"url"' at line 4 column 1
|
||||
\[file\|URL\|PLAYLIST\]
|
||||
```
|
||||
Reference in New Issue
Block a user