packages feed

pandoc 2.2 → 2.2.1

raw patch · 35 files changed

+426/−158 lines, 35 filesdep ~texmath

Dependency ranges changed: texmath

Files

AUTHORS.md view
@@ -86,6 +86,7 @@ - Jens Getreu - Jens Petersen - Jesse Rosenthal+- Joe Hermaszewski - Joe Hillenbrand - John MacFarlane - John Muccigrosso@@ -136,6 +137,7 @@ - Oliver Matthews - Ophir Lifshitz - Or Neeman+- OvidiusCicero - Pablo Rodríguez - Paul Rivier - Paulo Tanimoto
@@ -123,7 +123,7 @@ src/Text/Pandoc/Readers/TikiWiki.hs Copyright (C) 2017 Robin Lee Powell -Released under the GNU General Public License version 2.+Released under the GNU General Public License version 2 or later.  ---------------------------------------------------------------------- src/Text/Pandoc/Readers/JATS.hs@@ -142,6 +142,12 @@ src/Text/Pandoc/Readers/Org/* test/Tests/Readers/Org/* Copyright (C) 2014-2018 Albert Krewinkel++Released under the GNU General Public License version 2 or later.++----------------------------------------------------------------------+src/Text/Pandoc/Readers/FB2.hs+Copyright (C) 2018 Alexander Krotov  Released under the GNU General Public License version 2 or later. 
MANUAL.txt view
@@ -1,6 +1,6 @@ % Pandoc User's Guide % John MacFarlane-% April 26, 2018+% May 10, 2018  Synopsis ========@@ -568,7 +568,7 @@  :   Set the metadata field *KEY* to the value *VAL*.  A value specified     on the command line overrides a value specified in the document-    using [YAML metadata blocks][Extension:`yaml_metadata_block`].+    using [YAML metadata blocks][Extension: `yaml_metadata_block`].     Values will be parsed as YAML boolean or string values. If no value is     specified, the value will be treated as Boolean true.  Like     `--variable`, `--metadata` causes template variables to be set.@@ -642,7 +642,8 @@ :   Produce output with an appropriate header and footer (e.g. a     standalone HTML, LaTeX, TEI, or RTF file, not a fragment).  This option     is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`-    output.+    output.  For `native` output, this option causes metadata to+    be included; otherwise, metadata is suppressed.  `--template=`*FILE* @@ -1216,9 +1217,21 @@     not specified, a link to the KaTeX CDN will be inserted. Note that this     option does not imply `--katex`. +`--gladtex`++:   Enclose TeX math in `<eq>` tags in HTML output.  The resulting HTML+    can then be processed by [GladTeX] to produce images of the typeset+    formulas and an HTML file with links to these images.+    So, the procedure is:++        pandoc -s --gladtex input.md -o myfile.htex+        gladtex -d myfile-images myfile.htex+        # produces myfile.html and images in myfile-images+ [MathML]: http://www.w3.org/Math/ [MathJax]: https://www.mathjax.org [KaTeX]: https://github.com/Khan/KaTeX+[GladTeX]: http://humenda.github.io/GladTeX/  Options for wrapper scripts ---------------------------@@ -1273,7 +1286,7 @@ arbitrary information at any point in the file. They may be set at the command line using the `-V/--variable` option. If a variable is not set, pandoc will look for the key in the document's metadata – which can be set-using either [YAML metadata blocks][Extension:`yaml_metadata_block`]+using either [YAML metadata blocks][Extension: `yaml_metadata_block`] or with the `--metadata` option.  Variables set by pandoc@@ -1700,11 +1713,25 @@     Y     $endif$ -This will include `X` in the template if `variable` has a non-null-value; otherwise it will include `Y`. `X` and `Y` are placeholders for-any valid template text, and may include interpolated variables or other-conditionals. The `$else$` section may be omitted.+This will include `X` in the template if `variable` has a truthy+value; otherwise it will include `Y`. Here a truthy value is any+of the following: +- a string that is not entirely white space,+- a non-empty array where the first value is truthy,+- any number (including zero),+- any object,+- the boolean `true` (to specify the boolean `true`+  value using YAML metadata or the `--metadata` flag,+  use `y`, `Y`, `yes`, `Yes`, `YES`, `true`, `True`,+  `TRUE`, `on`, `On`, or `ON`; with the `--variable`+  flag, simply omit a value for the variable, e.g.+  `--variable draft`).++`X` and `Y` are placeholders for any valid template text,+and may include interpolated variables or other conditionals.+The `$else$` section may be omitted.+ When variables can have multiple values (for example, `author` in a multi-author document), you can use the `$for$` keyword: @@ -2909,10 +2936,12 @@ The cells of pipe tables cannot contain block elements like paragraphs and lists, and cannot span multiple lines.  If a pipe table contains a row whose printable content is wider than the column width (see-`--columns`), then the cell contents will wrap, with the-relative cell widths determined by the widths of the separator-lines.  (In this case, the table will take up the full text-width.)  If no lines are wider than column width, then+`--columns`), then the table will take up the full text width and+the cell contents will wrap, with the relative cell widths determined+by the number of dashes in the line separating the table header from+the table body. (For example `---|-` would make the first column 3/4+and the second column 1/4 of the full text width.)+On the other hand, if no lines are wider than column width, then cell contents will not be wrapped, and the cells will be sized to their contents. 
changelog view
@@ -1,3 +1,73 @@+pandoc (2.2.1)++  * Restored and undeprecated gladtex for HTML math (#4607).++    + Added `GladTeX` constructor to `Text.Pandoc.Options.HTMLMathMethod`+      [API change, reverts removal in v2.2]+    + Restored and undeprecated `--gladtex` option, removed in v2.2.++  * LaTeX reader:  Handle `$` in `/text{..}` inside math (#4576).++  * Org reader: Fix image filename recognition (Albert Krewinkel).+    Use a function from the filepath library to check whether a string is a+    valid file name.  The custom validity checker that was used before gave+    wrong results (e.g. for absolute file paths on Windows,+    kawabata/ox-pandoc#52).++  * FB2 reader: Replace some errors with warnings (Alexander Krotov).++  * HTML writer:++    + Strip links from headers when creating TOC (#4340).+      Otherwise the TOC entries will not link to the sections.+    + Fix regression with tex math environments in HTML + MathJax (#4639).++  * Muse writer (Alexander Krotov): Add support for left-align and+    right-align classes (#4542).++  * Docx writer: Support underline (#4633).++  * Text.Pandoc.Parsing: Lookahead for non-whitespace after+    `singleQuoteStart` and `doubleQuoteStart` (#4637).++  * `test-pandoc-utils.lua`:  more robust testing on both windows+    and \*nix. Previously the pipe tests were only run if+    `\bin/false` and `/bin/sed` were present, which they aren't+    in default MacOS and Windows systems.  Fixed by using `tr`+    and `false`, which should always be in the path on a \*nix+    system, and `find` and `echo` for Windows.++  * Text.Pandoc.Shared: add `uriPathToPath`.+    This adjusts the path from a file: URI in a way that is sensitive+    to Windows/Linux differences.  Thus, on Windows,+    `/c:/foo` gets interpreted as `c:/foo`, but on Linux,+    `/c:/foo` gets interpreted as `/c:/foo`.  See #4613.++  * Use `uriPathToPath` with file: URIs (#4613).++  * Revert piping HTML to pdf-engine (Mauro Bieg, #4413).  Use a temp+    file as before.++  * Text.Pandoc.Class: Catch IO errors when writing media files+    and issue a warning, rather than an error (Francesco Occhipinti, #4559).++  * Don't lowercase custom writer filename (Alexander Krotov, #4610).++  * MANUAL (Mauro Bieg):++    + Clarify truthiness in template variables (#2281).+    + Clarify pipe table width calculation (#4520).++  * ConTeXt template: New Greek fallback typeface (Pablo Rodríguez, #4405).+    CMU Serif gives better typographic results than the previous+    Greek fallback DejaVu Serif.++  * Make HTML template polyglot (#4606, OvidiusCicero), by making+    `<link rel="stylesheet" href="$css$">` self-closing.++  * Use texmath 0.11, allowing better translation of non-ASCII+    characters in math (#4642).+ pandoc (2.2)    * New input format: `fb2` (FictionBook2) (Alexander Krotov).@@ -126,7 +196,7 @@     + Allow emphasis and notes in titles.     + Don't intersperse paragraph with empty lines.     + Convert metadata value `abstract` to book annotation.-    + Use `<empty-line />` for `HorizontalRule' rather than `LineBreak`.+    + Use `<empty-line />` for `HorizontalRule` rather than `LineBreak`.       FB2 does not have a way to represent line breaks inside paragraphs;       previously we used `<empty-line />` elements, but these are not allowed       inside paragraphs.@@ -214,7 +284,7 @@     + Use `withTempDir` in `html2pdf`.     + With `xelatex`, don't compress images til the last run (#4484).       This saves time for image-heavy documents.-    + Don't try to convert EPS files (#2067).  `pdflatex converts them+    + Don't try to convert EPS files (#2067).  `pdflatex` converts them       itself, and JuicyPixels can't do it.     + For `pdflatex`, use a temp directory in the working directory.       Otherwise we can have problems with the EPS conversion pdflatex
data/templates/default.context view
@@ -54,7 +54,7 @@  \setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted -\definefallbackfamily[mainface][rm][DejaVu Serif][preset=range:greek, force=yes]+\definefallbackfamily[mainface][rm][CMU Serif][preset=range:greek, force=yes] \definefontfamily[mainface][rm][$if(mainfont)$$mainfont$$else$Latin Modern Roman$endif$] \definefontfamily[mainface][mm][$if(mathfont)$$mathfont$$else$Latin Modern Math$endif$] \definefontfamily[mainface][ss][$if(sansfont)$$sansfont$$else$Latin Modern Sans$endif$]
data/templates/default.html5 view
@@ -29,7 +29,7 @@   </style> $endif$ $for(css)$-  <link rel="stylesheet" href="$css$">+  <link rel="stylesheet" href="$css$" /> $endfor$ $if(math)$   $math$
man/pandoc.1 view
@@ -1,5 +1,5 @@ .\"t-.TH PANDOC 1 "April 26, 2018" "pandoc 2.2"+.TH PANDOC 1 "May 10, 2018" "pandoc 2.2.1" .SH NAME pandoc - general markup converter .SH SYNOPSIS@@ -647,8 +647,7 @@ .B \f[C]\-M\f[] \f[I]KEY\f[][\f[C]=\f[]\f[I]VAL\f[]], \f[C]\-\-metadata=\f[]\f[I]KEY\f[][\f[C]:\f[]\f[I]VAL\f[]] Set the metadata field \f[I]KEY\f[] to the value \f[I]VAL\f[]. A value specified on the command line overrides a value specified in the-document using [YAML metadata-blocks][Extension:\f[C]yaml_metadata_block\f[]].+document using YAML metadata blocks. Values will be parsed as YAML boolean or string values. If no value is specified, the value will be treated as Boolean true. Like \f[C]\-\-variable\f[], \f[C]\-\-metadata\f[] causes template@@ -727,6 +726,8 @@ a standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option is set automatically for \f[C]pdf\f[], \f[C]epub\f[], \f[C]epub3\f[], \f[C]fb2\f[], \f[C]docx\f[], and \f[C]odt\f[] output.+For \f[C]native\f[] output, this option causes metadata to be included;+otherwise, metadata is suppressed. .RS .RE .TP@@ -1413,6 +1414,22 @@ Note that this option does not imply \f[C]\-\-katex\f[]. .RS .RE+.TP+.B \f[C]\-\-gladtex\f[]+Enclose TeX math in \f[C]<eq>\f[] tags in HTML output.+The resulting HTML can then be processed by GladTeX to produce images of+the typeset formulas and an HTML file with links to these images.+So, the procedure is:+.RS+.IP+.nf+\f[C]+pandoc\ \-s\ \-\-gladtex\ input.md\ \-o\ myfile.htex+gladtex\ \-d\ myfile\-images\ myfile.htex+#\ produces\ myfile.html\ and\ images\ in\ myfile\-images+\f[]+.fi+.RE .SS Options for wrapper scripts .TP .B \f[C]\-\-dump\-args\f[]@@ -1489,9 +1506,8 @@ They may be set at the command line using the \f[C]\-V/\-\-variable\f[] option. If a variable is not set, pandoc will look for the key in the-document\[aq]s metadata \[en] which can be set using either [YAML-metadata blocks][Extension:\f[C]yaml_metadata_block\f[]] or with the-\f[C]\-\-metadata\f[] option.+document\[aq]s metadata \[en] which can be set using either YAML+metadata blocks or with the \f[C]\-\-metadata\f[] option. .SS Variables set by pandoc .PP Some variables are set automatically by pandoc.@@ -2081,7 +2097,25 @@ .fi .PP This will include \f[C]X\f[] in the template if \f[C]variable\f[] has a-non\-null value; otherwise it will include \f[C]Y\f[].+truthy value; otherwise it will include \f[C]Y\f[].+Here a truthy value is any of the following:+.IP \[bu] 2+a string that is not entirely white space,+.IP \[bu] 2+a non\-empty array where the first value is truthy,+.IP \[bu] 2+any number (including zero),+.IP \[bu] 2+any object,+.IP \[bu] 2+the boolean \f[C]true\f[] (to specify the boolean \f[C]true\f[] value+using YAML metadata or the \f[C]\-\-metadata\f[] flag, use \f[C]y\f[],+\f[C]Y\f[], \f[C]yes\f[], \f[C]Yes\f[], \f[C]YES\f[], \f[C]true\f[],+\f[C]True\f[], \f[C]TRUE\f[], \f[C]on\f[], \f[C]On\f[], or \f[C]ON\f[];+with the \f[C]\-\-variable\f[] flag, simply omit a value for the+variable, e.g.+\f[C]\-\-variable\ draft\f[]).+.PP \f[C]X\f[] and \f[C]Y\f[] are placeholders for any valid template text, and may include interpolated variables or other conditionals. The \f[C]$else$\f[] section may be omitted.@@ -3586,12 +3620,14 @@ The cells of pipe tables cannot contain block elements like paragraphs and lists, and cannot span multiple lines. If a pipe table contains a row whose printable content is wider than the-column width (see \f[C]\-\-columns\f[]), then the cell contents will-wrap, with the relative cell widths determined by the widths of the-separator lines.-(In this case, the table will take up the full text width.) If no lines-are wider than column width, then cell contents will not be wrapped, and-the cells will be sized to their contents.+column width (see \f[C]\-\-columns\f[]), then the table will take up the+full text width and the cell contents will wrap, with the relative cell+widths determined by the number of dashes in the line separating the+table header from the table body.+(For example \f[C]\-\-\-|\-\f[] would make the first column 3/4 and the+second column 1/4 of the full text width.) On the other hand, if no+lines are wider than column width, then cell contents will not be+wrapped, and the cells will be sized to their contents. .PP Note: pandoc also recognizes pipe tables of the following form, as can be produced by Emacs\[aq] orgtbl\-mode:
pandoc.cabal view
@@ -1,5 +1,5 @@ name:            pandoc-version:         2.2+version:         2.2.1 cabal-version:   >= 1.10 build-type:      Custom license:         GPL-2@@ -358,7 +358,7 @@                  safe >= 0.3 && < 0.4,                  zip-archive >= 0.2.3.4 && < 0.4,                  HTTP >= 4000.0.5 && < 4000.4,-                 texmath >= 0.10 && < 0.11,+                 texmath >= 0.10 && < 0.12,                  xml >= 1.3.12 && < 1.4,                  split >= 0.2 && < 0.3,                  random >= 1 && < 1.2,
src/Text/Pandoc/App.hs view
@@ -93,7 +93,7 @@ import Text.Pandoc.PDF (makePDF) import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained) import Text.Pandoc.Shared (eastAsianLineBreakFilter, stripEmptyParagraphs,-         headerShift, isURI, ordNub, safeRead, tabFilter)+         headerShift, isURI, ordNub, safeRead, tabFilter, uriPathToPath) import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Writers.Math (defaultKaTeXURL, defaultMathJaxURL) import Text.Pandoc.XML (toEntities)@@ -223,17 +223,16 @@        then pdfWriterAndProg (optWriter opts) (optPdfEngine opts)        else return (nonPdfWriterName $ optWriter opts, Nothing) -  let format = baseWriterName+  let format = map toLower $ baseWriterName                  $ takeFileName writerName  -- in case path to lua script    -- disabling the custom writer for now   (writer, writerExts) <-             if ".lua" `isSuffixOf` format-               -- note:  use non-lowercased version writerName                then return (TextWriter                        (\o d -> writeCustom writerName o d)                                :: Writer PandocIO, mempty)-               else case getWriter writerName of+               else case getWriter (map toLower writerName) of                          Left e  -> E.throwIO $ PandocAppError $                            if format == "pdf"                               then e ++@@ -796,7 +795,7 @@                                  readURI src                              | uriScheme u == "file:" ->                                  liftIO $ UTF8.toText <$>-                                    BS.readFile (uriPath u)+                                    BS.readFile (uriPathToPath $ uriPath u)                       _       -> liftIO $ UTF8.toText <$>                                     BS.readFile src @@ -844,8 +843,7 @@      , Option "tw" ["to","write"]                  (ReqArg-                  (\arg opt -> return opt { optWriter =-                                              Just (map toLower arg) })+                  (\arg opt -> return opt { optWriter = Just arg })                   "FORMAT")                  "" @@ -1404,6 +1402,12 @@                            fromMaybe defaultKaTeXURL arg })                   "URL")                   "" -- Use KaTeX for HTML Math++    , Option "" ["gladtex"]+                 (NoArg+                  (\opt ->+                      return opt { optHTMLMathMethod = GladTeX }))+                 "" -- "Use gladtex for HTML math"      , Option "" ["abbreviations"]                 (ReqArg
src/Text/Pandoc/Class.hs view
@@ -110,6 +110,7 @@ import qualified System.Directory as Directory import Data.Time (UTCTime) import Text.Pandoc.Logging+import Text.Pandoc.Shared (uriPathToPath) import Text.Parsec (ParsecT, getPosition, sourceLine, sourceName) import qualified Data.Time as IO (getCurrentTime) import Text.Pandoc.MIME (MimeType, getMimeType, extensionFromMimeType)@@ -477,6 +478,14 @@          Left e  -> throwError $ PandocIOError u e          Right r -> return r +-- | Show potential IO errors to the user continuing execution anyway+logIOError :: IO () -> PandocIO ()+logIOError f = do+  res <- liftIO $ tryIOError f+  case res of+    Left e -> report $ IgnoredIOError (E.displayException e)+    Right _ -> pure ()+ instance PandocMonad PandocIO where   lookupEnv = liftIO . IO.lookupEnv   getCurrentTime = liftIO IO.getCurrentTime@@ -590,7 +599,7 @@             -- We don't want to treat C:/ as a scheme:             Just u' | length (uriScheme u') > 2 -> openURL (show u')             Just u' | uriScheme u' == "file:" ->-                 readLocalFile $ dropWhile (=='/') (uriPath u')+                 readLocalFile $ uriPathToPath (uriPath u')             _ -> readLocalFile fp -- get from local file system    where readLocalFile f = do              resourcePath <- getResourcePath@@ -862,7 +871,7 @@        Just (_, bs) -> do          report $ Extracting fullpath          liftIOError (createDirectoryIfMissing True) (takeDirectory fullpath)-         liftIOError (\p -> BL.writeFile p bs) fullpath+         logIOError $ BL.writeFile fullpath bs  adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline adjustImagePath dir paths (Image attr lab (src, tit))
src/Text/Pandoc/Logging.hs view
@@ -85,6 +85,7 @@   | InlineNotRendered Inline   | BlockNotRendered Block   | DocxParserWarning String+  | IgnoredIOError String   | CouldNotFetchResource String String   | CouldNotDetermineImageSize String String   | CouldNotConvertImage String String@@ -101,6 +102,7 @@   | Deprecated String String   | NoTranslation String   | CouldNotLoadTranslations String String+  | UnexpectedXmlElement String String   deriving (Show, Eq, Data, Ord, Typeable, Generic)  instance ToJSON LogMessage where@@ -174,6 +176,8 @@            ["contents" .= toJSON bl]       DocxParserWarning s ->            ["contents" .= Text.pack s]+      IgnoredIOError s ->+           ["contents" .= Text.pack s]       CouldNotFetchResource fp s ->            ["path" .= Text.pack fp,             "message" .= Text.pack s]@@ -211,6 +215,9 @@       CouldNotLoadTranslations lang msg ->            ["lang" .= Text.pack lang,             "message" .= Text.pack msg]+      UnexpectedXmlElement element parent ->+           ["element" .= Text.pack element,+            "parent" .= Text.pack parent]   showPos :: SourcePos -> String@@ -261,6 +268,8 @@          "Not rendering " ++ show bl        DocxParserWarning s ->          "Docx parser warning: " ++ s+       IgnoredIOError s ->+         "IO Error (ignored): " ++ s        CouldNotFetchResource fp s ->          "Could not fetch resource '" ++ fp ++ "'" ++            if null s then "" else ": " ++ s@@ -305,6 +314,8 @@        CouldNotLoadTranslations lang m ->          "Could not load translations for " ++ lang ++            if null m then "" else '\n' : m+       UnexpectedXmlElement element parent ->+         "Unexpected XML element " ++ element ++ " in " ++ parent  messageVerbosity:: LogMessage -> Verbosity messageVerbosity msg =@@ -326,6 +337,7 @@        InlineNotRendered{}          -> INFO        BlockNotRendered{}           -> INFO        DocxParserWarning{}          -> INFO+       IgnoredIOError{}             -> WARNING        CouldNotFetchResource{}      -> WARNING        CouldNotDetermineImageSize{} -> WARNING        CouldNotConvertImage{}       -> WARNING@@ -342,3 +354,4 @@        Deprecated{}                 -> WARNING        NoTranslation{}              -> WARNING        CouldNotLoadTranslations{}   -> WARNING+       UnexpectedXmlElement {}      -> WARNING
src/Text/Pandoc/Options.hs view
@@ -107,6 +107,7 @@  data HTMLMathMethod = PlainMath                     | WebTeX String               -- url of TeX->image script.+                    | GladTeX                     | MathML                     | MathJax String              -- url of MathJax.js                     | KaTeX String                -- url of KaTeX files
src/Text/Pandoc/PDF.hs view
@@ -45,26 +45,23 @@ import Data.Maybe (fromMaybe) import Data.Text (Text) import qualified Data.Text as T-import qualified Data.Text.IO as TextIO import System.Directory import System.Environment import System.Exit (ExitCode (..)) import System.FilePath import System.IO (stdout)-import System.IO.Temp (withTempDirectory)+import System.IO.Temp (withTempDirectory, withTempFile) #if MIN_VERSION_base(4,8,3) import System.IO.Error (IOError, isDoesNotExistError) #else import System.IO.Error (isDoesNotExistError) #endif-import Text.HTML.TagSoup-import Text.HTML.TagSoup.Match import Text.Pandoc.Definition import Text.Pandoc.Error (PandocError (PandocPDFProgramNotFoundError)) import Text.Pandoc.MIME (getMimeType) import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..)) import Text.Pandoc.Process (pipeProcess)-import Text.Pandoc.Shared (inDirectory, stringify, withTempDir)+import Text.Pandoc.Shared (inDirectory, stringify) import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Walk (walkM) import Text.Pandoc.Writers.Shared (getField, metaToJSON)@@ -365,51 +362,50 @@           -> [String]     -- ^ Args to program           -> Text         -- ^ HTML5 source           -> IO (Either ByteString ByteString)-html2pdf verbosity program args htmlSource = do-  cwd <- getCurrentDirectory-  let tags = parseTags htmlSource-      (hd, tl) = break (tagClose (== "head")) tags-      baseTag = TagOpen "base"-        [("href", T.pack cwd <> T.singleton pathSeparator)] : [TagText "\n"]-      source = renderTags $ hd ++ baseTag ++ tl-  withTempDir "html2pdf.pdf" $ \tmpdir -> do-    let pdfFile = tmpdir </> "out.pdf"-    let pdfFileArgName = ["-o" | program == "prince"]-    let programArgs = args ++ ["-"] ++ pdfFileArgName ++ [pdfFile]-    env' <- getEnvironment-    when (verbosity >= INFO) $ do-      putStrLn "[makePDF] Command line:"-      putStrLn $ program ++ " " ++ unwords (map show programArgs)-      putStr "\n"-      putStrLn "[makePDF] Environment:"-      mapM_ print env'-      putStr "\n"-      putStrLn "[makePDF] Contents of intermediate HTML:"-      TextIO.putStr source-      putStr "\n"-    (exit, out) <- E.catch-      (pipeProcess (Just env') program programArgs $ BL.fromStrict $ UTF8.fromText source)-      (\(e :: IOError) -> if isDoesNotExistError e-                             then E.throwIO $-                                    PandocPDFProgramNotFoundError program-                             else E.throwIO e)-    when (verbosity >= INFO) $ do-      BL.hPutStr stdout out-      putStr "\n"-    pdfExists <- doesFileExist pdfFile-    mbPdf <- if pdfExists-              -- We read PDF as a strict bytestring to make sure that the-              -- temp directory is removed on Windows.-              -- See https://github.com/jgm/pandoc/issues/1192.-              then do-                res <- (Just . BL.fromChunks . (:[])) `fmap` BS.readFile pdfFile-                removeFile pdfFile-                return res-              else return Nothing-    return $ case (exit, mbPdf) of-               (ExitFailure _, _)      -> Left out-               (ExitSuccess, Nothing)  -> Left ""-               (ExitSuccess, Just pdf) -> Right pdf+html2pdf verbosity program args source = do+  -- write HTML to temp file so we don't have to rewrite+  -- all links in `a`, `img`, `style`, `script`, etc. tags,+  -- and piping to weasyprint didn't work on Windows either.+  file    <- withTempFile "." "html2pdf.html" $ \fp _ -> return fp+  pdfFile <- withTempFile "." "html2pdf.pdf" $ \fp _ -> return fp+  BS.writeFile file $ UTF8.fromText source+  let pdfFileArgName = ["-o" | program == "prince"]+  let programArgs = args ++ [file] ++ pdfFileArgName ++ [pdfFile]+  env' <- getEnvironment+  when (verbosity >= INFO) $ do+    putStrLn "[makePDF] Command line:"+    putStrLn $ program ++ " " ++ unwords (map show programArgs)+    putStr "\n"+    putStrLn "[makePDF] Environment:"+    mapM_ print env'+    putStr "\n"+    putStrLn $ "[makePDF] Contents of " ++ file ++ ":"+    BL.readFile file >>= BL.putStr+    putStr "\n"+  (exit, out) <- E.catch+    (pipeProcess (Just env') program programArgs BL.empty)+    (\(e :: IOError) -> if isDoesNotExistError e+                           then E.throwIO $+                                  PandocPDFProgramNotFoundError program+                           else E.throwIO e)+  removeFile file+  when (verbosity >= INFO) $ do+    BL.hPutStr stdout out+    putStr "\n"+  pdfExists <- doesFileExist pdfFile+  mbPdf <- if pdfExists+            -- We read PDF as a strict bytestring to make sure that the+            -- temp directory is removed on Windows.+            -- See https://github.com/jgm/pandoc/issues/1192.+            then do+              res <- (Just . BL.fromChunks . (:[])) `fmap` BS.readFile pdfFile+              removeFile pdfFile+              return res+            else return Nothing+  return $ case (exit, mbPdf) of+             (ExitFailure _, _)      -> Left out+             (ExitSuccess, Nothing)  -> Left ""+             (ExitSuccess, Just pdf) -> Right pdf  context2pdf :: Verbosity    -- ^ Verbosity level             -> FilePath     -- ^ temp directory for output
src/Text/Pandoc/Parsing.hs view
@@ -1366,7 +1366,9 @@   failIfInQuoteContext InSingleQuote   -- single quote start can't be right after str   guard =<< notAfterString-  () <$ charOrRef "'\8216\145"+  try $ do+    charOrRef "'\8216\145"+    notFollowedBy (oneOf [' ', '\t', '\n'])  singleQuoteEnd :: Stream s m Char                => ParserT s st m ()@@ -1379,7 +1381,7 @@ doubleQuoteStart = do   failIfInQuoteContext InDoubleQuote   try $ do charOrRef "\"\8220\147"-           notFollowedBy . satisfy $ flip elem [' ', '\t', '\n']+           notFollowedBy (oneOf [' ', '\t', '\n'])  doubleQuoteEnd :: Stream s m Char                => ParserT s st m ()
src/Text/Pandoc/Readers/FB2.hs view
@@ -46,6 +46,7 @@ import Data.ByteString.Lazy.Char8 ( pack ) import Data.ByteString.Base64.Lazy import Data.Char (isSpace, toUpper)+import Data.Functor import Data.List (dropWhileEnd, intersperse) import Data.List.Split (splitOn) import Data.Text (Text)@@ -53,8 +54,9 @@ import Data.Maybe import Text.HTML.TagSoup.Entity (lookupEntity) import Text.Pandoc.Builder-import Text.Pandoc.Class (PandocMonad, insertMedia)+import Text.Pandoc.Class (PandocMonad, insertMedia, report) import Text.Pandoc.Error+import Text.Pandoc.Logging import Text.Pandoc.Options import Text.Pandoc.Shared (crFilter) import Text.XML.Light@@ -122,7 +124,7 @@   case qName $ elName e of     "?xml"  -> pure mempty     "FictionBook" -> mconcat <$> mapM parseFictionBookChild (elChildren e)-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ ".")+    name -> report (UnexpectedXmlElement name "root") $> mempty parseBlock _ = pure mempty  -- | Parse a child of @\<FictionBook>@ element.@@ -133,7 +135,7 @@     "description" -> mempty <$ mapM_ parseDescriptionChild (elChildren e)     "body" -> mconcat <$> mapM parseBodyChild (elChildren e)     "binary" -> mempty <$ parseBinaryElement e-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ "in FictionBook.")+    name -> report (UnexpectedXmlElement name "FictionBook") $> mempty  -- | Parse a child of @\<description>@ element. parseDescriptionChild :: PandocMonad m => Element -> FB2 m ()@@ -226,7 +228,7 @@     "subtitle" -> parseSubtitle e     "table" -> parseTable e     "text-author" -> para <$> parsePType e-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ " in cite.")+    name -> report (UnexpectedXmlElement name "cite") $> mempty  -- | Parse @poemType@ parsePoem :: PandocMonad m => Element -> FB2 m Blocks@@ -241,7 +243,7 @@     "stanza" -> parseStanza e     "text-author" -> para <$> parsePType e     "date" -> pure $ para $ text $ strContent e-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ " in poem.")+    name -> report (UnexpectedXmlElement name "poem") $> mempty  parseStanza :: PandocMonad m => Element -> FB2 m Blocks parseStanza e = fromList . joinLineBlocks . toList . mconcat <$> mapM parseStanzaChild (elChildren e)@@ -257,7 +259,7 @@     "title" -> parseTitle e     "subtitle" -> parseSubtitle e     "v" -> lineBlock . (:[]) <$> parsePType e-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ " in stanza.")+    name -> report (UnexpectedXmlElement name "stanza") $> mempty  -- | Parse @epigraphType@ parseEpigraph :: PandocMonad m => Element -> FB2 m Blocks@@ -273,7 +275,7 @@     "cite" -> parseCite e     "empty-line" -> pure horizontalRule     "text-author" -> para <$> parsePType e-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ " in epigraph.")+    name -> report (UnexpectedXmlElement name "epigraph") $> mempty  -- | Parse @annotationType@ parseAnnotation :: PandocMonad m => Element -> FB2 m Blocks@@ -288,7 +290,7 @@     "subtitle" -> parseSubtitle e     "table" -> parseTable e     "empty-line" -> pure horizontalRule-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ " in annotation.")+    name -> report (UnexpectedXmlElement name "annotation") $> mempty  -- | Parse @sectionType@ parseSection :: PandocMonad m => Element -> FB2 m Blocks@@ -314,7 +316,7 @@     "subtitle" -> parseSubtitle e     "p" -> para <$> parsePType e     "section" -> parseSection e-    name -> throwError $ PandocParseError ("Couldn't parse FB2 file: unexpected element " ++ name ++ " in section.")+    name -> report (UnexpectedXmlElement name "section") $> mempty  -- | parse @styleType@ parseStyleType :: PandocMonad m => Element -> FB2 m Inlines
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -1053,13 +1053,28 @@ dollarsMath = do   symbol '$'   display <- option False (True <$ symbol '$')-  contents <- trim . toksToString <$>-               many (notFollowedBy (symbol '$') >> anyTok)-  if display-     then-       mathDisplay contents <$ try (symbol '$' >> symbol '$')-   <|> (guard (null contents) >> return (mathInline ""))-     else mathInline contents <$ symbol '$'+  (do contents <- try $ T.unpack <$> pDollarsMath 0+      if display+         then (mathDisplay contents <$ symbol '$')+         else return $ mathInline contents)+   <|> (guard display >> return (mathInline ""))++-- Int is number of embedded groupings+pDollarsMath :: PandocMonad m => Int -> LP m Text+pDollarsMath n = do+  Tok _ toktype t <- anyTok+  case toktype of+       Symbol | t == "$"+              , n == 0 -> return mempty+              | t == "\\" -> do+                  Tok _ _ t' <- anyTok+                  return (t <> t')+              | t == "{" -> (t <>) <$> pDollarsMath (n+1)+              | t == "}" ->+                if n > 0+                then (t <>) <$> pDollarsMath (n-1)+                else mzero+       _ -> (t <>) <$> pDollarsMath n  -- citations 
src/Text/Pandoc/Readers/Org/Meta.hs view
@@ -50,6 +50,7 @@ import Control.Monad (mzero, void, when) import Data.Char (toLower) import Data.List (intersperse)+import Data.Maybe (fromMaybe) import qualified Data.Map as M import Network.HTTP (urlEncode) @@ -191,16 +192,12 @@  setEmphasisPreChar :: Maybe [Char] -> OrgParserState -> OrgParserState setEmphasisPreChar csMb st =-  let preChars = case csMb of-                   Nothing -> orgStateEmphasisPreChars defaultOrgParserState-                   Just cs -> cs+  let preChars = fromMaybe (orgStateEmphasisPostChars defaultOrgParserState) csMb   in st { orgStateEmphasisPreChars = preChars }  setEmphasisPostChar :: Maybe [Char] -> OrgParserState -> OrgParserState setEmphasisPostChar csMb st =-  let postChars = case csMb of-                   Nothing -> orgStateEmphasisPostChars defaultOrgParserState-                   Just cs -> cs+  let postChars = fromMaybe (orgStateEmphasisPostChars defaultOrgParserState) csMb   in st { orgStateEmphasisPostChars = postChars }  emphChars :: Monad m => OrgParser m (Maybe [Char])
src/Text/Pandoc/Readers/Org/Shared.hs view
@@ -36,17 +36,18 @@  import Prelude import Data.Char (isAlphaNum)-import Data.List (isPrefixOf, isSuffixOf)+import Data.List (isPrefixOf)+import System.FilePath (isValid, takeExtension)   -- | Check whether the given string looks like the path to of URL of an image. isImageFilename :: String -> Bool-isImageFilename filename =-  any (\x -> ('.':x)  `isSuffixOf` filename) imageExtensions &&-  (any (\x -> (x ++ "://") `isPrefixOf` filename) protocols ||-   ':' `notElem` filename)+isImageFilename fp = hasImageExtension && (isValid fp || isKnownProtocolUri)  where-   imageExtensions = [ "jpeg" , "jpg" , "png" , "gif" , "svg" ]+   hasImageExtension = takeExtension fp `elem` imageExtensions+   isKnownProtocolUri = any (\x -> (x ++ "://") `isPrefixOf` fp) protocols++   imageExtensions = [ ".jpeg", ".jpg", ".png", ".gif", ".svg" ]    protocols = [ "file", "http", "https" ]  -- | Cleanup and canonicalize a string describing a link.  Return @Nothing@ if
src/Text/Pandoc/Readers/TikiWiki.hs view
@@ -6,7 +6,7 @@ {- |    Module      : Text.Pandoc.Readers.TikiWiki    Copyright   : Copyright (C) 2017 Robin Lee Powell-   License     : GPLv2+   License     : GNU GPL, version 2 or above     Maintainer  : Robin Lee Powell <robinleepowell@gmail.com>    Stability   : alpha
src/Text/Pandoc/Shared.hs view
@@ -84,6 +84,7 @@                      -- * File handling                      inDirectory,                      collapseFilePath,+                     uriPathToPath,                      filteredFilesFromArchive,                      -- * URI handling                      schemes,@@ -634,6 +635,19 @@     isSingleton [x] = Just x     isSingleton _   = Nothing     checkPathSeperator = fmap isPathSeparator . isSingleton++-- Convert the path part of a file: URI to a regular path.+-- On windows, @/c:/foo@ should be @c:/foo@.+-- On linux, @/foo@ should be @/foo@.+uriPathToPath :: String -> FilePath+uriPathToPath path =+#ifdef _WINDOWS+  case path of+    '/':ps -> ps+    ps     -> ps+#else+  path+#endif  -- -- File selection from the archive
src/Text/Pandoc/Writers/Docx.hs view
@@ -1111,6 +1111,9 @@   formattedString str inlineToOpenXML' opts Space = inlineToOpenXML opts (Str " ") inlineToOpenXML' opts SoftBreak = inlineToOpenXML opts (Str " ")+inlineToOpenXML' opts (Span (_,["underline"],_) ils) = do+  withTextProp (mknode "w:u" [("w:val","single")] ()) $+    inlinesToOpenXML opts ils inlineToOpenXML' _ (Span (ident,["comment-start"],kvs) ils) = do   -- prefer the "id" in kvs, since that is the one produced by the docx   -- reader.
src/Text/Pandoc/Writers/HTML.hs view
@@ -58,7 +58,7 @@ import Network.HTTP (urlEncode) import Network.URI (URI (..), parseURIReference, unEscapeString) import Numeric (showHex)-import Text.Blaze.Internal (customLeaf, MarkupM(Empty))+import Text.Blaze.Internal (customLeaf, customParent, MarkupM(Empty)) #if MIN_VERSION_blaze_markup(0,6,3) #else import Text.Blaze.Internal (preEscapedString, preEscapedText)@@ -354,7 +354,8 @@ defList opts items = toList H.dl opts (items ++ [nl opts])  -- | Construct table of contents from list of elements.-tableOfContents :: PandocMonad m => WriterOptions -> [Element] -> StateT WriterState m (Maybe Html)+tableOfContents :: PandocMonad m => WriterOptions -> [Element]+                -> StateT WriterState m (Maybe Html) tableOfContents _ [] = return Nothing tableOfContents opts sects = do   contents  <- mapM (elementToListItem opts) sects@@ -369,7 +370,8 @@  -- | Converts an Element to a list item for a table of contents, -- retrieving the appropriate identifier from state.-elementToListItem :: PandocMonad m => WriterOptions -> Element -> StateT WriterState m (Maybe Html)+elementToListItem :: PandocMonad m => WriterOptions -> Element+                  -> StateT WriterState m (Maybe Html) -- Don't include the empty headers created in slide shows -- shows when an hrule is used to separate slides without a new title: elementToListItem _ (Sec _ _ _ [Str "\0"] _) = return Nothing@@ -381,7 +383,8 @@                    then (H.span ! A.class_ "toc-section-number"                         $ toHtml $ showSecNum num') >> preEscapedString " "                    else mempty-  txt <- liftM (sectnum >>) $ inlineListToHtml opts $ walk deNote headerText+  txt <- liftM (sectnum >>) $+         inlineListToHtml opts $ walk (deLink . deNote) headerText   subHeads <- mapM (elementToListItem opts) subsecs >>= return . catMaybes   subList <- if null subHeads                 then return mempty@@ -397,8 +400,13 @@                        $ toHtml txt) >> subList elementToListItem _ _ = return Nothing +deLink :: Inline -> Inline+deLink (Link _ ils _) = Span nullAttr ils+deLink x              = x+ -- | Convert an Element to Html.-elementToHtml :: PandocMonad m => Int -> WriterOptions -> Element -> StateT WriterState m Html+elementToHtml :: PandocMonad m => Int -> WriterOptions -> Element+              -> StateT WriterState m Html elementToHtml _slideLevel opts (Blk block) = blockToHtml opts block elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elements) = do   slideVariant <- gets stSlideVariant@@ -657,16 +665,11 @@ -- title beginning with fig: indicates that the image is a figure blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) =   figure opts attr txt (s,tit)-blockToHtml opts (Para lst)-  | isEmptyRaw lst = return mempty-  | null lst && not (isEnabled Ext_empty_paragraphs opts) = return mempty-  | otherwise = do-      contents <- inlineListToHtml opts lst-      return $ H.p contents-  where-    isEmptyRaw [RawInline f _] = f `notElem` [Format "html",-                                    Format "html4", Format "html5"]-    isEmptyRaw _               = False+blockToHtml opts (Para lst) = do+  contents <- inlineListToHtml opts lst+  case contents of+       Empty _ | not (isEnabled Ext_empty_paragraphs opts) -> return mempty+       _ -> return $ H.p contents blockToHtml opts (LineBlock lns) =   if writerWrapText opts == WrapNone   then blockToHtml opts $ linesToPara lns@@ -1026,6 +1029,13 @@               return $ case t of                         InlineMath  -> m                         DisplayMath -> brtag >> m >> brtag+           GladTeX ->+              return $+                customParent (textTag "eq") !+                  customAttribute "env"+                    (toValue $ if t == InlineMath+                                  then ("math" :: Text)+                                  else "displaymath") $ strToHtml str            MathML -> do               let conf = useShortEmptyTags (const False)                            defaultConfigPP@@ -1055,7 +1065,6 @@       if ishtml          then return $ preEscapedString str          else if (f == Format "latex" || f == Format "tex") &&-                "\\begin" `isPrefixOf` str &&                 allowsMathEnvironments (writerHTMLMathMethod opts) &&                 isMathEnvironment str                 then inlineToHtml opts $ Math DisplayMath str
src/Text/Pandoc/Writers/Muse.hs view
@@ -511,7 +511,7 @@         isImageUrl = (`elem` imageExtensions) . takeExtension inlineToMuse (Image attr alt (source,'f':'i':'g':':':title)) =   inlineToMuse (Image attr alt (source,title))-inlineToMuse (Image attr inlines (source, title)) = do+inlineToMuse (Image attr@(_, classes, _) inlines (source, title)) = do   opts <- asks envOptions   alt <- local (\env -> env { envInsideLinkDescription = True }) $ inlineListToMuse inlines   let title' = if null title@@ -522,7 +522,13 @@   let width = case dimension Width attr of                 Just (Percent x) | isEnabled Ext_amuse opts -> " " ++ show (round x :: Integer)                 _ -> ""-  return $ "[[" <> text (urlEscapeBrackets source ++ width) <> "]" <> title' <> "]"+  let leftalign = if "align-left" `elem` classes+                  then " l"+                  else ""+  let rightalign = if "align-right" `elem` classes+                   then " r"+                   else ""+  return $ "[[" <> text (urlEscapeBrackets source ++ width ++ leftalign ++ rightalign) <> "]" <> title' <> "]" inlineToMuse (Note contents) = do   -- add to notes in state   notes <- gets stNotes
stack.yaml view
@@ -21,7 +21,7 @@ - pandoc-types-1.17.4.2 - cmark-gfm-0.1.3 - hslua-module-text-0.1.2.1-- texmath-0.10.1.2+- texmath-0.11 ghc-options:    "$locals": -fhide-source-paths -XNoImplicitPrelude resolver: lts-10.10
test/Tests/Lua.hs view
@@ -12,7 +12,8 @@ import Text.Pandoc.Arbitrary () import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,                             header, linebreak, para, plain, rawBlock,-                            singleQuoted, space, str, strong)+                            singleQuoted, space, str, strong,+                            math, displayMath) import Text.Pandoc.Class (runIOorExplode, setUserDataDir) import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str),                                Attr, Meta, Pandoc, pandocTypesVersion)@@ -47,6 +48,12 @@       "plain-to-para.lua"       (doc $ bulletList [plain (str "alfa"), plain (str "bravo")])       (doc $ bulletList [para (str "alfa"), para (str "bravo")])++  , testCase "convert display math to inline math" $+    assertFilterConversion "display math becomes inline math"+      "math.lua"+      (doc $ para (displayMath "5+5"))+      (doc $ para (math "5+5"))    , testCase "make hello world document" $     assertFilterConversion "Document contains 'Hello, World!'"
test/Tests/Writers/Muse.hs view
@@ -425,6 +425,12 @@           , "image with width" =:             imageWith ("", [], [("width", "60%")]) "image.png" "Image" (str "") =?>             "[[image.png 60][Image]]"+          , "left-aligned image with width" =:+            imageWith ("", ["align-left"], [("width", "60%")]) "image.png" "Image" (str "") =?>+            "[[image.png 60 l][Image]]"+          , "right-aligned image with width" =:+            imageWith ("", ["align-right"], [("width", "60%")]) "image.png" "Image" (str "") =?>+            "[[image.png 60 r][Image]]"           , "escape brackets in image title" =: image "image.png" "Foo]bar" (str "") =?> "[[image.png][<verbatim>Foo]bar</verbatim>]]"           , "note" =: note (plain (text "Foo"))                    =?> unlines [ "[1]"
+ test/command/4576.md view
@@ -0,0 +1,6 @@+```+% pandoc -f latex -t native+$\rho_\text{D$_2$O}=866$+^D+[Para [Math InlineMath "\\rho_\\text{D$_2$O}=866"]]+```
+ test/command/4637.md view
@@ -0,0 +1,6 @@+```+% pandoc -t latex+more \indextext{dogs}' than \indextext{cats}'+^D+more \indextext{dogs}' than \indextext{cats}'+```
+ test/command/4639.md view
@@ -0,0 +1,10 @@+```+% pandoc -t html --mathjax+\begin{equation}+  E=mc^2+\end{equation}+^D+<p><span class="math display">\[\begin{equation}+  E=mc^2+\end{equation}\]</span></p>+```
test/docx/golden/inline_formatting.docx view

binary file changed (9737 → 9747 bytes)

test/epub/features.native view
@@ -70,7 +70,7 @@  ,Div ("content-mathml-001.xhtml#mathml-026",["section","ctest"],[])   [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-026"],Str "BiDi,",Space,Str "RTL",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets"]   ,Para [Str "Tests",Space,Str "whether",Space,Str "right-to-left",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets",Space,Str "are",Space,Str "supported."]-  ,Plain [Math DisplayMath "{d\\left( s \\right)} = \\left\\{ \\begin{matrix}\n{\\sum\\limits_{{\\lbrack?\\rbrack} = 1}^{S}s^{\\lbrack?\\rbrack}} & {\\text{\1573\1584\1575\1603\1575\1606}s > 0} \\\\\n{\\int_{1}^{S}{s^{\\lbrack?\\rbrack}s}} & {\\text{\1573\1584\1575\1603\1575\1606}s \\in m} \\\\\n{T\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{matrix} \\right."]+  ,Plain [Math DisplayMath "{\1583\\left( \1587 \\right)} = \\left\\{ \\begin{matrix}\n{\\sum\\limits_{\1646 = 1}^{\1589}\1587^{\1646}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 > 0} \\\\\n{\\int_{1}^{\1589}{\1587^{\1646}\1569\1587}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 \\in \1605} \\\\\n{{\1591\1575}\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{matrix} \\right."]   ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:"]]  ,Div ("content-mathml-001.xhtml#mathml-027",["section","ctest"],[])   [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-027"],Str "Elementary",Space,Str "math:",Space,Str "long",Space,Str "division",Space,Str "notation"]
+ test/lua/math.lua view
@@ -0,0 +1,10 @@+return {+  {+    Math = function (elem)+      if elem.mathtype == "DisplayMath" then+        elem.mathtype = "InlineMath"+      end+      return elem+    end,+  }+}
test/lua/test-pandoc-utils.lua view
@@ -32,25 +32,33 @@  function warn (...) io.stderr:write(...) end +function os_is_windows ()+  return package.config:sub(1,1) == '\\'+end+ function test_pipe ()-  if not file_exists('/bin/sed') then-    warn 'Did not find /bin/sed, skipping test'-    return true+  if os_is_windows() then+    local pipe_result = pandoc.pipe('find', {'hi'}, 'hi')+    return pipe_result:match("%a+") == 'hi'+  else+    local pipe_result = pandoc.pipe('tr', {'a', 'b'}, 'abc')+    return pipe_result:match("%a+") == 'bbc'   end-  local pipe_result = pandoc.pipe('/bin/sed', {'-e', 's/a/b/'}, 'abc')-  return pipe_result == 'bbc' end  function test_failing_pipe ()-  if not file_exists('/bin/false') then-    warn 'Did not find /bin/false, skipping test'-    return true+  if os_is_windows() then+    local res, err = pcall(pandoc.pipe, 'find', {'/a'}, 'hi')+    return not res and+      err.command == 'find' and+      err.error_code ~= 0+  else+    local res, err = pcall(pandoc.pipe, 'false', {}, 'abc')+    return not res and+      err.command == 'false' and+      err.error_code == 1 and+      err.output == ''   end-  local res, err = pcall(pandoc.pipe, '/bin/false', {}, 'abc')-  return not res and-    err.command == '/bin/false' and-    err.error_code == 1 and-    err.output == '' end  -- Read
test/writer.context view
@@ -21,7 +21,7 @@  \setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted -\definefallbackfamily[mainface][rm][DejaVu Serif][preset=range:greek, force=yes]+\definefallbackfamily[mainface][rm][CMU Serif][preset=range:greek, force=yes] \definefontfamily[mainface][rm][Latin Modern Roman] \definefontfamily[mainface][mm][Latin Modern Math] \definefontfamily[mainface][ss][Latin Modern Sans]
test/writers-lang-and-dir.context view
@@ -19,7 +19,7 @@  \setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted -\definefallbackfamily[mainface][rm][DejaVu Serif][preset=range:greek, force=yes]+\definefallbackfamily[mainface][rm][CMU Serif][preset=range:greek, force=yes] \definefontfamily[mainface][rm][Latin Modern Roman] \definefontfamily[mainface][mm][Latin Modern Math] \definefontfamily[mainface][ss][Latin Modern Sans]