From 6ea706256de67c5480b300b0063729ae8f459c4c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 2 Jun 2018 21:37:15 -0700 Subject: Support --number-sections in RST output... via the "section-numbering" directive in standalone output. --- data/templates/default.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'data') diff --git a/data/templates/default.rst b/data/templates/default.rst index e9c0dc203..937eb72ae 100644 --- a/data/templates/default.rst +++ b/data/templates/default.rst @@ -30,6 +30,10 @@ $if(toc)$ :depth: $toc-depth$ .. +$endif$ +$if(number-sections)$ +.. section-numbering:: + $endif$ $for(header-includes)$ $header-includes$ -- cgit v1.2.3 From 9b3d14b6eff7c7f46be9a26497091b4087c772e8 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Sat, 9 Jun 2018 06:15:36 +0800 Subject: pandoc.lua: fix a typo (#4692) --- data/pandoc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data') diff --git a/data/pandoc.lua b/data/pandoc.lua index 512b2919c..faebd27f9 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -124,7 +124,7 @@ Type.behavior = { Type.behavior.__index = Type.behavior --- Set a new behavior for the type, inheriting that of the parent type if none ---- is specified explicitely +--- is specified explicitly -- @param behavior the behavior object for this type. -- @local function Type:set_behavior (behavior) -- cgit v1.2.3 From 417346068989d6b5bdca3620dcb95cbe4e7d8bbf Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 Jun 2018 09:35:27 -0700 Subject: reveal.js writer and template: reuse mathjax URL... ...provided by the argument to `--mathjax` or the normal pandoc default, rather than a hard-coded one in the template. Closes #4701. --- data/templates/default.revealjs | 2 +- src/Text/Pandoc/Writers/HTML.hs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'data') diff --git a/data/templates/default.revealjs b/data/templates/default.revealjs index 6f847e23a..68723efa6 100644 --- a/data/templates/default.revealjs +++ b/data/templates/default.revealjs @@ -237,7 +237,7 @@ $if(maxScale)$ $endif$ $if(mathjax)$ math: { - mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js', + mathjax: '$mathjaxurl$', config: 'TeX-AMS_HTML-full', tex2jax: { inlineMath: [['\\(','\\)']], diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index a09ad2fda..f07d0381f 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -259,7 +259,7 @@ pandocToHtml opts (Pandoc meta blocks) = do st <- get notes <- footnoteSection opts (reverse (stNotes st)) let thebody = blocks' >> notes - let math = case writerHTMLMathMethod opts of + let math = case writerHTMLMathMethod opts of MathJax url | slideVariant /= RevealJsSlides -> -- mathjax is handled via a special plugin in revealjs @@ -296,10 +296,11 @@ pandocToHtml opts (Pandoc meta blocks) = do (if stMath st then defField "math" (renderHtml' math) else id) $ - defField "mathjax" - (case writerHTMLMathMethod opts of - MathJax _ -> True - _ -> False) $ + (case writerHTMLMathMethod opts of + MathJax u -> defField "mathjax" True . + defField "mathjaxurl" + (takeWhile (/='?') u) + _ -> defField "mathjax" False) $ defField "quotes" (stQuotes st) $ -- for backwards compatibility we populate toc -- with the contents of the toc, rather than a -- cgit v1.2.3 From ebf4ed89440d459684e2becad06a34ac3cdba7d5 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 25 Jun 2018 03:14:04 +0300 Subject: Texinfo writer: use @sup and @sub instead of custom macros Fixes #4728 --- data/templates/default.texinfo | 22 ---------------------- src/Text/Pandoc/Writers/Texinfo.hs | 13 +++---------- test/writer.texinfo | 24 ++---------------------- 3 files changed, 5 insertions(+), 54 deletions(-) (limited to 'data') diff --git a/data/templates/default.texinfo b/data/templates/default.texinfo index 458d4fdda..693827810 100644 --- a/data/templates/default.texinfo +++ b/data/templates/default.texinfo @@ -9,28 +9,6 @@ $if(strikeout)$ ~~\text\~~ @end macro -$endif$ -$if(subscript)$ -@macro textsubscript{text} -@iftex -@textsubscript{\text\} -@end iftex -@ifnottex -_@{\text\@} -@end ifnottex -@end macro - -$endif$ -$if(superscript)$ -@macro textsuperscript{text} -@iftex -@textsuperscript{\text\} -@end iftex -@ifnottex -^@{\text\@} -@end ifnottex -@end macro - $endif$ @ifnottex @paragraphindent 0 diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs index 305b41206..9c73eb9ca 100644 --- a/src/Text/Pandoc/Writers/Texinfo.hs +++ b/src/Text/Pandoc/Writers/Texinfo.hs @@ -56,8 +56,6 @@ import Text.Printf (printf) data WriterState = WriterState { stStrikeout :: Bool -- document contains strikeout - , stSuperscript :: Bool -- document contains superscript - , stSubscript :: Bool -- document contains subscript , stEscapeComma :: Bool -- in a context where we need @comma , stIdentifiers :: Set.Set String -- header ids used already , stOptions :: WriterOptions -- writer options @@ -74,8 +72,7 @@ type TI m = StateT WriterState m writeTexinfo :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeTexinfo options document = evalStateT (pandocToTexinfo options $ wrapTop document) - WriterState { stStrikeout = False, stSuperscript = False, - stEscapeComma = False, stSubscript = False, + WriterState { stStrikeout = False, stEscapeComma = False, stIdentifiers = Set.empty, stOptions = options} -- | Add a "Top" node around the document, needed by Texinfo. @@ -102,8 +99,6 @@ pandocToTexinfo options (Pandoc meta blocks) = do let context = defField "body" body $ defField "toc" (writerTableOfContents options) $ defField "titlepage" titlePage - $ defField "subscript" (stSubscript st) - $ defField "superscript" (stSuperscript st) $ defField "strikeout" (stStrikeout st) metadata case writerTemplate options of @@ -427,14 +422,12 @@ inlineToTexinfo (Strikeout lst) = do return $ text "@textstrikeout{" <> contents <> text "}" inlineToTexinfo (Superscript lst) = do - modify $ \st -> st{ stSuperscript = True } contents <- inlineListToTexinfo lst - return $ text "@textsuperscript{" <> contents <> char '}' + return $ text "@sup{" <> contents <> char '}' inlineToTexinfo (Subscript lst) = do - modify $ \st -> st{ stSubscript = True } contents <- inlineListToTexinfo lst - return $ text "@textsubscript{" <> contents <> char '}' + return $ text "@sub{" <> contents <> char '}' inlineToTexinfo (SmallCaps lst) = inlineListToTexinfo lst >>= return . inCmd "sc" diff --git a/test/writer.texinfo b/test/writer.texinfo index f5727d96d..ebc0447ee 100644 --- a/test/writer.texinfo +++ b/test/writer.texinfo @@ -5,24 +5,6 @@ ~~\text\~~ @end macro -@macro textsubscript{text} -@iftex -@textsubscript{\text\} -@end iftex -@ifnottex -_@{\text\@} -@end ifnottex -@end macro - -@macro textsuperscript{text} -@iftex -@textsuperscript{\text\} -@end iftex -@ifnottex -^@{\text\@} -@end ifnottex -@end macro - @ifnottex @paragraphindent 0 @end ifnottex @@ -738,11 +720,9 @@ This is code: @code{>}, @code{$}, @code{\}, @code{\$}, @code{}. @textstrikeout{This is @emph{strikeout}.} -Superscripts: a@textsuperscript{bc}d a@textsuperscript{@emph{hello}} -a@textsuperscript{hello@ there}. +Superscripts: a@sup{bc}d a@sup{@emph{hello}} a@sup{hello@ there}. -Subscripts: H@textsubscript{2}O, H@textsubscript{23}O, -H@textsubscript{many@ of@ them}O. +Subscripts: H@sub{2}O, H@sub{23}O, H@sub{many@ of@ them}O. These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d. -- cgit v1.2.3 From e56a1a3088f3761561ac198dddf1fb6bc7d662ca Mon Sep 17 00:00:00 2001 From: lux-lth Date: Thu, 12 Jul 2018 19:31:38 +0200 Subject: Translations/fr (#4766) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Edited FR translation, Cc (Carbon Copy) translates to 'Copie carbone' : Cc * Edited FR translation, 'Chapter' translates 'Chapitre' (typo) * Edited FR translation, 'Figure' translates to 'Figure' * Edited FR translation, 'Glossary' translates to 'Glossaire' * Edited FR translation, 'to' translates to 'à' * Edited FR translation, first letter to uppercase * Edited FR translation, 'Table' translates to 'Tableau' --- data/translations/fr.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'data') diff --git a/data/translations/fr.yaml b/data/translations/fr.yaml index 4b75da6f4..b0e6dc311 100644 --- a/data/translations/fr.yaml +++ b/data/translations/fr.yaml @@ -1,20 +1,20 @@ Abstract: Résumé Appendix: Annexe Bibliography: Bibliographie -Cc: Copie à -Chapter: Chaptire +Cc: Cc +Chapter: Chapitre Contents: Table des matières -Figure: Fig. -Glossary: +Figure: Figure +Glossary: Glossaire Index: Index ListOfFigures: Table des figures ListOfTables: Liste des tableaux -Page: page -Part: partie +Page: Page +Part: Partie Preface: Préface Proof: Démonstration References: Références -See: voir -SeeAlso: voir aussi -Table: Tab. -To: +See: Voir +SeeAlso: Voir aussi +Table: Tableau +To: À -- cgit v1.2.3 From 3efcf2c95a5734fe9bbac0b9169625ca2e0f6cf2 Mon Sep 17 00:00:00 2001 From: Igor Khorlo Date: Thu, 19 Jul 2018 04:26:16 +0200 Subject: Add missing rollingLinks option to revealjs template (#4778) Fix (add) the missing option 'rollingLinks' in reveal.js template. --- data/templates/default.revealjs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'data') diff --git a/data/templates/default.revealjs b/data/templates/default.revealjs index 68723efa6..2c6b8e2ff 100644 --- a/data/templates/default.revealjs +++ b/data/templates/default.revealjs @@ -170,6 +170,10 @@ $if(mouseWheel)$ // Enable slide navigation via mouse wheel mouseWheel: $mouseWheel$, $endif$ +$if(rollingLinks)$ + // Apply a 3D roll to links on hover + rollingLinks: $rollingLinks$, +$endif$ $if(hideAddressBar)$ // Hides the address bar on mobile devices hideAddressBar: $hideAddressBar$, -- cgit v1.2.3 From 748aa920f6cdbe5c7f828a706a048eda8340abc7 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 21 Jul 2018 22:05:21 -0700 Subject: Moved some beamer code in default.latex template. This change allows beamer themes to change the template and font (as Metropolis does). Closes #4450. --- data/templates/default.latex | 72 +++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 37 deletions(-) (limited to 'data') diff --git a/data/templates/default.latex b/data/templates/default.latex index 31093374f..4d1eeb56a 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -20,6 +20,41 @@ $endif$ $for(beameroption)$ \setbeameroption{$beameroption$} $endfor$ +% Prevent slide breaks in the middle of a paragraph: +\widowpenalties 1 10000 +\raggedbottom +$if(section-titles)$ +\setbeamertemplate{part page}{ +\centering +\begin{beamercolorbox}[sep=16pt,center]{part title} + \usebeamerfont{part title}\insertpart\par +\end{beamercolorbox} +} +\setbeamertemplate{section page}{ +\centering +\begin{beamercolorbox}[sep=12pt,center]{part title} + \usebeamerfont{section title}\insertsection\par +\end{beamercolorbox} +} +\setbeamertemplate{subsection page}{ +\centering +\begin{beamercolorbox}[sep=8pt,center]{part title} + \usebeamerfont{subsection title}\insertsubsection\par +\end{beamercolorbox} +} +\AtBeginPart{ + \frame{\partpage} +} +\AtBeginSection{ + \ifbibliography + \else + \frame{\sectionpage} + \fi +} +\AtBeginSubsection{ + \frame{\subsectionpage} +} +$endif$ $endif$ $if(beamerarticle)$ \usepackage{beamerarticle} % needs to be loaded first @@ -198,43 +233,6 @@ $if(graphics)$ % using explicit options in \includegraphics[width, height, ...]{} \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} $endif$ -$if(beamer)$ -% Prevent slide breaks in the middle of a paragraph: -\widowpenalties 1 10000 -\raggedbottom -$if(section-titles)$ -\setbeamertemplate{part page}{ -\centering -\begin{beamercolorbox}[sep=16pt,center]{part title} - \usebeamerfont{part title}\insertpart\par -\end{beamercolorbox} -} -\setbeamertemplate{section page}{ -\centering -\begin{beamercolorbox}[sep=12pt,center]{part title} - \usebeamerfont{section title}\insertsection\par -\end{beamercolorbox} -} -\setbeamertemplate{subsection page}{ -\centering -\begin{beamercolorbox}[sep=8pt,center]{part title} - \usebeamerfont{subsection title}\insertsubsection\par -\end{beamercolorbox} -} -\AtBeginPart{ - \frame{\partpage} -} -\AtBeginSection{ - \ifbibliography - \else - \frame{\sectionpage} - \fi -} -\AtBeginSubsection{ - \frame{\subsectionpage} -} -$endif$ -$endif$ $if(links-as-notes)$ % Make links footnotes instead of hotlinks: \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} -- cgit v1.2.3 From 2661658a696ebaab14b2792b7bbd38ef2b5904e4 Mon Sep 17 00:00:00 2001 From: Francesco Occhipinti Date: Wed, 1 Aug 2018 21:32:16 +0200 Subject: RST writer: use `titleblock` instead of `title` variable for title block Closes #4803 After this commit use `$titleblock$` in order to get what was contained in `$title$` before, that is a title and subtitle rendered according to the official rST method: http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle. from With this commit, the `$title$` and `$subtitle$` metadata are available and they simply carry the metadata values. This opens up more possibilities in templates. --- data/templates/default.rst | 4 ++-- src/Text/Pandoc/Writers/RST.hs | 9 +++++---- test/Tests/Writers/RST.hs | 8 ++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'data') diff --git a/data/templates/default.rst b/data/templates/default.rst index 937eb72ae..9ba15f546 100644 --- a/data/templates/default.rst +++ b/data/templates/default.rst @@ -1,5 +1,5 @@ -$if(title)$ -$title$ +$if(titleblock)$ +$titleblock$ $endif$ $for(author)$ diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 817fb665d..0c118669b 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -83,13 +83,14 @@ pandocToRST (Pandoc meta blocks) = do let render' :: Doc -> Text render' = render colwidth let subtit = case lookupMeta "subtitle" meta of - Just (MetaBlocks [Plain xs]) -> xs - _ -> [] + Just (MetaBlocks [Plain xs]) -> xs + Just (MetaInlines xs) -> xs + _ -> [] title <- titleToRST (docTitle meta) subtit metadata <- metaToJSON opts (fmap render' . blockListToRST) (fmap (stripEnd . render') . inlineListToRST) - $ B.deleteMeta "title" $ B.deleteMeta "subtitle" meta + meta body <- blockListToRST' True $ case writerTemplate opts of Just _ -> normalizeHeadings 1 blocks Nothing -> blocks @@ -105,7 +106,7 @@ pandocToRST (Pandoc meta blocks) = do $ defField "toc-depth" (show $ writerTOCDepth opts) $ defField "number-sections" (writerNumberSections opts) $ defField "math" hasMath - $ defField "title" (render Nothing title :: String) + $ defField "titleblock" (render Nothing title :: String) $ defField "math" hasMath $ defField "rawtex" rawTeX metadata case writerTemplate opts of diff --git a/test/Tests/Writers/RST.hs b/test/Tests/Writers/RST.hs index a1a4510e0..0d5b7c38a 100644 --- a/test/Tests/Writers/RST.hs +++ b/test/Tests/Writers/RST.hs @@ -16,6 +16,11 @@ infix 4 =: => String -> (a, String) -> TestTree (=:) = test (purely (writeRST def . toPandoc)) +testTemplate :: (ToString a, ToString c, ToPandoc a) => + String -> String -> (a, c) -> TestTree +testTemplate t = + test (purely (writeRST def{ writerTemplate = Just t }) . toPandoc) + tests :: [TestTree] tests = [ testGroup "rubrics" [ "in list item" =: @@ -156,4 +161,7 @@ tests = [ testGroup "rubrics" , "Header 2" , "--------"] ] + , testTemplate "$subtitle$\n" "subtitle" $ + (setMeta "subtitle" ("subtitle" :: Inlines) $ doc $ plain "") =?> + ("subtitle" :: String) ] -- cgit v1.2.3 From 2ae82727546c1a989148b0ca34ae35fd2158cee6 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Wed, 15 Aug 2018 18:58:17 +0200 Subject: Support "toc-title" in the beamer template. (#4835) It is a bit awkward to have a title for every frame, but not for the one that holds the table of contents. Allow users to specify a title if they wish. --- MANUAL.txt | 2 +- data/templates/default.latex | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/MANUAL.txt b/MANUAL.txt index 4db1679d4..3e0e92452 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1352,7 +1352,7 @@ depending on the output format, but include the following: `toc-title` : title of table of contents (works only with EPUB, - opendocument, odt, docx, pptx) + opendocument, odt, docx, pptx, beamer) `include-before` : contents specified by `-B/--include-before-body` (may have diff --git a/data/templates/default.latex b/data/templates/default.latex index 4d1eeb56a..795b6c868 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -361,6 +361,9 @@ $endfor$ $if(toc)$ $if(beamer)$ \begin{frame} +$if(toc-title)$ +\frametitle{$toc-title$} +$endif$ \tableofcontents[hideallsubsections] \end{frame} $else$ -- cgit v1.2.3 From fe312b0a7a0e63e307162da47dc9f1ca8f47737f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 16 Aug 2018 20:48:51 -0700 Subject: LaTeX writer/template: be sensitive to `filecolor` variable. `linkcolor` only affects internal links, and `urlcolor` only affects linked URLs. For external links, the option to use is `filecolor`. Closes #4822. --- MANUAL.txt | 14 ++++++++------ data/templates/default.latex | 1 + src/Text/Pandoc/Writers/LaTeX.hs | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'data') diff --git a/MANUAL.txt b/MANUAL.txt index 3e0e92452..7ba9e188e 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1526,12 +1526,14 @@ LaTeX variables are used when [creating a PDF]. : options to pass to the microtype package `colorlinks` -: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`, - `urlcolor`, or `toccolor` are set - -`linkcolor`, `citecolor`, `urlcolor`, `toccolor` -: color for internal links, citation links, external links, and links in table of contents: - uses options allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and `x11names` lists +: add color to link text; automatically enabled if any of + `linkcolor`, `filecolor`, `citecolor`, `urlcolor`, or `toccolor` are set + +`linkcolor`, `filecolor`, `citecolor`, `urlcolor`, `toccolor` +: color for internal links, external links, citation links, linked + URLs, and links in table of contents, respectively: uses options + allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and + `x11names` lists `links-as-notes` : causes links to be printed as footnotes diff --git a/data/templates/default.latex b/data/templates/default.latex index 795b6c868..c2e32e006 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -183,6 +183,7 @@ $endif$ $if(colorlinks)$ colorlinks=true, linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$, + filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$, citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$, urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$, $else$ diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index a3be5ecb7..3db643503 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -248,7 +248,8 @@ pandocToLaTeX options (Pandoc meta blocks) = do defField "biblatex" True _ -> id) $ defField "colorlinks" (any hasStringValue - ["citecolor", "urlcolor", "linkcolor", "toccolor"]) $ + ["citecolor", "urlcolor", "linkcolor", "toccolor", + "filecolor"]) $ (if null dirs then id else defField "dir" ("ltr" :: String)) $ -- cgit v1.2.3 From 0910e9218728c85feb562745ed5eb44d586e824d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 16 Aug 2018 21:06:49 -0700 Subject: TEI improvements. - Ensure that title element is always present, even if empty. - Put author tags in the template, rather than adding them in the writer. Closes #4839. --- data/templates/default.tei | 4 +--- src/Text/Pandoc/Writers/TEI.hs | 15 +-------------- 2 files changed, 2 insertions(+), 17 deletions(-) (limited to 'data') diff --git a/data/templates/default.tei b/data/templates/default.tei index 3778dccd5..824c9f0e7 100644 --- a/data/templates/default.tei +++ b/data/templates/default.tei @@ -3,11 +3,9 @@ -$if(title)$ $title$ -$endif$ $for(author)$ - $author$ + $author$ $endfor$ diff --git a/src/Text/Pandoc/Writers/TEI.hs b/src/Text/Pandoc/Writers/TEI.hs index e461f5715..9169c8515 100644 --- a/src/Text/Pandoc/Writers/TEI.hs +++ b/src/Text/Pandoc/Writers/TEI.hs @@ -35,7 +35,6 @@ import Prelude import Data.Char (toLower) import Data.List (isPrefixOf, stripPrefix) 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) @@ -48,16 +47,6 @@ import Text.Pandoc.Templates (renderTemplate') import Text.Pandoc.Writers.Shared import Text.Pandoc.XML --- | Convert list of authors to a docbook section -authorToTEI :: PandocMonad m => WriterOptions -> [Inline] -> m B.Inlines -authorToTEI opts name' = do - name <- render Nothing <$> inlinesToTEI opts name' - let colwidth = if writerWrapText opts == WrapAuto - then Just $ writerColumns opts - else Nothing - return $ B.rawInline "tei" $ render colwidth $ - inTagsSimple "author" (text $ escapeStringForXML name) - -- | Convert Pandoc document to string in Docbook format. writeTEI :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeTEI opts (Pandoc meta blocks) = do @@ -72,13 +61,11 @@ writeTEI opts (Pandoc meta blocks) = do TopLevelChapter -> 0 TopLevelSection -> 1 TopLevelDefault -> 1 - auths' <- mapM (authorToTEI opts) $ docAuthors meta - let meta' = B.setMeta "author" auths' meta metadata <- metaToJSON opts (fmap (render' . vcat) . mapM (elementToTEI opts startLvl) . hierarchicalize) (fmap render' . inlinesToTEI opts) - meta' + meta main <- (render' . vcat) <$> mapM (elementToTEI opts startLvl) elements let context = defField "body" main $ -- cgit v1.2.3 From 2bc352f30523cceda9c6f25a6ec0f0169254824d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 16 Aug 2018 21:19:03 -0700 Subject: TEI template: improve publicationStmt. Add support for publisher, address, pubPlace, and date variables. --- data/templates/default.tei | 16 +++++++++++++++- test/writer.tei | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'data') diff --git a/data/templates/default.tei b/data/templates/default.tei index 824c9f0e7..757347886 100644 --- a/data/templates/default.tei +++ b/data/templates/default.tei @@ -9,9 +9,23 @@ $for(author)$ $endfor$ +$if(publicationStmt)$

$if(publicationStmt)$$publicationStmt$$endif$

- $if(license)$ +$endif$ +$if(license)$ $license$ +$endif$ +$if(publisher)$ + $publisher$ +$endif$ +$if(pubPlace)$ + $pubPlace$ +$endif$ +$if(address)$ +
$address$
+$endif$ +$if(date)$ + $date$ $endif$
diff --git a/test/writer.tei b/test/writer.tei index 779aa337b..587a6fcca 100644 --- a/test/writer.tei +++ b/test/writer.tei @@ -8,8 +8,8 @@ Anonymous -

-
+ July 17, 2006 +

Produced by pandoc.

-- cgit v1.2.3 From dac85d683feb6f9f7e12b9273f353a1291171cd1 Mon Sep 17 00:00:00 2001 From: Wandmalfarbe Date: Sat, 25 Aug 2018 18:55:17 +0200 Subject: Add support for $toc-title$ to LaTeX (and PDF). (#4853) --- MANUAL.txt | 2 +- data/templates/default.latex | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/MANUAL.txt b/MANUAL.txt index 4c68bfa86..0fb959fad 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1352,7 +1352,7 @@ depending on the output format, but include the following: `toc-title` : title of table of contents (works only with EPUB, - opendocument, odt, docx, pptx, beamer) + opendocument, odt, docx, pptx, beamer, LaTeX) `include-before` : contents specified by `-B/--include-before-body` (may have diff --git a/data/templates/default.latex b/data/templates/default.latex index c2e32e006..23e47e6ce 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -360,6 +360,9 @@ $include-before$ $endfor$ $if(toc)$ +$if(toc-title)$ +\renewcommand*\contentsname{$toc-title$} +$endif$ $if(beamer)$ \begin{frame} $if(toc-title)$ -- cgit v1.2.3 From 7318bc91ce58bb6c39e556e334f278e590439c3f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 28 Aug 2018 12:34:49 -0700 Subject: EPUB writer: set epub:type on body element intelligently. epub:type of first section epub:type of body -------------------------- ------------------ prologue frontmatter abstract frontmatter acknowledgments frontmatter copyright-page frontmatter dedication frontmatter foreword frontmatter halftitle, frontmatter introduction frontmatter preface frontmatter seriespage frontmatter titlepage frontmatter afterword backmatter appendix backmatter colophon backmatter conclusion backmatter epigraph backmatter Otherwise body will have epub:type 'bodymatter'. This only affects epub3. See http://www.idpf.org/epub/profiles/edu/structure/#h.l0bzsloklt10 Closes #4823. --- data/templates/default.epub3 | 2 +- src/Text/Pandoc/Writers/EPUB.hs | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'data') diff --git a/data/templates/default.epub3 b/data/templates/default.epub3 index b22714963..6428e984c 100644 --- a/data/templates/default.epub3 +++ b/data/templates/default.epub3 @@ -26,7 +26,7 @@ $for(header-includes)$ $header-includes$ $endfor$ - + $if(titlepage)$
$for(title)$ diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 3c6ab69b9..4c5e73d81 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -461,6 +461,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do -- title page tpContent <- lift $ writeHtml opts'{ writerVariables = ("titlepage","true"): + ("body-type", "frontmatter"): ("pagetitle", escapeStringForXML plainTitle): cssvars True ++ vars } (Pandoc meta []) @@ -565,13 +566,28 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do let chapToEntry num (Chapter mbnum bs) = mkEntry ("text/" ++ showChapter num) =<< writeHtml opts'{ writerNumberOffset = fromMaybe [] mbnum - , writerVariables = cssvars True ++ vars } - (case bs of - (Header _ _ xs : _) -> + , writerVariables = ("body-type", bodyType) : + cssvars True ++ vars } pdoc + where (pdoc, bodyType) = + case bs of + (Header _ (_,_,kvs) xs : _) -> -- remove notes or we get doubled footnotes - Pandoc (setMeta "title" (walk removeNote $ fromList xs) - nullMeta) bs - _ -> Pandoc nullMeta bs) + (Pandoc (setMeta "title" + (walk removeNote $ fromList xs) nullMeta) bs, + case lookup "epub:type" kvs of + Nothing -> "bodymatter" + Just x + | x `elem` frontMatterTypes -> "frontmatter" + | x `elem` backMatterTypes -> "backmatter" + | otherwise -> "bodymatter") + _ -> (Pandoc nullMeta bs, "bodymatter") + frontMatterTypes = ["prologue", "abstract", "acknowledgments", + "copyright-page", "dedication", + "foreword", "halftitle", + "introduction", "preface", + "seriespage", "titlepage"] + backMatterTypes = ["afterword", "appendix", "colophon", + "conclusion", "epigraph"] chapterEntries <- zipWithM chapToEntry [1..] chapters -- cgit v1.2.3 From 70d0ae135e14bd3a47d271b4f8ee6ed7d50528a7 Mon Sep 17 00:00:00 2001 From: José de Mattos Neto <35090091+jzeneto@users.noreply.github.com> Date: Tue, 4 Sep 2018 13:48:39 -0300 Subject: Remove unnecessary indenting of TOC title (#4869) Fixes #4798 --- data/templates/default.opendocument | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'data') diff --git a/data/templates/default.opendocument b/data/templates/default.opendocument index e0bc5c1d3..cc7d33002 100644 --- a/data/templates/default.opendocument +++ b/data/templates/default.opendocument @@ -26,9 +26,7 @@ $endfor$ $if(toc)$ - - $toc-title$ - + $toc-title$ -- cgit v1.2.3 From 7b52d43877d0351dcf0fd645127867a43978bc08 Mon Sep 17 00:00:00 2001 From: "J. B. Rainsberger" Date: Mon, 10 Sep 2018 13:45:11 -0230 Subject: Make HTML5 header easier to style precisely in default template (#4767) Add the `title-block-header` identifier to the `header` element, to make it easier to style precisely. --- data/templates/default.html5 | 2 +- test/writer.html5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'data') diff --git a/data/templates/default.html5 b/data/templates/default.html5 index 9c15107c0..c2bf0e093 100644 --- a/data/templates/default.html5 +++ b/data/templates/default.html5 @@ -46,7 +46,7 @@ $for(include-before)$ $include-before$ $endfor$ $if(title)$ -
+

$title$

$if(subtitle)$

$subtitle$

diff --git a/test/writer.html5 b/test/writer.html5 index 53fcb84e2..4f80231db 100644 --- a/test/writer.html5 +++ b/test/writer.html5 @@ -19,7 +19,7 @@ -
+

Pandoc Test Suite

John MacFarlane

Anonymous

-- cgit v1.2.3 From 9f4406023f8e400ea3cc4063b3a7b3215d7e8b9c Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Sat, 22 Sep 2018 22:21:56 +0300 Subject: Translations/ru MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I suppose that you copy-pasted the Russian translations from babel[1] package. Actually, it has two versions — `captionsrussian@ancient` and `captionsrussian@modern`, the former contains translations for the pre-revolution (1918) orthography. [1]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/babel-contrib/russian/russianb.ldf --- data/translations/ru.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'data') diff --git a/data/translations/ru.yaml b/data/translations/ru.yaml index 6012c3e19..0bcbea62b 100644 --- a/data/translations/ru.yaml +++ b/data/translations/ru.yaml @@ -1,20 +1,20 @@ -Abstract: Аннотація -Appendix: Приложеніе +Abstract: Аннотация +Appendix: Приложение Author: Именной указатель -Bibliography: Библіографія +Bibliography: Литература Cc: исх. Chapter: Глава -Contents: Оглавленіе +Contents: Оглавление Encl: вкл. Figure: Рис. -Index: Предмѣтный указатель -ListOfFigures: Списокъ иллюстрацій -ListOfTables: Списокъ таблицъ +Index: Предметный указатель +ListOfFigures: Список иллюстраций +ListOfTables: Список таблиц Page: с. Part: Часть -Preface: Предисловіе +Preface: Предисловие Proof: Доказательство -References: Примѣчанія +References: Список литературы See: см. SeeAlso: см. также Table: Таблица -- cgit v1.2.3 From 537d917988d39401d855de003a06728711c81632 Mon Sep 17 00:00:00 2001 From: Mathias Walter Date: Thu, 4 Oct 2018 21:22:22 +0200 Subject: LaTeX template: add variable hyperrefoptions(#4925) Introduce a new variable `hyperrefoptions` to pass to the hyperref package. This allows us (for example) to specify `hyperrefoptions: linktoc=all` in a YAML block. --- data/templates/default.latex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data') diff --git a/data/templates/default.latex b/data/templates/default.latex index 23e47e6ce..e64b216eb 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -1,4 +1,4 @@ -\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere +\PassOptionsToPackage{unicode=true$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} % options for packages loaded elsewhere \PassOptionsToPackage{hyphens}{url} $if(colorlinks)$ \PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor} -- cgit v1.2.3 From 05efa5a0e658e9ed83e4149737fdbca2758666ad Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sat, 6 Oct 2018 21:44:20 +0200 Subject: Lua filter doc: fix description of Code.text --- data/pandoc.lua | 2 +- doc/lua-filters.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'data') diff --git a/data/pandoc.lua b/data/pandoc.lua index faebd27f9..54370bd1b 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -487,7 +487,7 @@ M.Cite = M.Inline:create_constructor( --- Creates a Code inline element -- @function Code --- @tparam string text brief image description +-- @tparam string text code string -- @tparam[opt] Attr attr additional attributes -- @treturn Inline code element M.Code = M.Inline:create_constructor( diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 9604997df..917b9cc16 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -953,7 +953,7 @@ Lua functions for pandoc scripts. Parameters: `text`: - : brief image description + : code string `attr`: : additional attributes -- cgit v1.2.3