packages feed

pandoc 3.0 → 3.0.1

raw patch · 20 files changed

+141/−111 lines, 20 filesdep ~texmathPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: texmath

API changes (from Hackage documentation)

+ Text.Pandoc.Writers.Shared: setupTranslations :: PandocMonad m => Meta -> m ()

Files

AUTHORS.md view
@@ -52,6 +52,7 @@ - Caleb McDaniel - Caleb Mclennan - Calvin Beck+- Carlos Scheidegger - Carlos Sosa - Carsten Allefeld - Castedo Ellerman@@ -152,6 +153,7 @@ - Jake Zimmerman - Jakob Voß - James Aspnes+- James Scott-Brown - Jamie F. Olson - Jan Larres - Jan Schulz
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: January 17, 2023+date: January 25, 2023 ---  # Synopsis
− cabal.project
@@ -1,8 +0,0 @@-packages: .-          pandoc-lua-engine-          pandoc-server-          pandoc-cli-tests: True-flags: +embed_data_files-constraints: skylighting-format-blaze-html >= 0.1.1,-             skylighting-format-context >= 0.1.0.1
changelog.md view
@@ -1,9 +1,52 @@ # Revision history for pandoc -## pandoc 3.0 (PROVISIONAL YYYY-MM-DD)+## pandoc 3.0.1 (2023-01-25) +  * Fix use of extensions with custom readers (#8571).++  * Text.Pandoc.Writers.Shared: export `setupTranslations` [API change].+    Use this in HTML and OpenDocument writers, to ensure that+    translations are set up properly even when we don't go through+    `convertWithOpts`.++  * LaTeX reader: fix regression in macro resolution for environments (#8573).++  * Chunked HTML writer: Fix handling of images with absolute URLs (#8567).++  * HTML writer:++    + Don't omit newlines in task lists.+    + Don't disable checkboxes in task lists (#8562).++  * Ensure that automatically set variables `pandoc-version`, `outputfile`,+    `title-prefix`, `epub-cover-image`, `curdir`, `dzslides-core` can be+    overridden by `--variable` on the command line. Previously they would+    create lists in the template Context, which is not desirable.++  * Fix man page copying in `linux/make_artifacts.sh` (#8566).+    Previously we were copying the pandoc-server.1 pandoc page to pandoc-lua.1.++  * pandoc.cabal: remove pandoc.cabal, stack.cabal from extra-source-files+    (#8560). The problem is that if these are in extra-source-files, then they+    get put in the tarball, and then anyone trying to build the source+    from an unpacked tarball will run into the problem that cabal.project+    and stack.yaml refer to pandoc-server, pandoc-lua-engine, and+    pandoc-cli, which aren't in the tarball.++  * Require texmath 0.12.6 for better MathML output.++  * Fix typo in Lua filter documentation (Carlos Scheidegger).++  * Fix formatting of link in pandoc-server.md (James Scott-Brown).++  * Minor changelog fixups.++## pandoc 3.0 (2023-01-18)+   * Split pandoc-server, pandoc-cli, and pandoc-lua-engine-   into separate packages (#8309).+    into separate packages (#8309). Note that installing+    the `pandoc` package from Hackage will no longer give you the+    `pandoc` executable; for that you need to install `pandoc-cli`.    * Pandoc now behaves like a Lua interpreter when called as     `pandoc-lua` or when `pandoc lua` is used (#8311, Albert Krewinkel).@@ -46,10 +89,16 @@   * Add new `mark` extension for highlighted text in Markdown,     using `==` delimiters (#7743). -  * pandoc-server:--    + Add simple CORS support to pandoc-server (#8427).-    + Print message to stderr when starting the server.+  * Add new extensions `wikilinks_title_after_pipe` and+    `wikilinks_title_before_pipe` for `commonmark` and `markdown`.+    (#2923, Albert Krewinkel). The former enables links of style+    `[[Name of page|Title]]` and the latter `[[Title|Name of+    page]]`. Titles are optional in both variants, so this works+    for both: `[[https://example.org]]`, `[[Name of page]]`. The+    writer is modified to render links with title `wikilink` as+    a wikilink if a respective extension is enabled. Pandoc will+    use `wikilinks_title_after_pipe` if both extensions are+    enabled.    * Add prefixes to identifiers with `--file-scope` (#6384).     This change only affects the case where `--file-scope` is used@@ -169,6 +218,11 @@     than in the writers.  One effect is the man writer now emits     a comment with the pandoc version. +  * pandoc-server:++    + Add simple CORS support to pandoc-server (#8427).+    + Print message to stderr when starting the server.+   * Docx reader:      + Mark unnumbered headings with class `unnumbered` (#8148,@@ -247,18 +301,6 @@     + Handle empty paragraphs (#8487). Also, if attributes are added       explicitly to a paragraph, put it in a Div with the attributes. -  * Markdown and CommonMark writers and readers:--    + Add support for wiki links (#2923, Albert Krewinkel) via-      the extensions `wikilinks_title_after_pipe` and-      `wikilinks_title_before_pipe`. The former enables links of style-      `[[Name of page|Title]]` and the latter `[[Title|Name of page]]`.-      Titles are optional in both variants, so this works for both:-      `[[https://example.org]]`, `[[Name of page]]`. The writer is modified-      to render links with title `wikilink` as a wikilink if a respective-      extension is enabled. Pandoc will use `wikilinks_title_after_pipe` if-      both extensions are enabled.-   * Markdown reader:      + Allow fenced code block "bare" language to be combined@@ -978,7 +1020,7 @@     `citeproc`, `gridtables`, and `skylighting`.    * Use pandoc-types 1.23.  This adds the `Figure` Block-    consntructor and removes the `Null` Block constructor.+    constructor and removes the `Null` Block constructor.    * Require aeson >= 2.0. @@ -987,7 +1029,7 @@    * Use doctemplates 0.11, avoiding a transitive dependency on HsYAML. -  * Use skylighting 0.13.1.2+  * Use skylighting 0.13.1.2.    * Allow mtl 2.3.1 (Alexander Batischev). 
man/pandoc.1 view
@@ -1,4 +1,4 @@-.\" Automatically generated by Pandoc 2.19.2+.\" Automatically generated by Pandoc 3.0 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font.@@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\}-.TH "Pandoc User\[cq]s Guide" "" "January 17, 2023" "pandoc 3.0" ""+.TH "Pandoc User\[cq]s Guide" "" "January 25, 2023" "pandoc 3.0.1" "" .hy .SH NAME pandoc - general markup converter@@ -2663,7 +2663,7 @@ Text in the main document language (British English).  ::: {lang=fr-CA}-> Cette citation est \['e]crite en fran\[,c]ais canadien.+> Cette citation est écrite en français canadien. :::  More text in English. [\[aq]Zitat auf Deutsch.\[aq]]{lang=de}@@ -3394,7 +3394,7 @@   Heading                       Identifier   ----------------------------- -----------------------------   Heading identifiers in HTML   heading-identifiers-in-html-  Ma\[^i]tre d\[aq]h\[^o]tel                ma\[^i]tre-dh\[^o]tel+  Maître d\[aq]hôtel                maître-dhôtel   *Dogs*?--in *my* house?       dogs--in-my-house   [HTML], [S5], or [RTF]?       html-s5-or-rtf   3. Applications               applications@@ -4760,11 +4760,11 @@ +---------------------+----------+ | Property            | Earth    | +=============+=======+==========+-|             | min   | -89.2 \[de]C |+|             | min   | -89.2 °C | | Temperature +-------+----------+-| 1961-1990   | mean  | 14 \[de]C    |+| 1961-1990   | mean  | 14 °C    | |             +-------+----------+-|             | min   | 56.7 \[de]C  |+|             | min   | 56.7 °C  | +-------------+-------+----------+ \f[R] .fi@@ -6183,8 +6183,8 @@ \f[V]sec.\f[R]/\f[V]secs.\f[R]; \f[V]sub verbo\f[R], \f[V]s.v.\f[R]/\f[V]s.vv.\f[R]; \f[V]verse\f[R], \f[V]v.\f[R]/\f[V]vv.\f[R]; \f[V]volume\f[R],-\f[V]vol.\f[R]/\f[V]vols.\f[R]; \f[V]\[ps]\f[R]/\f[V]\[ps]\[ps]\f[R];-\f[V]\[sc]\f[R]/\f[V]\[sc]\[sc]\f[R].+\f[V]vol.\f[R]/\f[V]vols.\f[R]; \f[V]¶\f[R]/\f[V]¶¶\f[R];+\f[V]§\f[R]/\f[V]§§\f[R]. If no locator term is used, \[lq]page\[rq] is assumed. .PP In complex cases, you can force something to be treated as a locator by@@ -6966,7 +6966,7 @@ (with \f[V]Ch\f[R] sorting after \f[V]C\f[R]). .IP \[bu] 2 \f[V]fr-u-kb\f[R] \[en] French with \[lq]backwards\[rq] accent sorting-(with \f[V]cot\['e]\f[R] sorting after \f[V]c\[^o]te\f[R]).+(with \f[V]coté\f[R] sorting after \f[V]côte\f[R]). .IP \[bu] 2 \f[V]en-US-u-kf-upper\f[R] \[en] English with uppercase letters sorting before lower (default is lower before upper).@@ -7520,7 +7520,7 @@ - scheme: DOI   text: doi:10.234234.234/33 publisher:  My Press-rights: \[co] 2007 John Smith, CC BY-NC+rights: © 2007 John Smith, CC BY-NC ibooks:   version: 1.3.4 \&...
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version:   2.4 name:            pandoc-version:         3.0+version:         3.0.1 build-type:      Simple license:         GPL-2.0-or-later license-file:    COPYING.md@@ -197,9 +197,6 @@                  INSTALL.md, AUTHORS.md, README.md,                  CONTRIBUTING.md, BUGS, changelog.md,                  man/pandoc.1-                 -- cabal and stack build plans-                 cabal.project-                 stack.yaml                  -- files needed to build man page                  man/manfilter.lua                  man/pandoc.1.before@@ -515,7 +512,7 @@                  syb                   >= 0.1      && < 0.8,                  tagsoup               >= 0.14.6   && < 0.15,                  temporary             >= 1.1      && < 1.4,-                 texmath               >= 0.12.5.5 && < 0.12.6,+                 texmath               >= 0.12.6   && < 0.13,                  text                  >= 1.1.1.0  && < 2.1,                  text-conversions      >= 0.3      && < 0.4,                  time                  >= 1.5      && < 1.14,
src/Text/Pandoc/App.hs view
@@ -170,7 +170,7 @@                           -> ByteStringReader $ \o t -> sandbox files (r o t)    (reader, readerExts) <--    if ".lua" `T.isSuffixOf` readerName+    if ".lua" `T.isSuffixOf` readerNameBase        then do             let scriptPath = T.unpack readerNameBase             components <- engineLoadCustom scriptingEngine scriptPath
src/Text/Pandoc/App/CommandLineOptions.hs view
@@ -1062,7 +1062,8 @@        Right () -> return ()        Left e   -> optError e --- | Set text value in text context.+-- | Set text value in text context.  Create list if it has a value already,+-- or add to a list value. setVariable :: Text -> Text -> Context Text -> Context Text setVariable key val (Context ctx) = Context $ M.alter go key ctx   where go Nothing             = Just $ toVal val
src/Text/Pandoc/App/OutputSettings.hs view
@@ -38,7 +38,7 @@ import Text.Pandoc import Text.Pandoc.App.FormatHeuristics (formatFromFilePaths) import Text.Pandoc.App.Opt (Opt (..))-import Text.Pandoc.App.CommandLineOptions (engines, setVariable)+import Text.Pandoc.App.CommandLineOptions (engines) import qualified Text.Pandoc.Format as Format import Text.Pandoc.Highlighting (lookupHighlightingStyle) import Text.Pandoc.Scripting (ScriptingEngine (engineLoadCustom),@@ -163,8 +163,6 @@   hlStyle <- traverse (lookupHighlightingStyle . T.unpack) $                optHighlightStyle opts -  let setVariableM k v = return . setVariable k v-   let setListVariableM _ [] ctx = return ctx       setListVariableM k vs ctx = do         let ctxMap = unContext ctx@@ -262,6 +260,13 @@     , outputWriterOptions = writerOpts     , outputPdfProgram = maybePdfProg     }++-- | Set text value in text context unless it is already set.+setVariableM :: Monad m+             => T.Text -> T.Text -> Context T.Text -> m (Context T.Text)+setVariableM key val (Context ctx) = return $ Context $ M.alter go key ctx+  where go Nothing             = Just $ toVal val+        go (Just x)            = Just x  baseWriterName :: T.Text -> T.Text baseWriterName = T.takeWhile (\c -> c /= '+' && c /= '-')
src/Text/Pandoc/Readers/LaTeX/Macro.hs view
@@ -216,7 +216,7 @@     let result = (name,                     Macro GroupScope ExpandWhenUsed argspecs optarg                       (bg:startcontents),-                    Macro GroupScope ExpandWhenUsed argspecs optarg+                    Macro GroupScope ExpandWhenUsed [] Nothing                       (endcontents ++ [eg]))     (do lookupMacro name         case mtype of
src/Text/Pandoc/Readers/LaTeX/Parsing.hs view
@@ -420,7 +420,7 @@                            : totoks (incSourceColumn pos (2 + T.length t1)) t2                         Nothing -> Tok pos Symbol "#"                                   : Tok (incSourceColumn pos 1) Symbol "#"-                                  : totoks (incSourceColumn pos 1) t2+                                  : totoks (incSourceColumn pos 1) t3              _ ->                let (t1, t2) = T.span (\d -> d >= '0' && d <= '9') rest                in  case safeRead t1 of
src/Text/Pandoc/Writers/ChunkedHTML.hs view
@@ -29,6 +29,7 @@ import qualified Data.ByteString.Lazy as BL import Text.Pandoc.Chunks (splitIntoChunks, Chunk(..), ChunkedDoc(..),                            SecInfo(..), tocToList)+import Text.Pandoc.URI (isURI) import Data.Text (Text) import Data.Tree import qualified Data.Text as T@@ -99,9 +100,12 @@   return $ fromArchive archive  +-- We include in the zip only local media that is in the working directory+-- or below. addMedia :: PandocMonad m => Inline -> m Inline addMedia il@(Image _ _ (src,_))-  | fp <- normalise (T.unpack src)+  | not (isURI src)+  , fp <- normalise (T.unpack src)   , isRelative fp   , not (".." `isInfixOf` fp) = do   (bs, mbMime) <- fetchItem (T.pack fp)
src/Text/Pandoc/Writers/HTML.hs view
@@ -259,7 +259,7 @@        Just _ -> preEscapedText <$> writeHtmlString' st opts d        Nothing          | writerPreferAscii opts-            -> preEscapedText <$> writeHtmlString' st opts d+           -> preEscapedText <$> writeHtmlString' st opts d          | otherwise -> do             (body, _) <- evalStateT (pandocToHtml opts d) st             return body@@ -270,6 +270,7 @@              -> Pandoc              -> StateT WriterState m (Html, Context Text) pandocToHtml opts (Pandoc meta blocks) = do+  lift $ setupTranslations meta   let slideLevel = fromMaybe (getSlideLevel blocks) $ writerSlideLevel opts   modify $ \st -> st{ stSlideLevel = slideLevel }   metadata <- metaToContext opts@@ -497,10 +498,12 @@       let checkbox  = if checked                       then checkbox' ! A.checked ""                       else checkbox'-          checkbox' = H.input ! A.type_ "checkbox" ! A.disabled ""+          checkbox' = H.input ! A.type_ "checkbox"       isContents <- inlineListToHtml opts is       bsContents <- blockListToHtml opts bs-      return $ constr (checkbox >> isContents) >> bsContents+      return $ constr (checkbox >> isContents) >>+               (if null bs then mempty else nl) >>+               bsContents  -- | Construct table of contents from list of elements. tableOfContents :: PandocMonad m => WriterOptions -> [Block]
src/Text/Pandoc/Writers/OpenDocument.hs view
@@ -21,14 +21,14 @@ import Data.Foldable (find) import Data.List (sortOn, sortBy, foldl') import qualified Data.Map as Map-import Data.Maybe (fromMaybe, isNothing)+import Data.Maybe (isNothing) import Data.Ord (comparing) import qualified Data.Set as Set import Data.Text (Text) import qualified Data.Text as T import Text.Collate.Lang (Lang (..), parseLang)-import Text.Pandoc.Class.PandocMonad (PandocMonad, report, toLang)-import Text.Pandoc.Translations (translateTerm, setTranslations)+import Text.Pandoc.Class.PandocMonad (PandocMonad, report)+import Text.Pandoc.Translations (translateTerm) import Text.Pandoc.Definition import qualified Text.Pandoc.Builder as B import Text.Pandoc.Logging@@ -237,11 +237,7 @@ -- | Convert Pandoc document to string in OpenDocument format. writeOpenDocument :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeOpenDocument opts (Pandoc meta blocks) = do-  let defLang = Lang "en" (Just "US") Nothing [] [] []-  lang <- case lookupMetaString "lang" meta of-            "" -> pure defLang-            s  -> fromMaybe defLang <$> toLang (Just s)-  setTranslations lang+  setupTranslations meta   let colwidth = if writerWrapText opts == WrapAuto                     then Just $ writerColumns opts                     else Nothing
src/Text/Pandoc/Writers/Shared.hs view
@@ -43,6 +43,7 @@                      , toLegacyTable                      , splitSentences                      , ensureValidXmlIdentifiers+                     , setupTranslations                      ) where import Safe (lastMay)@@ -68,6 +69,10 @@ import Text.DocTemplates (Context(..), Val(..), TemplateTarget,                           ToContext(..), FromContext(..)) import Text.Pandoc.Chunks (tocToList, toTOCTree)+import Text.Collate.Lang (Lang (..))+import Text.Pandoc.Class (PandocMonad, toLang)+import Text.Pandoc.Translations (setTranslations)+import Data.Maybe (fromMaybe)  -- | Create template Context from a 'Meta' and an association list -- of variables, specified at the command line or in the writer.@@ -608,3 +613,12 @@     Table (f attr) cap colspecs thead tbodies tfoot   goBlock (Div attr bs) = Div (f attr) bs   goBlock x = x++-- | Set translations based on the `lang` in metadata.+setupTranslations :: PandocMonad m => Meta -> m ()+setupTranslations meta = do+  let defLang = Lang "en" (Just "US") Nothing [] [] []+  lang <- case lookupMetaString "lang" meta of+            "" -> pure defLang+            s  -> fromMaybe defLang <$> toLang (Just s)+  setTranslations lang
− stack.yaml
@@ -1,29 +0,0 @@-flags:-  pandoc:-    embed_data_files: true-  QuickCheck:-    old-random: false-packages:-- '.'-- 'pandoc-cli'-- 'pandoc-lua-engine'-- 'pandoc-server'-extra-deps:-- gridtables-0.1.0.0-- hslua-cli-1.2.0-- hslua-list-1.1.0-- hslua-module-zip-1.0.0-- jira-wiki-markup-1.5.0-- mime-types-0.1.1.0-- doctemplates-0.11-- texmath-0.12.5.5-- citeproc-0.8.1-- pandoc-types-1.23-- pandoc-lua-marshal-0.2.0-- commonmark-pandoc-0.2.1.3--ghc-options:-   "$locals": -fhide-source-paths -Wno-missing-home-modules-resolver: lts-20.6-nix:-  packages: [zlib]
+ test/command/8573.md view
@@ -0,0 +1,7 @@+```+% pandoc -f latex -t plain+\newenvironment{myenv}[1]{Open#1}{Close}+\begin{myenv}{x}Hello\end{myenv}+^D+OpenxHelloClose+```
test/command/tasklist.md view
@@ -6,8 +6,8 @@ - [x] bar ^D <ul class="task-list">-<li><input type="checkbox" disabled="" />foo</li>-<li><input type="checkbox" disabled="" checked="" />bar</li>+<li><input type="checkbox" />foo</li>+<li><input type="checkbox" checked="" />bar</li> </ul> ``` @@ -20,12 +20,12 @@ - [ ] bim ^D <ul class="task-list">-<li><input type="checkbox" disabled="" checked="" />foo<ul-class="task-list">-<li><input type="checkbox" disabled="" />bar</li>-<li><input type="checkbox" disabled="" checked="" />baz</li>+<li><input type="checkbox" checked="" />foo+<ul class="task-list">+<li><input type="checkbox" />bar</li>+<li><input type="checkbox" checked="" />baz</li> </ul></li>-<li><input type="checkbox" disabled="" />bim</li>+<li><input type="checkbox" />bim</li> </ul> ``` @@ -53,21 +53,21 @@ - [x] checked ^D <ul>-<li><input type="checkbox" disabled="" />unchecked</li>+<li><input type="checkbox" />unchecked</li> <li>plain item</li>-<li><input type="checkbox" disabled="" checked="" />checked</li>+<li><input type="checkbox" checked="" />checked</li> </ul> <p>paragraph</p> <ol type="1">-<li><input type="checkbox" disabled="" />ordered unchecked</li>+<li><input type="checkbox" />ordered unchecked</li> <li>[] plain item</li>-<li><input type="checkbox" disabled="" checked="" />ordered checked</li>+<li><input type="checkbox" checked="" />ordered checked</li> </ol> <p>paragraph</p> <ul class="task-list">-<li><p><input type="checkbox" disabled="" />list item with-a</p><p>second paragraph</p></li>-<li><p><input type="checkbox" disabled="" checked="" />checked</p></li>+<li><p><input type="checkbox" />list item with a</p>+<p>second paragraph</p></li>+<li><p><input type="checkbox" checked="" />checked</p></li> </ul> ``` 
test/writer.man view
@@ -1,5 +1,3 @@-.\" Automatically generated by Pandoc 3.0-.\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\
test/writer.ms view
@@ -1,5 +1,3 @@-.\" Automatically generated by Pandoc 3.0-.\" .\" **** Custom macro definitions ********************************* .\" * Super/subscript .\" (https://lists.gnu.org/archive/html/groff/2012-07/msg00046.html)