diff options
-rw-r--r-- | doc/lua-filters.md | 8 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 7 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Ms.hs | 10 |
3 files changed, 13 insertions, 12 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index c5f7d2713..cc49da09b 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -138,7 +138,7 @@ elements. ## Filters on element sequences -For some filtering tasks, the it is necessary to know the order +For some filtering tasks, it is necessary to know the order in which elements occur in the document. It is not enough then to inspect a single element at a time. @@ -1127,7 +1127,7 @@ A [table cell]{#type-table-cell} is a list of blocks. *[Alignment]{#type-alignment}* is a string value indicating the horizontal alignment of a table column. `AlignLeft`, -`AlignRight`, and `AlignCenter` leads cell content tob be +`AlignRight`, and `AlignCenter` leads cell content to be left-aligned, right-aligned, and centered, respectively. The default alignment is `AlignDefault` (often equivalent to centered). @@ -3035,7 +3035,7 @@ methods and convenience functions. [`pandoc.List:insert ([pos], value)`]{#pandoc.list:insert} : Inserts element `value` at position `pos` in list, shifting - elements to the next-greater indix if necessary. + elements to the next-greater index if necessary. This function is identical to [`table.insert`](https://www.lua.org/manual/5.3/manual.html#6.6). @@ -3082,7 +3082,7 @@ methods and convenience functions. Parameters: `pos`: - : position of the list value that will be remove; defaults + : position of the list value that will be removed; defaults to the index of the last element Returns: the removed element diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index e558836a1..7c25be486 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -223,7 +223,8 @@ rawFieldListItem minIndent = try $ do first <- anyLine rest <- option "" $ try $ do lookAhead (count indent (char ' ') >> spaceChar) indentedBlock - let raw = (if T.null first then "" else first <> "\n") <> rest <> "\n" + let raw = (if T.null first then "" else first <> "\n") <> rest <> + (if T.null first && T.null rest then "" else "\n") return (name, raw) fieldListItem :: PandocMonad m => Int -> RSTParser m (Inlines, [Blocks]) @@ -484,7 +485,7 @@ includeDirective top fields body = do Just patt -> drop 1 . dropWhile (not . (patt `T.isInfixOf`)) Nothing -> id) $ contentLines' - let contents' = T.unlines contentLines'' <> "\n" + let contents' = T.unlines contentLines'' case lookup "code" fields of Just lang -> do let classes = maybe [] T.words (lookup "class" fields) @@ -494,7 +495,7 @@ includeDirective top fields body = do Just _ -> return $ B.rawBlock "rst" contents' Nothing -> do setPosition $ newPos (T.unpack f) 1 1 - setInput contents' + setInput $ contents' <> "\n" bs <- optional blanklines >> (mconcat <$> many block) setInput oldInput diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs index 81de40045..d38b874d4 100644 --- a/src/Text/Pandoc/Writers/Ms.hs +++ b/src/Text/Pandoc/Writers/Ms.hs @@ -517,11 +517,11 @@ toMacro sty toktype = msFormatter :: WriterOptions -> FormatOptions -> [SourceLine] -> Doc Text msFormatter opts _fmtopts = - vcat . map fmtLine - where fmtLine = hcat . map fmtToken - fmtToken (toktype, tok) = literal "\\*" <> - brackets (literal (tshow toktype) <> literal " \"" - <> literal (escapeStr opts tok) <> literal "\"") + literal . T.intercalate "\n" . map fmtLine + where + fmtLine = mconcat . map fmtToken + fmtToken (toktype, tok) = + "\\*[" <> (tshow toktype) <> " \"" <> (escapeStr opts tok) <> "\"]" highlightCode :: PandocMonad m => WriterOptions -> Attr -> Text -> MS m (Doc Text) highlightCode opts attr str = |