RST reader: Fix :literal:
includes.
These should create code blocks, not insert raw RST. Closes #7513.
This commit is contained in:
parent
9879953a4f
commit
07d847a910
2 changed files with 3 additions and 6 deletions
|
@ -466,14 +466,11 @@ includeDirective top fields body = do
|
|||
let classes = maybe [] T.words (lookup "class" fields)
|
||||
let ident = maybe "" trimr $ lookup "name" fields
|
||||
let parser =
|
||||
case lookup "code" fields of
|
||||
case lookup "code" fields `mplus` lookup "literal" fields of
|
||||
Just lang ->
|
||||
(codeblock ident classes fields (trimr lang) False
|
||||
. sourcesToText) <$> getInput
|
||||
Nothing ->
|
||||
case lookup "literal" fields of
|
||||
Just _ -> B.rawBlock "rst" . sourcesToText <$> getInput
|
||||
Nothing -> parseBlocks
|
||||
Nothing -> parseBlocks
|
||||
let isLiteral = isJust (lookup "code" fields `mplus` lookup "literal" fields)
|
||||
let selectLines =
|
||||
(case trim <$> lookup "end-before" fields of
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
.. include:: command/three.txt
|
||||
^D
|
||||
[CodeBlock ("",[""],[("code","")]) "1st line.\n2nd line.\n3rd line.\n"
|
||||
,RawBlock (Format "rst") "1st line.\n2nd line.\n3rd line.\n"
|
||||
,CodeBlock ("",[""],[("literal","")]) "1st line.\n2nd line.\n3rd line.\n"
|
||||
,Para [Str "1st",Space,Str "line.",SoftBreak,Str "2nd",Space,Str "line.",SoftBreak,Str "3rd",Space,Str "line."]]
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue