packages feed

pandoc 2.0.0.1 → 2.0.1

raw patch · 30 files changed

+408/−189 lines, 30 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Pandoc.ImageSize: Millimeter :: Double -> Dimension

Files

MANUAL.txt view
@@ -1,6 +1,6 @@ % Pandoc User's Guide % John MacFarlane-% October 27, 2017+% October 31, 2017  Synopsis ========@@ -206,7 +206,7 @@ `dir` variable set). If the `mathspec` variable is set, `xelatex` will use [`mathspec`] instead of [`unicode-math`]. The [`upquote`] and [`microtype`] packages are used if-available, and [`csquotes`] will be used for [smart punctuation]+available, and [`csquotes`] will be used for [typography] if added to the template or included in any header file. The [`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can optionally be used for [citation rendering]. These are included@@ -2888,17 +2888,21 @@  ### Small caps ### -To write small caps, you can use an HTML span tag:+To write small caps, use the `smallcaps` class: -    <span style="font-variant:small-caps;">Small caps</span>+    [Small caps]{.smallcaps} -(The semicolon is optional and there may be space after the-colon.) This will work in all output formats that support small caps.+Or, without the `bracketed_spans` extension: -Alternatively, you can also use the new `bracketed_spans` syntax:+    <span class="smallcaps">Small caps</span> -    [Small caps]{style="font-variant:small-caps;"}+For compatibility with other Markdown flavors, CSS is also supported:+    +    <span style="font-variant:small-caps;">Small caps</span> +This will work in all output formats that support small caps.++ Math ---- @@ -3082,7 +3086,7 @@ colons plus some attributes. The attributes may optionally be followed by another string of consecutive colons. The attribute syntax is exactly as in fenced code blocks (see-[Extension-fenced_code_attributes], above).  As with fenced+[Extension: `fenced_code_attributes`]).  As with fenced code blocks, one can use either attributes in curly braces or a single unbraced word, which will be treated as a class name.  The Div ends with another line containing a string of at@@ -4042,17 +4046,34 @@ reveal.js has good support for speaker notes.  You can add notes to your Markdown document thus: -    <div class="notes">+    ::: notes+     This is my note.      - It can contain Markdown     - like this list -    </div>+    :::  To show the notes window, press `s` while viewing the presentation. Notes are not yet supported for other slide formats, but the notes will not appear on the slides themselves.++Columns+-------++To put material in side by side columns, you can use a native+div container with class `columns`, containing two or more div+containers with class `column` and a `width` attribute:++    :::::::::::::: {.columns}+    ::: {.column width="40%"}+    contents...+    :::+    ::: {.column width="60%"}+    contents...+    :::+    ::::::::::::::  Frame attributes in beamer --------------------------
changelog view
@@ -1,3 +1,62 @@+pandoc (2.0.1)++  * Fixed regression in parsing of HTML comments in markdown and other+    non-HTML formats (`Text.Pandoc.Readers.HTML.htmlTag`) (#4019).+    The parser stopped at the first `>` character, even if it wasn't+    the end of the comment.++  * Creole reader (Sascha Wilde):++    + Fix some minor typos and formatting.+    + Add additional test on nowiki-block after para.+    + Fix lists with trailing white space.++  * LaTeX reader: handle `%` comment right after command.+    For example, `\emph%`.++  * Markdown reader:  make sure fenced div closers work in lists.+    Previously the following failed:++        ::: {.class}+        1. one+        2. two+        :::++    and you needed a blank line before the closing `:::`.++  * Make `fenced_divs` affect the Markdown writer.  If `fenced_divs` is+    enabled, Divs will be rendered as fenced divs.++  * LaTeX/Beamer writer: support "blocks" inside columns and other Divs+    (#4016).++  * HTML Writer: consistently use dashed class-names (Mauro Bieg, #3556).+    Note: this change may require some changes in CSS rules.+    `footnoteRef` has become `footnote-ref`, `titleslide` has+    become `title-slide`, and `footnoteBack` has become `footnote-back`.++  * JATS writer: Properly pass through author metadata (#4020).++  * FB2 writer (Alexander Krotov):++    + Write blocks outside of `<p>` in definitions.+    + Make bullet lists consistent with ordered lists, repeating+      the marker for the outer list rather than indenting sublists,+      since indentation does not work in readers.+    + Add new style FB2 tests.++  * `Text.Pandoc.ImageSize`: Add `Millimeter` constructor to `Dimension`+    (#4012) [API change]. Now sizes given in 'mm' are no longer converted+    to 'cm'.++  * Revise documentation of small caps syntax (Andrew Dunning, #4013).++  * Fix broken reference links in manual (Andrew Dunning, #4014)++  * Fixed example of slide columns structure in changelog (#4015).+    Also documented this feature in MANUAL.txt.++ pandoc (2.0.0.1)    * EPUB writer:@@ -75,14 +134,14 @@   * Implement multicolumn support for slide formats (#1710).     The structure expected is: -        <div class="columns">-          <div class="column" width="40%">-            contents...-          </div>-          <div class="column" width="60%">-            contents...-          </div>-        </div>+        :::::::::::::: {.columns}+        ::: {.column width="40%"}+        contents...+        :::+        ::: {.column width="60%"}+        contents...+        :::+        ::::::::::::::      Support has been added for beamer and all HTML slide formats. 
data/epub.css view
@@ -12,7 +12,7 @@ h3.date { } ol.toc { padding: 0; margin-left: 1em; } ol.toc li { list-style-type: none; margin: 0; padding: 0; }-a.footnoteRef { vertical-align: super; }+a.footnote-ref { vertical-align: super; } em, em em em, em em em em em { font-style: italic;} em em, em em em em { font-style: normal; } 
data/templates/default.s5 view
@@ -64,7 +64,7 @@ </div> <div class="presentation"> $if(title)$-<div class="titleslide slide">+<div class="title-slide slide">   <h1 class="title">$title$</h1> $if(subtitle)$   <h2 class="subtitle">$subtitle$</h2>
man/pandoc.1 view
@@ -1,5 +1,5 @@ .\"t-.TH PANDOC 1 "October 27, 2017" "pandoc 2.0"+.TH PANDOC 1 "October 31, 2017" "pandoc 2.0.1" .SH NAME pandoc - general markup converter .SH SYNOPSIS@@ -200,8 +200,8 @@ If the \f[C]mathspec\f[] variable is set, \f[C]xelatex\f[] will use \f[C]mathspec\f[] instead of \f[C]unicode\-math\f[]. The \f[C]upquote\f[] and \f[C]microtype\f[] packages are used if-available, and \f[C]csquotes\f[] will be used for [smart punctuation] if-added to the template or included in any header file.+available, and \f[C]csquotes\f[] will be used for typography if added to+the template or included in any header file. The \f[C]natbib\f[], \f[C]biblatex\f[], \f[C]bibtex\f[], and \f[C]biber\f[] packages can optionally be used for citation rendering. These are included with all recent versions of TeX Live.@@ -3572,24 +3572,31 @@ .fi .SS Small caps .PP-To write small caps, you can use an HTML span tag:+To write small caps, use the \f[C]smallcaps\f[] class: .IP .nf \f[C]-<span\ style="font\-variant:small\-caps;">Small\ caps</span>+[Small\ caps]{.smallcaps} \f[] .fi .PP-(The semicolon is optional and there may be space after the colon.) This-will work in all output formats that support small caps.+Or, without the \f[C]bracketed_spans\f[] extension:+.IP+.nf+\f[C]+<span\ class="smallcaps">Small\ caps</span>+\f[]+.fi .PP-Alternatively, you can also use the new \f[C]bracketed_spans\f[] syntax:+For compatibility with other Markdown flavors, CSS is also supported: .IP .nf \f[C]-[Small\ caps]{style="font\-variant:small\-caps;"}+<span\ style="font\-variant:small\-caps;">Small\ caps</span> \f[] .fi+.PP+This will work in all output formats that support small caps. .SS Math .SS Extension: \f[C]tex_math_dollars\f[] .PP@@ -3814,8 +3821,8 @@ plus some attributes. The attributes may optionally be followed by another string of consecutive colons.-The attribute syntax is exactly as in fenced code blocks (see-[Extension\-fenced_code_attributes], above).+The attribute syntax is exactly as in fenced code blocks (see Extension:+\f[C]fenced_code_attributes\f[]). As with fenced code blocks, one can use either attributes in curly braces or a single unbraced word, which will be treated as a class name. The Div ends with another line containing a string of at least three@@ -5023,13 +5030,14 @@ .IP .nf \f[C]-<div\ class="notes">+:::\ notes+ This\ is\ my\ note.  \-\ It\ can\ contain\ Markdown \-\ like\ this\ list -</div>+::: \f[] .fi .PP@@ -5037,6 +5045,24 @@ presentation. Notes are not yet supported for other slide formats, but the notes will not appear on the slides themselves.+.SS Columns+.PP+To put material in side by side columns, you can use a native div+container with class \f[C]columns\f[], containing two or more div+containers with class \f[C]column\f[] and a \f[C]width\f[] attribute:+.IP+.nf+\f[C]+::::::::::::::\ {.columns}+:::\ {.column\ width="40%"}+contents...+:::+:::\ {.column\ width="60%"}+contents...+:::+::::::::::::::+\f[]+.fi .SS Frame attributes in beamer .PP Sometimes it is necessary to add the LaTeX \f[C][fragile]\f[] option to
pandoc.cabal view
@@ -1,5 +1,5 @@ name:            pandoc-version:         2.0.0.1+version:         2.0.1 cabal-version:   >= 1.10 build-type:      Custom license:         GPL@@ -596,6 +596,7 @@                   Tests.Writers.RST                   Tests.Writers.TEI                   Tests.Writers.Muse+                  Tests.Writers.FB2   ghc-options:  -rtsopts -Wall -fno-warn-unused-do-bind -threaded   default-language: Haskell98 
src/Text/Pandoc/ImageSize.hs view
@@ -79,6 +79,7 @@  data Dimension = Pixel Integer                | Centimeter Double+               | Millimeter Double                | Inch Double                | Percent Double                | Em Double@@ -86,6 +87,7 @@ instance Show Dimension where   show (Pixel a)      = show   a ++ "px"   show (Centimeter a) = showFl a ++ "cm"+  show (Millimeter a) = showFl a ++ "mm"   show (Inch a)       = showFl a ++ "in"   show (Percent a)    = show   a ++ "%"   show (Em a)         = showFl a ++ "em"@@ -184,6 +186,7 @@   case dim of     (Pixel a)      -> fromIntegral a / fromIntegral (writerDpi opts)     (Centimeter a) -> a * 0.3937007874+    (Millimeter a) -> a * 0.03937007874     (Inch a)       -> a     (Percent _)    -> 0     (Em a)         -> a * (11/64)@@ -193,6 +196,7 @@   case dim of     (Pixel a)      -> a     (Centimeter a) -> floor $ dpi * a * 0.3937007874 :: Integer+    (Millimeter a) -> floor $ dpi * a * 0.03937007874 :: Integer     (Inch a)       -> floor $ dpi * a :: Integer     (Percent _)    -> 0     (Em a)         -> floor $ dpi * a * (11/64) :: Integer@@ -225,6 +229,7 @@   case dim of         Pixel x      -> Pixel (round $ factor * fromIntegral x)         Centimeter x -> Centimeter (factor * x)+        Millimeter x -> Millimeter (factor * x)         Inch x       -> Inch (factor * x)         Percent x    -> Percent (factor * x)         Em x         -> Em (factor * x)@@ -243,7 +248,7 @@ lengthToDim s = numUnit s >>= uncurry toDim   where     toDim a "cm"   = Just $ Centimeter a-    toDim a "mm"   = Just $ Centimeter (a / 10)+    toDim a "mm"   = Just $ Millimeter a     toDim a "in"   = Just $ Inch a     toDim a "inch" = Just $ Inch a     toDim a "%"    = Just $ Percent a
src/Text/Pandoc/Readers/Creole.hs view
@@ -27,7 +27,7 @@    License     : GNU GPL, version 2 or above     Maintainer  : Sascha Wilde <wilde@sha-bang.de>-   Stability   : WIP+   Stability   : alpha    Portability : portable  Conversion of creole text to 'Pandoc' document.@@ -64,7 +64,7 @@ type CRLParser = ParserT [Char] ParserState  ----- Utility funcitons+-- Utility functions --  (<+>) :: (Monad m, Monoid a) => m a -> m a -> m a@@ -111,7 +111,8 @@   return res  nowiki :: PandocMonad m => CRLParser m B.Blocks-nowiki = try $ fmap (B.codeBlock . mconcat) (nowikiStart >> manyTill content nowikiEnd)+nowiki = try $ fmap (B.codeBlock . mconcat) (nowikiStart+                                             >> manyTill content nowikiEnd)   where     content = brackets <|> line     brackets = try $ option "" ((:[]) <$> newline)@@ -154,7 +155,8 @@ listItem c n =   fmap (B.plain . B.trimInlines .mconcat) (listStart >> many1Till inline itemEnd)   where-    listStart = try $ optional newline >> skipSpaces >> count n (char c)+    listStart = try $ skipSpaces >> optional newline >> skipSpaces+                >> count n (char c)                 >> lookAhead (noneOf [c]) >> skipSpaces     itemEnd = endOfParaElement <|> nextItem n               <|> if n < 3 then nextItem (n+1)@@ -193,7 +195,7 @@    startOf      :: PandocMonad m => CRLParser m a -> CRLParser m ()    startOf p     = try $ blankline >> p >> return mempty    startOfList   = startOf $ anyList 1-   startOfTable  =startOf table+   startOfTable  = startOf table    startOfHeader = startOf header    startOfNowiki = startOf nowiki    hr            = startOf horizontalRule
src/Text/Pandoc/Readers/HTML.hs view
@@ -1172,8 +1172,9 @@   case next of        TagComment s          | "<!--" `isPrefixOf` inp -> do-          char '<'-          manyTill anyChar endAngle+          string "<!--"+          count (length s) anyChar+          string "-->"           stripComments <- getOption readerStripComments           if stripComments              then return (next, "")
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -1132,7 +1132,7 @@   lookupListDefault raw names inlineCommands  tok :: PandocMonad m => LP m Inlines-tok = grouped inline <|> inlineCommand' <|> singleChar'+tok = try $ spaces >> grouped inline <|> inlineCommand' <|> singleChar'   where singleChar' = do           Tok _ _ t <- singleChar           return (str (T.unpack t))
src/Text/Pandoc/Readers/Markdown.hs view
@@ -846,6 +846,7 @@                      skipMany spaceChar                      listStart)   notFollowedByHtmlCloser+  notFollowedByDivCloser   optional (() <$ gobbleSpaces continuationIndent)   listLineCommon @@ -883,16 +884,24 @@   x <- try $ do          notFollowedBy blankline          notFollowedByHtmlCloser+         notFollowedByDivCloser          gobbleSpaces continuationIndent          anyLineNewline   xs <- many $ try $ do          notFollowedBy blankline          notFollowedByHtmlCloser+         notFollowedByDivCloser          gobbleSpaces continuationIndent <|> notFollowedBy' listStart          anyLineNewline   blanks <- many blankline   return $ concat (x:xs) ++ blanks +notFollowedByDivCloser :: PandocMonad m => MarkdownParser m ()+notFollowedByDivCloser = do+  guardDisabled Ext_fenced_divs <|>+    do divLevel <- stateFencedDivLevel <$> getState+       guard (divLevel < 1) <|> notFollowedBy divFenceEnd+ notFollowedByHtmlCloser :: PandocMonad m => MarkdownParser m () notFollowedByHtmlCloser = do   inHtmlBlock <- stateInHtmlBlock <$> getState@@ -965,6 +974,7 @@   let dline = try                ( do notFollowedBy blankline                     notFollowedByHtmlCloser+                    notFollowedByDivCloser                     if compact -- laziness not compatible with compact                        then () <$ indentSpaces                        else (() <$ indentSpaces)@@ -1688,10 +1698,8 @@   guardEnabled Ext_blank_before_header <|> (notFollowedBy . char =<< atxChar) -- atx header   guardDisabled Ext_backtick_code_blocks <|>      notFollowedBy (() <$ (lookAhead (char '`') >> codeBlockFenced))-  guardDisabled Ext_fenced_divs <|>-    do divLevel <- stateFencedDivLevel <$> getState-       guard (divLevel < 1) <|> notFollowedBy divFenceEnd   notFollowedByHtmlCloser+  notFollowedByDivCloser   (eof >> return mempty)     <|> (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak))     <|> (guardEnabled Ext_ignore_line_breaks >> return mempty)
src/Text/Pandoc/Writers/FB2.hs view
@@ -64,7 +64,6 @@     { footnotes         :: [ (Int, String, [Content]) ]  -- ^ #, ID, text     , imagesToFetch     :: [ (String, String) ]  -- ^ filename, URL or path     , parentListMarker  :: String  -- ^ list marker of the parent ordered list-    , parentBulletLevel :: Int  -- ^ nesting level of the unordered list     , writerOptions     :: WriterOptions     } deriving (Show) @@ -73,7 +72,7 @@  newFB :: FbRenderState newFB = FbRenderState { footnotes = [], imagesToFetch = []-                      , parentListMarker = "", parentBulletLevel = 0+                      , parentListMarker = ""                       , writerOptions = def }  data ImageMode = NormalImage | InlineImage deriving (Eq)@@ -347,32 +346,21 @@     concat <$> zipWithM mkitem markers bss blockToXml (BulletList bss) = do     state <- get-    let level = parentBulletLevel state     let pmrk = parentListMarker state-    let prefix = replicate (length pmrk) ' '-    let bullets = ["\x2022", "\x25e6", "*", "\x2043", "\x2023"]-    let mrk = prefix ++ bullets !! (level `mod` length bullets)+    let mrk = pmrk ++ "•"     let mkitem bs = do-          modify (\s -> s { parentBulletLevel = level+1 })+          modify (\s -> s { parentListMarker = mrk ++ " "})           item <- cMapM blockToXml $ plainToPara $ indentBlocks (mrk ++ " ") bs-          modify (\s -> s { parentBulletLevel = level }) -- restore bullet level+          modify (\s -> s { parentListMarker = pmrk }) -- old parent marker           return item     cMapM mkitem bss blockToXml (DefinitionList defs) =     cMapM mkdef defs     where       mkdef (term, bss) = do-          def' <- cMapM (cMapM blockToXml . sep . paraToPlain . map indent) bss+          items <- cMapM (cMapM blockToXml . plainToPara . indentBlocks (replicate 4 ' ')) bss           t <- wrap "strong" term-          return [ el "p" t, el "p" def' ]-      sep blocks =-          if all needsBreak blocks then-              blocks ++ [Plain [LineBreak]]-          else-              blocks-      needsBreak (Para _)    = False-      needsBreak (Plain ins) = LineBreak `notElem` ins-      needsBreak _           = True+          return (el "p" t : items) blockToXml h@Header{} = do   -- should not occur after hierarchicalize, except inside lists/blockquotes   report $ BlockNotRendered h@@ -402,14 +390,6 @@       align_str AlignRight   = "right"       align_str AlignDefault = "left" blockToXml Null = return []---- Replace paragraphs with plain text and line break.--- Necessary to simulate multi-paragraph lists in FB2.-paraToPlain :: [Block] -> [Block]-paraToPlain [] = []-paraToPlain (Para inlines : rest) =-    Plain inlines : Plain [LineBreak] : paraToPlain rest-paraToPlain (p:rest) = p : paraToPlain rest  -- Replace plain text with paragraphs and add line break after paragraphs. -- It is used to convert plain text from tight list items to paragraphs.
src/Text/Pandoc/Writers/HTML.hs view
@@ -438,7 +438,7 @@                                   []     -> []                                   (x:xs) -> x ++ concatMap inDiv xs   let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts]-  let classes' = ["titleslide" | titleSlide] ++ ["slide" | slide] +++  let classes' = ["title-slide" | titleSlide] ++ ["slide" | slide] ++                   ["section" | (slide || writerSectionDivs opts) &&                                not html5 ] ++                   ["level" ++ show level | slide || writerSectionDivs opts ]@@ -1100,7 +1100,7 @@                         let link = H.a ! A.href (toValue $ "#" ++                                          revealSlash ++                                          writerIdentifierPrefix opts ++ "fn" ++ ref)-                                       ! A.class_ "footnoteRef"+                                       ! A.class_ "footnote-ref"                                        ! prefixedId opts ("fnref" ++ ref)                                        $ (if isJust epubVersion                                              then id@@ -1120,7 +1120,7 @@ blockListToNote opts ref blocks =   -- If last block is Para or Plain, include the backlink at the end of   -- that block. Otherwise, insert a new Plain block with the backlink.-  let backlink = [Link ("",["footnoteBack"],[]) [Str "↩"] ("#" ++ writerIdentifierPrefix opts ++ "fnref" ++ ref,[])]+  let backlink = [Link ("",["footnote-back"],[]) [Str "↩"] ("#" ++ writerIdentifierPrefix opts ++ "fnref" ++ ref,[])]       blocks'  = if null blocks                     then []                     else let lastBlock   = last blocks
src/Text/Pandoc/Writers/JATS.hs view
@@ -37,7 +37,6 @@ import Data.List (isSuffixOf, partition) import Data.Maybe (fromMaybe) import Data.Text (Text)-import qualified Text.Pandoc.Builder as B import Text.Pandoc.Class (PandocMonad, report) import Text.Pandoc.Definition import Text.Pandoc.Highlighting (languages, languagesByExtension)@@ -56,38 +55,14 @@ data JATSVersion = JATS1_1      deriving (Eq, Show) -type DB = ReaderT JATSVersion---- | Convert list of authors to a docbook <author> section-authorToJATS :: PandocMonad m => WriterOptions -> [Inline] -> DB m B.Inlines-authorToJATS opts name' = do-  name <- render Nothing <$> inlinesToJATS opts name'-  let colwidth = if writerWrapText opts == WrapAuto-                    then Just $ writerColumns opts-                    else Nothing-  return $ B.rawInline "docbook" $ render colwidth $-      if ',' `elem` name-         then -- last name first-              let (lastname, rest) = break (==',') name-                  firstname = triml rest in-              inTagsSimple "firstname" (text $ escapeStringForXML firstname) <>-              inTagsSimple "surname" (text $ escapeStringForXML lastname)-         else -- last name last-              let namewords = words name-                  lengthname = length namewords-                  (firstname, lastname) = case lengthname of-                    0 -> ("","")-                    1 -> ("", name)-                    n -> (unwords (take (n-1) namewords), last namewords)-               in inTagsSimple "firstname" (text $ escapeStringForXML firstname) $$-                  inTagsSimple "surname" (text $ escapeStringForXML lastname)+type JATS = ReaderT JATSVersion  writeJATS :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeJATS opts d =   runReaderT (docToJATS opts d) JATS1_1  -- | Convert Pandoc document to string in JATS format.-docToJATS :: PandocMonad m => WriterOptions -> Pandoc -> DB m Text+docToJATS :: PandocMonad m => WriterOptions -> Pandoc -> JATS m Text docToJATS opts (Pandoc meta blocks) = do   let isBackBlock (Div ("refs",_,_) _) = True       isBackBlock _                    = False@@ -110,14 +85,12 @@                    TopLevelChapter -> 0                    TopLevelSection -> 1                    TopLevelDefault -> 1-  auths' <- mapM (authorToJATS opts) $ docAuthors meta-  let meta' = B.setMeta "author" auths' meta   metadata <- metaToJSON opts                  (fmap (render' . vcat) .                           mapM (elementToJATS opts' startLvl) .                             hierarchicalize)                  (fmap render' . inlinesToJATS opts')-                 meta'+                 meta   main <- (render' . vcat) <$>             mapM (elementToJATS opts' startLvl) elements   back <- (render' . vcat) <$>@@ -132,7 +105,7 @@        Just tpl -> renderTemplate' tpl context  -- | Convert an Element to JATS.-elementToJATS :: PandocMonad m => WriterOptions -> Int -> Element -> DB m Doc+elementToJATS :: PandocMonad m => WriterOptions -> Int -> Element -> JATS m Doc elementToJATS opts _   (Blk block) = blockToJATS opts block elementToJATS opts lvl (Sec _ _num (id',_,kvs) title elements) = do   let idAttr = [("id", writerIdentifierPrefix opts ++ id') | not (null id')]@@ -144,7 +117,7 @@       inTagsSimple "title" title' $$ vcat contents  -- | Convert a list of Pandoc blocks to JATS.-blocksToJATS :: PandocMonad m => WriterOptions -> [Block] -> DB m Doc+blocksToJATS :: PandocMonad m => WriterOptions -> [Block] -> JATS m Doc blocksToJATS opts = fmap vcat . mapM (blockToJATS opts)  -- | Auxiliary function to convert Plain block to Para.@@ -155,13 +128,13 @@ -- | Convert a list of pairs of terms and definitions into a list of -- JATS varlistentrys. deflistItemsToJATS :: PandocMonad m-                      => WriterOptions -> [([Inline],[[Block]])] -> DB m Doc+                      => WriterOptions -> [([Inline],[[Block]])] -> JATS m Doc deflistItemsToJATS opts items =   vcat <$> mapM (uncurry (deflistItemToJATS opts)) items  -- | Convert a term and a list of blocks into a JATS varlistentry. deflistItemToJATS :: PandocMonad m-                     => WriterOptions -> [Inline] -> [[Block]] -> DB m Doc+                     => WriterOptions -> [Inline] -> [[Block]] -> JATS m Doc deflistItemToJATS opts term defs = do   term' <- inlinesToJATS opts term   def' <- blocksToJATS opts $ concatMap (map plainToPara) defs@@ -171,7 +144,7 @@  -- | Convert a list of lists of blocks to a list of JATS list items. listItemsToJATS :: PandocMonad m-                => WriterOptions -> Maybe [String] -> [[Block]] -> DB m Doc+                => WriterOptions -> Maybe [String] -> [[Block]] -> JATS m Doc listItemsToJATS opts markers items =   case markers of        Nothing -> vcat <$> mapM (listItemToJATS opts Nothing) items@@ -179,7 +152,7 @@  -- | Convert a list of blocks into a JATS list item. listItemToJATS :: PandocMonad m-               => WriterOptions -> Maybe String -> [Block] -> DB m Doc+               => WriterOptions -> Maybe String -> [Block] -> JATS m Doc listItemToJATS opts mbmarker item = do   contents <- blocksToJATS opts item   return $ inTagsIndented "list-item" $@@ -187,7 +160,7 @@            $$ contents  -- | Convert a Pandoc block element to JATS.-blockToJATS :: PandocMonad m => WriterOptions -> Block -> DB m Doc+blockToJATS :: PandocMonad m => WriterOptions -> Block -> JATS m Doc blockToJATS _ Null = return empty -- Bibliography reference: blockToJATS opts (Div ('r':'e':'f':'-':_,_,_) [Para lst]) =@@ -311,7 +284,7 @@                   => WriterOptions                   -> Bool                   -> [[Block]]-                  -> DB m Doc+                  -> JATS m Doc tableRowToJATS opts isHeader cols =   (inTagsIndented "tr" . vcat) <$> mapM (tableItemToJATS opts isHeader) cols @@ -319,17 +292,17 @@                    => WriterOptions                    -> Bool                    -> [Block]-                   -> DB m Doc+                   -> JATS m Doc tableItemToJATS opts isHeader item =   (inTags True (if isHeader then "th" else "td") [] . vcat) <$>     mapM (blockToJATS opts) item  -- | Convert a list of inline elements to JATS.-inlinesToJATS :: PandocMonad m => WriterOptions -> [Inline] -> DB m Doc+inlinesToJATS :: PandocMonad m => WriterOptions -> [Inline] -> JATS m Doc inlinesToJATS opts lst = hcat <$> mapM (inlineToJATS opts) lst  -- | Convert an inline element to JATS.-inlineToJATS :: PandocMonad m => WriterOptions -> Inline -> DB m Doc+inlineToJATS :: PandocMonad m => WriterOptions -> Inline -> JATS m Doc inlineToJATS _ (Str str) = return $ text $ escapeStringForXML str inlineToJATS opts (Emph lst) =   inTagsSimple "italic" <$> inlinesToJATS opts lst
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -371,6 +371,10 @@   concat `fmap` mapM (elementToBeamer slideLevel) (hierarchicalize bs')  elementToBeamer :: PandocMonad m => Int -> Element -> LW m [Block]+elementToBeamer _slideLevel (Blk (Div attr bs)) = do+  -- make sure we support "blocks" inside divs+  bs' <- concat `fmap` mapM (elementToBeamer 0) (hierarchicalize bs)+  return [Div attr bs'] elementToBeamer _slideLevel (Blk b) = return [b] elementToBeamer slideLevel  (Sec lvl _num (ident,classes,kvs) tit elts)   | lvl >  slideLevel = do
src/Text/Pandoc/Writers/Markdown.hs view
@@ -397,11 +397,19 @@ blockToMarkdown' _ Null = return empty blockToMarkdown' opts (Div attrs ils) = do   contents <- blockListToMarkdown opts ils-  return $ if isEnabled Ext_raw_html opts &&-                isEnabled Ext_markdown_in_html_blocks opts-              then tagWithAttrs "div" attrs <> blankline <>-                      contents <> blankline <> "</div>" <> blankline-              else contents <> blankline+  return $+    case () of+         _ | isEnabled Ext_fenced_divs opts &&+             attrs /= nullAttr ->+                nowrap (text ":::" <+> attrsToMarkdown attrs) $$+                chomp contents $$+                text ":::" <> blankline+           | isEnabled Ext_native_divs opts ||+             (isEnabled Ext_raw_html opts &&+              isEnabled Ext_markdown_in_html_blocks opts) ->+                tagWithAttrs "div" attrs <> blankline <>+                contents <> blankline <> "</div>" <> blankline+           | otherwise -> contents <> blankline blockToMarkdown' opts (Plain inlines) = do   contents <- inlineListToMarkdown opts inlines   -- escape if para starts with ordered list marker
test/Tests/Readers/Creole.hs view
@@ -127,6 +127,11 @@           =?> bulletList [ plain "foo"                          <> bulletList [ plain "bar", plain "baz" ]                          , plain "blubb" ]+        , "nested unordered list, one separating space, trailing space" =:+          "* foo \n** bar  \n** baz \n* blubb  "+          =?> bulletList [ plain "foo"+                         <> bulletList [ plain "bar", plain "baz" ]+                         , plain "blubb" ]         , "ordered list, two entries, one separating space" =:           "# foo\n# bar"           =?> orderedList [ plain "foo", plain "bar" ]@@ -141,6 +146,11 @@           =?> orderedList [ plain "foo"                          <> orderedList [ plain "bar", plain "baz" ]                          , plain "blubb" ]+        , "nested ordered list, one separating space, trailing space" =:+          "# foo \n## bar  \n## baz \n# blubb  "+          =?> orderedList [ plain "foo"+                         <> orderedList [ plain "bar", plain "baz" ]+                         , plain "blubb" ]         , "nested many ordered lists, one separating space" =:           ("# foo\n## bar\n### third\n### third two\n## baz\n### third again\n"            <> "#### fourth\n##### fith\n# blubb")@@ -193,7 +203,10 @@         , "forced line breaks" =:           "{{{no break!\\\\here}}} but a break\\\\here!"           =?> para (code "no break!\\\\here" <> " but a break"-                    <> linebreak <> "here!")+                    <> linebreak <> "here!"),+          "quoted block, after trailing white space" =:+          "this is a paragraph  \n{{{\nfoo bar\n  //baz//\n}}}"+          =?> para "this is a paragraph" <> codeBlock "foo bar\n  //baz//"         ]   , testGroup "Images and Links" [           "image simple" =:
+ test/Tests/Writers/FB2.hs view
@@ -0,0 +1,34 @@+{-# LANGUAGE OverloadedStrings #-}+module Tests.Writers.FB2 (tests) where++import Test.Tasty+import Tests.Helpers+import Text.Pandoc+import Text.Pandoc.Arbitrary ()+import Text.Pandoc.Builder++fb2 :: String -> String+fb2 x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +++        "<FictionBook xmlns=\"http://www.gribuser.ru/xml/fictionbook/2.0\" xmlns:l=\"http://www.w3.org/1999/xlink\"><description><title-info /><document-info><program-used>pandoc</program-used></document-info></description><body><title><p /></title><annotation><p></p></annotation><section>" ++ x ++ "</section></body></FictionBook>"++infix 4 =:+(=:) :: (ToString a, ToPandoc a)+     => String -> (a, String) -> TestTree+(=:) = test (purely (writeFB2 def) . toPandoc)++tests :: [TestTree]+tests = [ testGroup "block elements"+          ["para"          =: para "Lorem ipsum cetera."+                           =?> fb2 "<p>Lorem ipsum cetera.</p>"+          ]+        , testGroup "inlines"+          [+            "Emphasis"      =:  emph ("emphasized")+                            =?> fb2 "<emphasis>emphasized</emphasis>"+          ]+        , "bullet list" =: bulletList [ plain $ text "first"+                                      , plain $ text "second"+                                      , plain $ text "third"+                                      ]+                        =?> fb2 "<p>\x2022 first</p><p>\x2022 second</p><p>\x2022 third</p>"+         ]
test/command/3596.md view
@@ -50,11 +50,9 @@ ^D -   foo --   <div id="id">-+-   ::: {#id}     bar--    </div>+    :::  -   baz 
+ test/command/4012.md view
@@ -0,0 +1,8 @@+```+pandoc -f markdown-implicit_figures+![image]++[image]: http://example.com/image.jpg {height=35mm}+^D+<p><img src="http://example.com/image.jpg" alt="image" style="height:35mm" /></p>+```
+ test/command/4016.md view
@@ -0,0 +1,47 @@+```+pandoc -t beamer+# Level 2 blocks++<div class="columns">+<div class="column" width="40%">+## Block one+- Item+</div>+<div class="column" width="60%">+## Block two+- Item+</div>+</div>+^D+\begin{frame}{%+\protect\hypertarget{level-2-blocks}{%+Level 2 blocks}}++\begin{columns}[T]+\begin{column}{0.40\textwidth}+\begin{block}{Block one}++\begin{itemize}+\tightlist+\item+  Item+\end{itemize}++\end{block}+\end{column}++\begin{column}{0.60\textwidth}+\begin{block}{Block two}++\begin{itemize}+\tightlist+\item+  Item+\end{itemize}++\end{block}+\end{column}+\end{columns}++\end{frame}+```
+ test/command/4019.md view
@@ -0,0 +1,8 @@+```+pandoc --wrap=preserve+This <!-- x > 0 --> works!+This <!-- x > 0 --> fails?+^D+<p>This <!-- x > 0 --> works!+This <!-- x > 0 --> fails?</p>+```
+ test/command/latex-command-comment.md view
@@ -0,0 +1,7 @@+```+pandoc -f latex -t native+\emph%+{hi}+^D+[Para [Emph [Str "hi"]]]+```
test/s5-basic.html view
@@ -38,7 +38,7 @@ </div> </div> <div class="presentation">-<div class="titleslide slide">+<div class="title-slide slide">   <h1 class="title">My S5 Document</h1>   <h3 class="author">Sam Smith<br/>Jen Jones</h3>   <h4 class="date">July 15, 2006</h4>
test/s5-fancy.html view
@@ -239,7 +239,7 @@ </div> </div> <div class="presentation">-<div class="titleslide slide">+<div class="title-slide slide">   <h1 class="title">My S5 Document</h1>   <h3 class="author">Sam Smith<br/>Jen Jones</h3>   <h4 class="date">July 15, 2006</h4>
test/test-pandoc.hs view
@@ -23,6 +23,7 @@ import qualified Tests.Writers.ConTeXt import qualified Tests.Writers.Docbook import qualified Tests.Writers.Docx+import qualified Tests.Writers.FB2 import qualified Tests.Writers.HTML import qualified Tests.Writers.LaTeX import qualified Tests.Writers.Markdown@@ -52,6 +53,7 @@           , testGroup "RST" Tests.Writers.RST.tests           , testGroup "TEI" Tests.Writers.TEI.tests           , testGroup "Muse" Tests.Writers.Muse.tests+          , testGroup "FB2" Tests.Writers.FB2.tests           ]         , testGroup "Readers"           [ testGroup "LaTeX" Tests.Readers.LaTeX.tests
test/writer.fb2 view
@@ -261,23 +261,23 @@ <p>Nested</p> </title> <p>• Tab</p>-<p>◦ Tab</p>-<p>* Tab</p>+<p>• • Tab</p>+<p>• • • Tab</p> <p>Here’s another:</p> <p>1. First</p> <p>2. Second:</p>-<p>   • Fee</p>-<p>   • Fie</p>-<p>   • Foe</p>+<p>2. • Fee</p>+<p>2. • Fie</p>+<p>2. • Foe</p> <p>3. Third</p> <p>Same thing but with paragraphs:</p> <p>1. First</p> <empty-line /> <p>2. Second:</p> <empty-line />-<p>   • Fee</p>-<p>   • Fie</p>-<p>   • Foe</p>+<p>2. • Fee</p>+<p>2. • Fie</p>+<p>2. • Foe</p> <p>3. Third</p> <empty-line /> </section>@@ -289,9 +289,9 @@ <empty-line /> <p>• this is a list item indented with spaces</p> <empty-line />-<p>◦ this is an example list item indented with tabs</p>+<p>• • this is an example list item indented with tabs</p> <empty-line />-<p>◦ this is an example list item indented with spaces</p>+<p>• • this is an example list item indented with spaces</p> <empty-line /> </section> <section>@@ -332,65 +332,62 @@ <p> <strong>apple</strong> </p>-<p>    red fruit<empty-line />-</p>+<p>    red fruit</p> <p> <strong>orange</strong> </p>-<p>    orange fruit<empty-line />-</p>+<p>    orange fruit</p> <p> <strong>banana</strong> </p>-<p>    yellow fruit<empty-line />-</p>+<p>    yellow fruit</p> <p>Tight using tabs:</p> <p> <strong>apple</strong> </p>-<p>    red fruit<empty-line />-</p>+<p>    red fruit</p> <p> <strong>orange</strong> </p>-<p>    orange fruit<empty-line />-</p>+<p>    orange fruit</p> <p> <strong>banana</strong> </p>-<p>    yellow fruit<empty-line />-</p>+<p>    yellow fruit</p> <p>Loose:</p> <p> <strong>apple</strong> </p>-<p>    red fruit<empty-line />-</p>+<p>    red fruit</p>+<empty-line /> <p> <strong>orange</strong> </p>-<p>    orange fruit<empty-line />-</p>+<p>    orange fruit</p>+<empty-line /> <p> <strong>banana</strong> </p>-<p>    yellow fruit<empty-line />-</p>+<p>    yellow fruit</p>+<empty-line /> <p>Multiple blocks with italics:</p> <p> <strong> <emphasis>apple</emphasis> </strong> </p>-<p>    red fruit<empty-line />    contains seeds, crisp, pleasant to taste<empty-line />-</p>+<p>    red fruit</p>+<empty-line />+<p>    contains seeds, crisp, pleasant to taste</p>+<empty-line /> <p> <strong> <emphasis>orange</emphasis> </strong> </p>-<p>    orange fruit<empty-line />+<p>    orange fruit</p> <empty-line />+<empty-line /> <p> <code>    { orange code block }</code> </p>@@ -398,42 +395,47 @@ <cite> <p>    orange block quote</p> </cite>-</p> <p>Multiple definitions, tight:</p> <p> <strong>apple</strong> </p>-<p>    red fruit<empty-line />    computer<empty-line />-</p>+<p>    red fruit</p>+<p>    computer</p> <p> <strong>orange</strong> </p>-<p>    orange fruit<empty-line />    bank<empty-line />-</p>+<p>    orange fruit</p>+<p>    bank</p> <p>Multiple definitions, loose:</p> <p> <strong>apple</strong> </p>-<p>    red fruit<empty-line />    computer<empty-line />-</p>+<p>    red fruit</p>+<empty-line />+<p>    computer</p>+<empty-line /> <p> <strong>orange</strong> </p>-<p>    orange fruit<empty-line />    bank<empty-line />-</p>+<p>    orange fruit</p>+<empty-line />+<p>    bank</p>+<empty-line /> <p>Blank line after term, indented marker, alternate markers:</p> <p> <strong>apple</strong> </p>-<p>    red fruit<empty-line />    computer<empty-line />-</p>+<p>    red fruit</p>+<empty-line />+<p>    computer</p>+<empty-line /> <p> <strong>orange</strong> </p>-<p>    orange fruit<empty-line />+<p>    orange fruit</p>+<empty-line /> <p>1. sublist</p> <p>2. sublist</p>-</p> </section> <section> <title>
test/writer.html4 view
@@ -524,25 +524,25 @@ <p>Here is a movie <img src="movie.jpg" alt="movie" /> icon.</p> <hr /> <h1 id="footnotes">Footnotes</h1>-<p>Here is a footnote reference,<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnoteRef" id="fnref3"><sup>3</sup></a></p>+<p>Here is a footnote reference,<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnote-ref" id="fnref3"><sup>3</sup></a></p> <blockquote>-<p>Notes can go in quotes.<a href="#fn4" class="footnoteRef" id="fnref4"><sup>4</sup></a></p>+<p>Notes can go in quotes.<a href="#fn4" class="footnote-ref" id="fnref4"><sup>4</sup></a></p> </blockquote> <ol style="list-style-type: decimal">-<li>And in list items.<a href="#fn5" class="footnoteRef" id="fnref5"><sup>5</sup></a></li>+<li>And in list items.<a href="#fn5" class="footnote-ref" id="fnref5"><sup>5</sup></a></li> </ol> <p>This paragraph should not be part of the note, as it is not indented.</p> <div class="footnotes"> <hr /> <ol>-<li id="fn1"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnoteBack">↩</a></p></li>+<li id="fn1"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnote-back">↩</a></p></li> <li id="fn2"><p>Here’s the long note. This one contains multiple blocks.</p> <p>Subsequent blocks are indented to show that they belong to the footnote (as with list items).</p> <pre><code>  { &lt;code&gt; }</code></pre>-<p>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.<a href="#fnref2" class="footnoteBack">↩</a></p></li>-<li id="fn3"><p>This is <em>easier</em> to type. Inline notes may contain <a href="http://google.com">links</a> and <code>]</code> verbatim characters, as well as [bracketed text].<a href="#fnref3" class="footnoteBack">↩</a></p></li>-<li id="fn4"><p>In quote.<a href="#fnref4" class="footnoteBack">↩</a></p></li>-<li id="fn5"><p>In list.<a href="#fnref5" class="footnoteBack">↩</a></p></li>+<p>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.<a href="#fnref2" class="footnote-back">↩</a></p></li>+<li id="fn3"><p>This is <em>easier</em> to type. Inline notes may contain <a href="http://google.com">links</a> and <code>]</code> verbatim characters, as well as [bracketed text].<a href="#fnref3" class="footnote-back">↩</a></p></li>+<li id="fn4"><p>In quote.<a href="#fnref4" class="footnote-back">↩</a></p></li>+<li id="fn5"><p>In list.<a href="#fnref5" class="footnote-back">↩</a></p></li> </ol> </div> </body>
test/writer.html5 view
@@ -526,25 +526,25 @@ <p>Here is a movie <img src="movie.jpg" alt="movie" /> icon.</p> <hr /> <h1 id="footnotes">Footnotes</h1>-<p>Here is a footnote reference,<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnoteRef" id="fnref3"><sup>3</sup></a></p>+<p>Here is a footnote reference,<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnote-ref" id="fnref3"><sup>3</sup></a></p> <blockquote>-<p>Notes can go in quotes.<a href="#fn4" class="footnoteRef" id="fnref4"><sup>4</sup></a></p>+<p>Notes can go in quotes.<a href="#fn4" class="footnote-ref" id="fnref4"><sup>4</sup></a></p> </blockquote> <ol type="1">-<li>And in list items.<a href="#fn5" class="footnoteRef" id="fnref5"><sup>5</sup></a></li>+<li>And in list items.<a href="#fn5" class="footnote-ref" id="fnref5"><sup>5</sup></a></li> </ol> <p>This paragraph should not be part of the note, as it is not indented.</p> <section class="footnotes"> <hr /> <ol>-<li id="fn1"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnoteBack">↩</a></p></li>+<li id="fn1"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnote-back">↩</a></p></li> <li id="fn2"><p>Here’s the long note. This one contains multiple blocks.</p> <p>Subsequent blocks are indented to show that they belong to the footnote (as with list items).</p> <pre><code>  { &lt;code&gt; }</code></pre>-<p>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.<a href="#fnref2" class="footnoteBack">↩</a></p></li>-<li id="fn3"><p>This is <em>easier</em> to type. Inline notes may contain <a href="http://google.com">links</a> and <code>]</code> verbatim characters, as well as [bracketed text].<a href="#fnref3" class="footnoteBack">↩</a></p></li>-<li id="fn4"><p>In quote.<a href="#fnref4" class="footnoteBack">↩</a></p></li>-<li id="fn5"><p>In list.<a href="#fnref5" class="footnoteBack">↩</a></p></li>+<p>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.<a href="#fnref2" class="footnote-back">↩</a></p></li>+<li id="fn3"><p>This is <em>easier</em> to type. Inline notes may contain <a href="http://google.com">links</a> and <code>]</code> verbatim characters, as well as [bracketed text].<a href="#fnref3" class="footnote-back">↩</a></p></li>+<li id="fn4"><p>In quote.<a href="#fnref4" class="footnote-back">↩</a></p></li>+<li id="fn5"><p>In list.<a href="#fnref5" class="footnote-back">↩</a></p></li> </ol> </section> </body>
test/writer.jats view
@@ -14,6 +14,18 @@ <title-group> <article-title>Pandoc Test Suite</article-title> </title-group>+<contrib-group>+<contrib contrib-type="author">+<name>+<string-name>John MacFarlane</string-name>+</name>+</contrib>+<contrib contrib-type="author">+<name>+<string-name>Anonymous</string-name>+</name>+</contrib>+</contrib-group> <pub-date pub-type="epub"> <string-date>July 17, 2006</string-date> </pub-date>