diff -Nru haskell-blogliterately-0.8.4.3/BlogLiterately.cabal haskell-blogliterately-0.8.6.1/BlogLiterately.cabal --- haskell-blogliterately-0.8.4.3/BlogLiterately.cabal 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/BlogLiterately.cabal 2018-01-31 15:34:50.000000000 +0000 @@ -1,5 +1,5 @@ Name: BlogLiterately -Version: 0.8.4.3 +Version: 0.8.6.1 Synopsis: A tool for posting Haskelly articles to blogs Description: Write blog posts in Markdown format, then use BlogLiterately to do syntax highlighting, format ghci sessions, and upload @@ -26,7 +26,7 @@ Maintainer: Brent Yorgey Stability: experimental Build-Type: Simple -Tested-With: GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.1 +Tested-With: GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.2, GHC ==8.2.1 Extra-Source-Files: CHANGES.md README.markdown doc/BlogLiteratelyDoc.lhs @@ -39,7 +39,7 @@ location: git://github.com/byorgey/BlogLiterately.git Library - Build-Depends: base >= 4.0 && < 4.10, + Build-Depends: base >= 4.0 && < 4.11, process, filepath, directory, @@ -47,6 +47,7 @@ containers, bool-extras, mtl, + text >= 1.2 && < 1.3, temporary >= 1.1 && < 1.3, strict >= 0.3 && < 0.4, split >= 0.1.4 && < 0.3, @@ -54,15 +55,15 @@ parsec >= 3 && < 3.2, HaXml >= 1.22 && < 1.26, hscolour >= 1.20 && < 1.25, - blaze-html >= 0.5 && < 0.9, + blaze-html >= 0.5 && < 0.10, cmdargs >= 0.9.5 && < 0.11, haxr >= 3000.11 && < 3000.12, - pandoc >= 1.19 && < 1.20, - pandoc-types >= 1.16 && < 1.18, - pandoc-citeproc >= 0.1.2 && < 0.11, + pandoc >= 2.0 && < 2.2, + pandoc-types >= 1.16 && < 1.20, + pandoc-citeproc >= 0.1.2 && < 0.15, highlighting-kate >= 0.5 && < 0.7, data-default >= 0.5 && < 0.8, - lens >= 3.8 && < 4.16, + lens >= 3.8 && < 4.17, tagsoup >= 0.13.4 && < 0.15, HTTP >= 4000.3 && < 4000.4 Exposed-modules: Text.BlogLiterately diff -Nru haskell-blogliterately-0.8.4.3/CHANGES.md haskell-blogliterately-0.8.6.1/CHANGES.md --- haskell-blogliterately-0.8.4.3/CHANGES.md 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/CHANGES.md 2018-01-31 15:34:50.000000000 +0000 @@ -1,3 +1,24 @@ +0.8.6.1 (31 January 2018) +------------------------- + + - bug fix: a lot of options got turned off by default in pandoc 2.x! + Restore default pandoc Markdown parsing options. This bug means + that 0.8.5 and 0.8.6 did not parse various things correctly such + as LaTeX math, citations, and YAML header blocks. + +0.8.6 (31 January 2018) +----------------------- + + - allow `lens-4.16` + - allow `pandoc-citeproc-0.14` + - new `rawlatex` option for passing LaTeX code through unchanged + +0.8.5 (10 January 2018) +----------------------- + + - update to work with `pandoc-2.x`. No longer builds with + `pandoc-1.x`. + 0.8.4.3 (3 December 2016) ------------------------- diff -Nru haskell-blogliterately-0.8.4.3/debian/changelog haskell-blogliterately-0.8.6.1/debian/changelog --- haskell-blogliterately-0.8.4.3/debian/changelog 2018-05-17 04:04:52.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/debian/changelog 2018-04-09 19:23:14.000000000 +0000 @@ -1,38 +1,13 @@ -haskell-blogliterately (0.8.4.3-2build6) cosmic; urgency=medium +haskell-blogliterately (0.8.6.1-1) unstable; urgency=medium - * No-change rebuild against libbibutils6 + [ Ilias Tsitsimpis ] + * Use salsa.debian.org URLs in Vcs-{Browser,Git} fields - -- Steve Langasek Thu, 17 May 2018 04:04:52 +0000 + [ Clint Adams ] + * Bump to Standards-Version 4.1.4. + * New upstream release -haskell-blogliterately (0.8.4.3-2build5) bionic; urgency=medium - - * Rebuild against new GHC ABI. - - -- Gianfranco Costamagna Wed, 07 Feb 2018 11:42:29 +0100 - -haskell-blogliterately (0.8.4.3-2build4) bionic; urgency=medium - - * Rebuild against new GHC ABI. - - -- Gianfranco Costamagna Fri, 26 Jan 2018 16:15:13 +0100 - -haskell-blogliterately (0.8.4.3-2build3) bionic; urgency=medium - - * Rebuild against new GHC ABI. - - -- Gianfranco Costamagna Thu, 21 Dec 2017 08:21:06 +0100 - -haskell-blogliterately (0.8.4.3-2build2) bionic; urgency=medium - - * Rebuild against new GHC ABI. - - -- Gianfranco Costamagna Sun, 26 Nov 2017 22:11:00 +0100 - -haskell-blogliterately (0.8.4.3-2build1) bionic; urgency=medium - - * No-change rebuild for icu soname change. - - -- Matthias Klose Wed, 08 Nov 2017 10:08:40 +0100 + -- Clint Adams Mon, 09 Apr 2018 15:23:14 -0400 haskell-blogliterately (0.8.4.3-2) unstable; urgency=medium diff -Nru haskell-blogliterately-0.8.4.3/debian/control haskell-blogliterately-0.8.6.1/debian/control --- haskell-blogliterately-0.8.4.3/debian/control 2018-05-17 04:04:52.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/debian/control 2018-04-09 19:23:14.000000000 +0000 @@ -1,6 +1,5 @@ Source: haskell-blogliterately -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian Haskell Group +Maintainer: Debian Haskell Group Uploaders: Dmitry Bogatov , Priority: optional @@ -11,8 +10,8 @@ ghc (>= 8), ghc-prof, haskell-devscripts (>= 0.13), - libghc-blaze-html-dev (<< 0.10), libghc-blaze-html-dev (>= 0.5), + libghc-blaze-html-dev (<< 0.10), libghc-blaze-html-prof, libghc-bool-extras-dev, libghc-bool-extras-prof, @@ -38,19 +37,18 @@ libghc-http-dev (>= 1:4000.3), libghc-http-prof, libghc-lens-dev (>= 3.8), - libghc-lens-dev (<< 4.16), + libghc-lens-dev (<< 4.17), libghc-lens-prof, libghc-mtl-dev, libghc-mtl-prof, - libghc-pandoc-dev (>= 1.19), - libghc-pandoc-dev (<< 1.20), + libghc-pandoc-dev (>= 2.0), + libghc-pandoc-dev (<< 2.2), libghc-pandoc-prof, libghc-pandoc-citeproc-dev (>= 0.1.2), - libghc-pandoc-citeproc-dev (<< 0.11), - libghc-pandoc-citeproc-dev (>= 0.1.2), + libghc-pandoc-citeproc-dev (<< 0.15), libghc-pandoc-citeproc-prof, libghc-pandoc-types-dev (>= 1.16), - libghc-pandoc-types-dev (<< 1.18), + libghc-pandoc-types-dev (<< 1.20), libghc-pandoc-types-prof, libghc-parsec3-dev (<< 3.2), libghc-parsec3-dev (>= 3), @@ -68,8 +66,12 @@ libghc-temporary-dev (>= 1.1), libghc-temporary-prof, pandoc, -Build-Depends-Indep: - ghc-doc, + libghc-text-dev (>= 1.2), + libghc-text-dev (<< 1.3), + libghc-text-prof, +Build-Depends-Indep: ghc-doc, + libghc-http-doc, + libghc-haxml-doc, libghc-blaze-html-doc, libghc-bool-extras-doc, libghc-cmdargs-doc, @@ -89,10 +91,11 @@ libghc-strict-doc, libghc-tagsoup-doc, libghc-temporary-doc, -Standards-Version: 4.1.1 + libghc-text-doc, +Standards-Version: 4.1.4 Homepage: http://byorgey.wordpress.com/blogliterately/ -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-haskell/DHG_packages.git/tree/p/haskell-blogliterately -Vcs-Git: https://anonscm.debian.org/git/pkg-haskell/DHG_packages.git +Vcs-Browser: https://salsa.debian.org/haskell-team/DHG_packages/tree/master/p/haskell-blogliterately +Vcs-Git: https://salsa.debian.org/haskell-team/DHG_packages.git X-Description: Tool for posting articles to blogs (internals) This package provides development internals of BlogLiterately tool, allowing you write blog posts in Markdown format, then use it to do diff -Nru haskell-blogliterately-0.8.4.3/debian/patches/LaTeXMathML-type-change haskell-blogliterately-0.8.6.1/debian/patches/LaTeXMathML-type-change --- haskell-blogliterately-0.8.4.3/debian/patches/LaTeXMathML-type-change 2017-11-06 15:42:45.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/debian/patches/LaTeXMathML-type-change 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -Index: b/src/Text/BlogLiterately/Transform.hs -=================================================================== ---- a/src/Text/BlogLiterately/Transform.hs -+++ b/src/Text/BlogLiterately/Transform.hs -@@ -562,7 +562,7 @@ xformDoc bl xforms = - } - mathOption opt - | opt `isPrefixOf` "latexmathml" || -- opt `isPrefixOf` "asciimathml" = LaTeXMathML (mathUrlMaybe opt) -+ opt `isPrefixOf` "asciimathml" = LaTeXMathML (mathUrl latexmathmlURL opt) - | opt `isPrefixOf` "mathml" = MathML (mathUrlMaybe opt) - | opt `isPrefixOf` "mimetex" = - WebTeX (mathUrl "/cgi-bin/mimetex.cgi?" opt) -@@ -575,6 +575,7 @@ xformDoc bl xforms = - webTeXURL = "http://chart.apis.google.com/chart?cht=tx&chl=" - mathJaxURL = "http://cdn.mathjax.org/mathjax/latest/MathJax.js" - ++ "?config=TeX-AMS-MML_HTMLorMML" -+ latexmathmlURL = "http://math.etsu.edu/LaTeXMathML/LaTeXMathML.js" - - urlPart = drop 1 . dropWhile (/='=') - diff -Nru haskell-blogliterately-0.8.4.3/debian/patches/newer-blaze-html haskell-blogliterately-0.8.6.1/debian/patches/newer-blaze-html --- haskell-blogliterately-0.8.4.3/debian/patches/newer-blaze-html 2017-11-06 15:44:59.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/debian/patches/newer-blaze-html 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -Description: Newer dependencies from hackage -Origin: upstream, https://hackage.haskell.org/package/BlogLiterately-0.8.4.3/revisions/ ---- - -Index: b/BlogLiterately.cabal -=================================================================== ---- a/BlogLiterately.cabal -+++ b/BlogLiterately.cabal -@@ -54,7 +54,7 @@ Library - parsec >= 3 && < 3.2, - HaXml >= 1.22 && < 1.26, - hscolour >= 1.20 && < 1.25, -- blaze-html >= 0.5 && < 0.9, -+ blaze-html >= 0.5 && < 0.10, - cmdargs >= 0.9.5 && < 0.11, - haxr >= 3000.11 && < 3000.12, - pandoc >= 1.19 && < 1.20, diff -Nru haskell-blogliterately-0.8.4.3/debian/patches/series haskell-blogliterately-0.8.6.1/debian/patches/series --- haskell-blogliterately-0.8.4.3/debian/patches/series 2017-11-06 15:43:06.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -LaTeXMathML-type-change -newer-blaze-html diff -Nru haskell-blogliterately-0.8.4.3/doc/BlogLiteratelyDoc.lhs haskell-blogliterately-0.8.6.1/doc/BlogLiteratelyDoc.lhs --- haskell-blogliterately-0.8.4.3/doc/BlogLiteratelyDoc.lhs 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/doc/BlogLiteratelyDoc.lhs 2018-01-31 15:34:50.000000000 +0000 @@ -79,7 +79,10 @@ `--no-lit-haskell` command-line argument. This makes a difference, for example, when processing paragraphs set off by "bird tracks" (*i.e.* leading `>` characters): in literate Haskell, these are code -blocks, whereas in plain markdown they are blockquotes. +blocks, whereas in plain markdown they are blockquotes. In addition, +section headings beginning with hash signs (`#`, `##`, etc.) cannot be +used in literate Haskell mode; only section headings underlined with +hyphens or equals signs are supported. Determining input format ------------------------ @@ -232,6 +235,10 @@ Note that an extra `$latex...` won't be added to the beginning of LaTeX expressions which already appear to be in WordPress format. +Finally, to simply pass LaTeX math through unchanged (for example, if +your blog hosting software will do LaTeX processing), you can use the +`--rawlatex` option. + Special links ------------- @@ -333,7 +340,7 @@ length txt (And yes, of course, the above output really *was* generated by -BlogLiterately!) Additionally, lines indented by one or more spaces +`BlogLiterately`!) Additionally, lines indented by one or more spaces are interpreted as *expected outputs* instead of inputs. Consecutive indented lines are interpreted as one multi-line expected output, with a number of spaces removed from the beginning of each line equal to @@ -449,13 +456,18 @@ --kate highlight non-Haskell code with highlighting-kate (default) --no-kate don't highlight non-Haskell code + --lit-haskell parse as literate Haskell (default) + --no-lit-haskell do not parse as literate Haskell + --no-toc don't generate a table of contents (default) + --toc generate a table of contents + -r --rawlatex pass inline/display LaTeX through unchanged -w --wplatex reformat inline LaTeX the way WordPress expects -m --math=ITEM how to layout math, where --math=[=URL] -g --ghci run [ghci] blocks through ghci and include output -I --upload-images upload local images -C --category=ITEM post category (can specify more than one) - -T --tag=ITEM tag (can specify more than one) + -T --tag=ITEM ---tags tag (can specify more than one) --blogid=ID Blog specific identifier -P --profile=STRING profile to use -b --blog=URL blog XML-RPC url (if omitted, HTML goes to stdout) @@ -472,6 +484,7 @@ -x --xtra=ITEM extension arguments, for use with custom extensions -? --help Display help message -V --version Print version information + --numeric-version Print just the version number Profiles -------- @@ -503,7 +516,7 @@ String values use normal Haskell syntax for strings, surrounded by double quotes. Optionally, the double quotes may be omitted for strings which do not contain spaces, double quotes, commas, or square -brackets. Lists use also use Haskell list syntax, with comma-separated +brackets. Lists also use Haskell list syntax, with comma-separated items surrounded by square brackets, except that the square brackets may be omitted. For example, `myblog.cfg` might look like this: @@ -515,9 +528,9 @@ categories = foo, bar, "some really long category" The list of options which are currently supported are: `style`, -`wplatex`, `math`, `ghci`, `upload-images`, `categories`, `tags`, -`blogid`, `profile`, `blog`, `user`, `password`, `title`, `postid`, -`page`, `publish`, `xtras`. +`lit-haskell`, `wplatex`, `math`, `ghci`, `upload-images`, +`categories`, `tags`, `blogid`, `profile`, `blog`, `user`, `password`, +`title`, `postid`, `page`, `publish`, `xtras`. Option blocks ------------- diff -Nru haskell-blogliterately-0.8.4.3/README.markdown haskell-blogliterately-0.8.6.1/README.markdown --- haskell-blogliterately-0.8.4.3/README.markdown 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/README.markdown 2018-01-31 15:34:50.000000000 +0000 @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/byorgey/BlogLiterately.svg?branch=master)](https://travis-ci.org/byorgey/BlogLiterately) + Write blog posts in Markdown format, then use BlogLiterately to do syntax highlighting, format ghci sessions, and upload to any blog supporting the [metaWeblog API (such as Wordpress)](http://codex.wordpress.org/XML-RPC_MetaWeblog_API). diff -Nru haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/LaTeX.hs haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/LaTeX.hs --- haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/LaTeX.hs 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/LaTeX.hs 2018-01-31 15:34:50.000000000 +0000 @@ -12,12 +12,27 @@ module Text.BlogLiterately.LaTeX ( - wpTeXify + rawTeXify + , wpTeXify ) where import Data.List (isPrefixOf) import Text.Pandoc +-- | Pass LaTeX through unchanged. +rawTeXify :: Pandoc -> Pandoc +rawTeXify = bottomUp formatDisplayTex . bottomUp formatInlineTex + where formatInlineTex :: [Inline] -> [Inline] + formatInlineTex (Math InlineMath tex : is) + = (RawInline (Format "html") ("$" ++ tex ++ "$")) : is + formatInlineTex is = is + + formatDisplayTex :: [Block] -> [Block] + formatDisplayTex (Para [Math DisplayMath tex] : bs) + = RawBlock (Format "html") ("\n\\[" ++ tex ++ "\\]\n") + : bs + formatDisplayTex bs = bs + -- | WordPress can render LaTeX, but expects it in a special non-standard -- format (@\$latex foo\$@). The @wpTeXify@ function formats LaTeX code -- using this format so that it can be processed by WordPress. diff -Nru haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/Options/Parse.hs haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/Options/Parse.hs --- haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/Options/Parse.hs 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/Options/Parse.hs 2018-01-31 15:34:50.000000000 +0000 @@ -53,6 +53,7 @@ parseBLOption = parseField style "style" parseStr <|> parseField toc "toc" parseBool + <|> parseField rawlatex "rawlatex" parseBool <|> parseField wplatex "wplatex" parseBool <|> parseField math "math" parseStr <|> parseField litHaskell "lit-haskell" parseBool diff -Nru haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/Options.hs haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/Options.hs --- haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/Options.hs 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/Options.hs 2018-01-31 15:34:50.000000000 +0000 @@ -25,6 +25,7 @@ , otherHighlight , litHaskell , toc + , rawlatex , wplatex , math , ghci @@ -54,6 +55,7 @@ , otherHighlight' , litHaskell' , toc' + , rawlatex' , wplatex' , math' , ghci' @@ -93,6 +95,7 @@ -- non-Haskell? , _litHaskell :: Maybe Bool -- ^ Parse as literate Haskell? , _toc :: Maybe Bool -- ^ Generate a table of contents? + , _rawlatex :: Maybe Bool -- ^ Pass LaTeX through unchanged? , _wplatex :: Maybe Bool -- ^ Format LaTeX for WordPress? , _math :: Maybe String -- ^ Indicate how to format math , _ghci :: Maybe Bool -- ^ Automatically process ghci sessions? @@ -138,6 +141,7 @@ , _otherHighlight = Nothing , _litHaskell = Nothing , _toc = Nothing + , _rawlatex = Nothing , _wplatex = Nothing , _math = Nothing , _ghci = Nothing @@ -167,6 +171,7 @@ , _otherHighlight = combine _otherHighlight , _litHaskell = combine _litHaskell , _toc = combine _toc + , _rawlatex = combine _rawlatex , _wplatex = combine _wplatex , _math = combine _math , _ghci = combine _ghci @@ -213,6 +218,9 @@ toc' :: BlogLiterately -> Bool toc' = fromMaybe False . view toc +rawlatex' :: BlogLiterately -> Bool +rawlatex' = fromMaybe False . view rawlatex + wplatex' :: BlogLiterately -> Bool wplatex' = fromMaybe False . view wplatex @@ -308,6 +316,8 @@ &= help "generate a table of contents" &= explicit ] + , _rawlatex = def &= help "pass inline/display LaTeX through unchanged" + &= name "rawlatex" &= name "r" &= explicit , _wplatex = def &= help "reformat inline LaTeX the way WordPress expects" &= name "wplatex" &= name "w" &= explicit , _math = def &= help "how to layout math, where --math=[=URL]" diff -Nru haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/Transform.hs haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/Transform.hs --- haskell-blogliterately-0.8.4.3/src/Text/BlogLiterately/Transform.hs 2016-12-03 19:47:01.000000000 +0000 +++ haskell-blogliterately-0.8.6.1/src/Text/BlogLiterately/Transform.hs 2018-01-31 15:34:50.000000000 +0000 @@ -1,7 +1,7 @@ - {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeOperators #-} ----------------------------------------------------------------------------- @@ -28,6 +28,7 @@ , highlightOptsXF , passwordXF , titleXF + , rawtexifyXF , wptexifyXF , ghciXF , uploadImagesXF @@ -68,6 +69,9 @@ import Data.Monoid (mappend) import Data.Monoid (mempty, (<>)) import qualified Data.Set as S +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.Lazy as LT import Data.Traversable (traverse) import Network.HTTP (getRequest, getResponseBody, simpleHTTP) @@ -79,7 +83,7 @@ import Text.Blaze.Html.Renderer.String (renderHtml) import Text.CSL.Pandoc (processCites') import Text.HTML.TagSoup -import Text.Pandoc +import Text.Pandoc hiding (openURL) import Text.Pandoc.Error (PandocError) import Text.Parsec (ParseError) @@ -90,7 +94,7 @@ getStylePrefs, _HsColourInline) import Text.BlogLiterately.Image (uploadAllImages) -import Text.BlogLiterately.LaTeX (wpTeXify) +import Text.BlogLiterately.LaTeX (rawTeXify, wpTeXify) import Text.BlogLiterately.Options import Text.BlogLiterately.Options.Parse (readBLOptions) import Text.BlogLiterately.Post (findTitle, getPostURL) @@ -164,6 +168,10 @@ -- These transforms are enabled by default in the standard -- @BlogLiterately@ executable. +-- | Pass LaTeX (inline or display) through unchanged (if the @rawlatex@ flag is set). +rawtexifyXF :: Transform +rawtexifyXF = pureTransform (const rawTeXify) rawlatex' + -- | Format embedded LaTeX for WordPress (if the @wplatex@ flag is set). wptexifyXF :: Transform wptexifyXF = pureTransform (const wpTeXify) wplatex' @@ -476,6 +484,8 @@ -- -- * 'titleXF': extract the title from a special title block -- +-- * 'rawtexifyXF': pass LaTeX through unchanged +-- -- * 'wptexifyXF': turn LaTeX into WordPress format if requested -- -- * 'ghciXF': run and typeset ghci sessions if requested @@ -505,6 +515,7 @@ -- much, except highlightOptsXF should go before highlightXF. , passwordXF , titleXF + , rawtexifyXF , wptexifyXF , ghciXF , uploadImagesXF @@ -522,16 +533,16 @@ -- | Transform a complete input document string to an HTML output -- string, given a list of transformation passes. xformDoc :: BlogLiterately -> [Transform] -> String -> IO (Either PandocError (BlogLiterately, String)) -xformDoc bl xforms = - fixLineEndings - >>> parseFile parseOpts - >>> traverse - ( runTransforms xforms bl - >=> (\(bl', p) -> return $ (bl', writeHtml (writeOpts bl') p) ) - >=> _2 (return . renderHtml) - ) +xformDoc bl xforms = runIO . + ( fixLineEndings + >>> T.pack + >>> parseFile parseOpts + >=> (liftIO . runTransforms xforms bl) + >=> (\(bl', p) -> (bl',) <$> writeHtml5String (writeOpts bl') p) + >=> _2 (return . T.unpack) + ) where - parseFile :: ReaderOptions -> String -> Either PandocError Pandoc + parseFile :: ReaderOptions -> Text -> PandocIO Pandoc parseFile opts = case bl^.format of Just "rst" -> readRST opts @@ -544,26 +555,37 @@ _ -> readMarkdown opts parseOpts = def - { readerExtensions = - case bl^.litHaskell of - Just False -> readerExtensions def - _ -> S.insert Ext_literate_haskell - (readerExtensions def) - , readerSmart = True - } + { readerExtensions = pandocExtensions & + foldr (.) id + [ enableExtension Ext_tex_math_single_backslash + , case bl^.litHaskell of + Just False -> id + _ -> enableExtension Ext_literate_haskell + ] + + -- Relevant extensions enabled by default in pandocExtensions: + -- (see https://hackage.haskell.org/package/pandoc-2.1.1/docs/src/Text-Pandoc-Extensions.html#pandocExtensions): + + -- Ext_smart + -- Ext_yaml_metadata_block + -- Ext_tex_math_dollars + -- Ext_pandoc_title_block + -- Ext_citations + } writeOpts bl = def - { writerReferenceLinks = True - , writerTableOfContents = toc' bl - , writerHTMLMathMethod = - case math' bl of - "" -> PlainMath - opt -> mathOption opt - , writerTemplate = Just blHtmlTemplate - } + { writerReferenceLinks = True + , writerTableOfContents = toc' bl + , writerHTMLMathMethod = + case math' bl of + "" -> PlainMath + opt -> mathOption opt + , writerTemplate = Just blHtmlTemplate + } + mathOption opt | opt `isPrefixOf` "latexmathml" || opt `isPrefixOf` "asciimathml" = LaTeXMathML (mathUrlMaybe opt) - | opt `isPrefixOf` "mathml" = MathML (mathUrlMaybe opt) + | opt `isPrefixOf` "mathml" = MathML | opt `isPrefixOf` "mimetex" = WebTeX (mathUrl "/cgi-bin/mimetex.cgi?" opt) | opt `isPrefixOf` "webtex" = WebTeX (mathUrl webTeXURL opt)