parent
6437695574
commit
8fcf66453c
4 changed files with 17 additions and 9 deletions
|
@ -138,6 +138,7 @@ Extra-Source-Files:
|
||||||
test/*.native
|
test/*.native
|
||||||
test/command/*.md
|
test/command/*.md
|
||||||
test/command/3533-rst-csv-tables.csv
|
test/command/3533-rst-csv-tables.csv
|
||||||
|
test/command/3880.txt
|
||||||
test/command/abbrevs
|
test/command/abbrevs
|
||||||
test/command/SVG_logo-without-xml-declaration.svg
|
test/command/SVG_logo-without-xml-declaration.svg
|
||||||
test/command/SVG_logo.svg
|
test/command/SVG_logo.svg
|
||||||
|
|
|
@ -219,7 +219,6 @@ block = choice [ codeBlock
|
||||||
, directive
|
, directive
|
||||||
, anchor
|
, anchor
|
||||||
, comment
|
, comment
|
||||||
, include
|
|
||||||
, header
|
, header
|
||||||
, hrule
|
, hrule
|
||||||
, lineBlock -- must go before definitionList
|
, lineBlock -- must go before definitionList
|
||||||
|
@ -460,16 +459,16 @@ tab-width
|
||||||
encoding
|
encoding
|
||||||
-}
|
-}
|
||||||
|
|
||||||
include :: PandocMonad m => RSTParser m Blocks
|
includeDirective :: PandocMonad m
|
||||||
include = try $ do
|
=> String -> [(String, String)] -> String
|
||||||
string ".. include::"
|
-> RSTParser m Blocks
|
||||||
skipMany spaceChar
|
includeDirective top fields body = do
|
||||||
f <- trim <$> anyLine
|
let f = trim top
|
||||||
fields <- many $ rawFieldListItem 3
|
guard $ not (null f)
|
||||||
|
guard $ null (trim body)
|
||||||
-- options
|
-- options
|
||||||
let (startLine :: Maybe Int) = lookup "start-line" fields >>= safeRead
|
let (startLine :: Maybe Int) = lookup "start-line" fields >>= safeRead
|
||||||
let (endLine :: Maybe Int) = lookup "end-line" fields >>= safeRead
|
let (endLine :: Maybe Int) = lookup "end-line" fields >>= safeRead
|
||||||
guard $ not (null f)
|
|
||||||
oldPos <- getPosition
|
oldPos <- getPosition
|
||||||
oldInput <- getInput
|
oldInput <- getInput
|
||||||
containers <- stateContainers <$> getState
|
containers <- stateContainers <$> getState
|
||||||
|
@ -501,7 +500,7 @@ include = try $ do
|
||||||
Just patt -> drop 1 .
|
Just patt -> drop 1 .
|
||||||
dropWhile (not . (patt `isInfixOf`))
|
dropWhile (not . (patt `isInfixOf`))
|
||||||
Nothing -> id) $ contentLines'
|
Nothing -> id) $ contentLines'
|
||||||
let contents' = unlines contentLines''
|
let contents' = unlines contentLines'' ++ "\n"
|
||||||
case lookup "code" fields of
|
case lookup "code" fields of
|
||||||
Just lang -> do
|
Just lang -> do
|
||||||
let numberLines = lookup "number-lines" fields
|
let numberLines = lookup "number-lines" fields
|
||||||
|
@ -687,6 +686,7 @@ directive' = do
|
||||||
$ lookup "height" fields >>=
|
$ lookup "height" fields >>=
|
||||||
(lengthToDim . filter (not . isSpace))
|
(lengthToDim . filter (not . isSpace))
|
||||||
case label of
|
case label of
|
||||||
|
"include" -> includeDirective top fields body'
|
||||||
"table" -> tableDirective top fields body'
|
"table" -> tableDirective top fields body'
|
||||||
"list-table" -> listTableDirective top fields body'
|
"list-table" -> listTableDirective top fields body'
|
||||||
"csv-table" -> csvTableDirective top fields body'
|
"csv-table" -> csvTableDirective top fields body'
|
||||||
|
|
6
test/command/3880.md
Normal file
6
test/command/3880.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
```
|
||||||
|
pandoc -f rst -t native
|
||||||
|
.. include:: command/3880.txt
|
||||||
|
^D
|
||||||
|
[Para [Str "hi"]]
|
||||||
|
```
|
1
test/command/3880.txt
Normal file
1
test/command/3880.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
hi
|
Loading…
Reference in a new issue