aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog50
-rw-r--r--data/translations/ru.yaml18
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs62
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs6
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs6
-rw-r--r--test/Tests/Readers/Muse.hs12
6 files changed, 109 insertions, 45 deletions
diff --git a/changelog b/changelog
index 1c3498945..e4574137f 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,53 @@
+pandoc (X.Y.Z)
+
+ * RST reader:
+
+ + Parse RST inlines containing newlines (#4912, Francesco Occhipinti).
+ This eliminates a regression introduced after pandoc 2.1.1, which
+ caused inline constructions containing newlines not to be recognized.
+ + Fix bug with internal link targets (#4919). They were gobbling up
+ indented content underneath.
+
+ * Markdown reader: distinguish autolinks in the AST. With this change,
+ autolinks are parsed as Links with the `uri` class. (The same is true
+ for bare links, if the `autolink_bare_uris` extension is enabled.)
+ Email autolinks are parsed as Links with the `email` class. This
+ allows the distinction to be represented in the AST.
+
+ * Muse reader (Alexander Krotov):
+
+ + Added additional tests.
+ + Simplify tag parsers.
+ + Do not allow code markup to be followed by digit.
+ + Simplify ordered list parsing.
+ + Remove heading level limit.
+ + Simplify `<literal>` tag parsers
+ + Cleanup and convert to applicative style.
+ + Simplify `lchop`.
+ + Parse Text instead of String. Benchmark shows 7% improvement.
+ + Get rid of HTML parser dependency.
+
+ * ConTeXt writer: change `\` to `/` in Windows image paths (#4918).
+ We do this in the LaTeX writer, and it avoids problems.
+ Note that `/` works as a LaTeX path separator on Windows.
+
+ * HTML writer: don't add `uri` class to presumed autolinks.
+ Formerly the `uri` class was added to autolinks by
+ the HTML writer, but it had to guess what was an autolink
+ and could not distinguish `[http://example.com](http://example.com)`
+ from `<http://example.com>`. It also incorrectly recognized
+ `[pandoc](pandoc)` as an autolink. Now the HTML writer
+ simply passes through the `uri` attribute if it is present,
+ but does not add anything.
+
+ * Textile writer: don't represent `uri` class explicitly
+ for autolinks (#4913).
+
+ * Lua filters (Albert Krewinkel):
+
+ + Cleanup filter execution code.
+ + Better error on test failure.
+
pandoc (2.3)
* Add `--metadata-file` option (Mauro Bieg, #1960), which allows
diff --git a/data/translations/ru.yaml b/data/translations/ru.yaml
index 6012c3e19..0bcbea62b 100644
--- a/data/translations/ru.yaml
+++ b/data/translations/ru.yaml
@@ -1,20 +1,20 @@
-Abstract: Аннотація
-Appendix: Приложеніе
+Abstract: Аннотация
+Appendix: Приложение
Author: Именной указатель
-Bibliography: Библіографія
+Bibliography: Литература
Cc: исх.
Chapter: Глава
-Contents: Оглавленіе
+Contents: Оглавление
Encl: вкл.
Figure: Рис.
-Index: Предмѣтный указатель
-ListOfFigures: Списокъ иллюстрацій
-ListOfTables: Списокъ таблицъ
+Index: Предметный указатель
+ListOfFigures: Список иллюстраций
+ListOfTables: Список таблиц
Page: с.
Part: Часть
-Preface: Предисловіе
+Preface: Предисловие
Proof: Доказательство
-References: Примѣчанія
+References: Список литературы
See: см.
SeeAlso: см. также
Table: Таблица
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index e8e309115..6475669ce 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -225,7 +225,7 @@ parseEmacsDirective :: PandocMonad m => MuseParser m (String, F Inlines)
parseEmacsDirective = (,)
<$> parseDirectiveKey
<* spaceChar
- <*> (trimInlinesF . mconcat <$> manyTill (choice inlineList) eol)
+ <*> (trimInlinesF . mconcat <$> manyTill inline' eol)
parseAmuseDirective :: PandocMonad m => MuseParser m (String, F Inlines)
parseAmuseDirective = (,)
@@ -455,7 +455,7 @@ playTag = do
verseLine :: PandocMonad m => MuseParser m (F Inlines)
verseLine = do
indent <- (B.str <$> many1 ('\160' <$ char ' ')) <|> pure mempty
- rest <- manyTill (choice inlineList) newline
+ rest <- manyTill inline' newline
return $ trimInlinesF $ mconcat (pure indent : rest)
-- | Parse @\<verse>@ tag.
@@ -546,7 +546,7 @@ lineVerseLine = try $ do
string "> "
indent <- many ('\160' <$ char ' ')
let indentEl = if null indent then mempty else B.str indent
- rest <- manyTill (choice inlineList) eol
+ rest <- manyTill inline' eol
return $ trimInlinesF $ mconcat (pure indentEl : rest)
blanklineVerseLine :: PandocMonad m => MuseParser m (F Inlines)
@@ -648,7 +648,7 @@ definitionListItemsUntil indent end =
where
continuation = try $ do
pos <- getPosition
- term <- trimInlinesF . mconcat <$> manyTill (choice inlineList) (try $ string "::")
+ term <- trimInlinesF . mconcat <$> manyTill inline' (try $ string "::")
(x, (xs, e)) <- descriptionsUntil (sourceColumn pos) (try (optional blankline *> indentWith indent *> continuation) <|> (([],) <$> end))
let xx = (,) <$> term <*> sequence x
return (xx:xs, e)
@@ -753,33 +753,33 @@ tableParseCaption = try $ fmap MuseCaption . trimInlinesF . mconcat
-- ** Inline parsers
-inlineList :: PandocMonad m => [MuseParser m (F Inlines)]
-inlineList = [ whitespace
- , br
- , anchor
- , footnote
- , strong
- , strongTag
- , emph
- , emphTag
- , underlined
- , superscriptTag
- , subscriptTag
- , strikeoutTag
- , verbatimTag
- , classTag
- , nbsp
- , linkOrImage
- , code
- , codeTag
- , mathTag
- , inlineLiteralTag
- , str
- , symbol
- ]
+inline' :: PandocMonad m => MuseParser m (F Inlines)
+inline' = whitespace
+ <|> br
+ <|> anchor
+ <|> footnote
+ <|> strong
+ <|> strongTag
+ <|> emph
+ <|> emphTag
+ <|> underlined
+ <|> superscriptTag
+ <|> subscriptTag
+ <|> strikeoutTag
+ <|> verbatimTag
+ <|> classTag
+ <|> nbsp
+ <|> linkOrImage
+ <|> code
+ <|> codeTag
+ <|> mathTag
+ <|> inlineLiteralTag
+ <|> str
+ <|> symbol
+ <?> "inline"
inline :: PandocMonad m => MuseParser m (F Inlines)
-inline = endline <|> choice inlineList <?> "inline"
+inline = endline <|> inline'
-- | Parse a soft break.
endline :: PandocMonad m => MuseParser m (F Inlines)
@@ -963,7 +963,7 @@ image :: PandocMonad m => MuseParser m (F Inlines)
image = try $ do
string "[["
(url, (ext, width, align)) <- manyUntil (noneOf "]") (imageExtensionAndOptions <* char ']')
- content <- optionMaybe linkContent
+ content <- option mempty linkContent
char ']'
let widthAttr = case align of
Just 'f' -> [("width", fromMaybe "100" width ++ "%"), ("height", "75%")]
@@ -973,7 +973,7 @@ image = try $ do
Just 'l' -> ["align-left"]
Just 'f' -> []
_ -> []
- return $ B.imageWith ("", alignClass, widthAttr) (url ++ ext) mempty <$> fromMaybe (return mempty) content
+ return $ B.imageWith ("", alignClass, widthAttr) (url ++ ext) mempty <$> content
where -- Taken from muse-image-regexp defined in Emacs Muse file lisp/muse-regexps.el
imageExtensions = [".eps", ".gif", ".jpg", ".jpeg", ".pbm", ".png", ".tiff", ".xbm", ".xpm"]
imageExtension = choice (try . string <$> imageExtensions)
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 3db643503..6042f2765 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -176,9 +176,9 @@ pandocToLaTeX options (Pandoc meta blocks) = do
modify $ \s -> s{stCsquotes = True}
let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
(blocks', [])
- else case last blocks' of
- Header 1 _ il -> (init blocks', il)
- _ -> (blocks', [])
+ else case reverse blocks' of
+ Header 1 _ il : _ -> (init blocks', il)
+ _ -> (blocks', [])
beamer <- gets stBeamer
blocks''' <- if beamer
then toSlides blocks''
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 3045c1c10..ed8dc9ae4 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -341,8 +341,10 @@ listItemToRTF :: PandocMonad m
listItemToRTF alignment indent marker [] = return $
rtfCompact (indent + listIncrement) (negate listIncrement) alignment
(marker ++ "\\tx" ++ show listIncrement ++ "\\tab ")
-listItemToRTF alignment indent marker list = do
- (first:rest) <- mapM (blockToRTF (indent + listIncrement) alignment) list
+listItemToRTF alignment indent marker (listFirst:listRest) = do
+ let f = blockToRTF (indent + listIncrement) alignment
+ first <- f listFirst
+ rest <- mapM f listRest
let listMarker = "\\fi" ++ show (negate listIncrement) ++ " " ++ marker ++
"\\tx" ++ show listIncrement ++ "\\tab"
let insertListMarker ('\\':'f':'i':'-':d:xs) | isDigit d =
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 80540b697..02b68eb8e 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -762,6 +762,13 @@ tests =
, " > Baz"
] =?>
para ("Foo" <> note (para "Bar" <> lineBlock ["Baz"]))
+ , "Footnote ending in self-terminating element and followed by paragraph" =:
+ T.unlines [ "Foo[1]"
+ , ""
+ , "[1] > bar"
+ , "baz"
+ ] =?>
+ para (str "Foo" <> note (lineBlock ["bar"])) <> para (str "baz")
, test emacsMuse "Emacs multiparagraph footnotes"
(T.unlines
[ "First footnote reference[1] and second footnote reference[2]."
@@ -1170,6 +1177,11 @@ tests =
] =?>
bulletList [ lineBlock [ "foo" ] ] <> bulletList [ para "bar" ]
]
+ , "List ending in self-terminating element and followed by paragraph" =:
+ T.unlines [ " - > Foo"
+ , "bar"
+ ] =?>
+ bulletList [lineBlock ["Foo"]] <> para (str "bar")
-- Test that definition list requires a leading space.
-- Emacs Muse does not require a space, we follow Amusewiki here.
, "Not a definition list" =: