diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-05-09 11:29:20 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-05-09 11:29:20 -0700 |
commit | b7356d3ddf788d83b41b1100d718087bd83a7506 (patch) | |
tree | e3d8147a349999937dfc60d55179b6aab0649b46 /src/Text/Pandoc | |
parent | d3be567a73478298485f66b2d2af5ca066eae052 (diff) | |
download | pandoc-b7356d3ddf788d83b41b1100d718087bd83a7506.tar.gz |
Restored and undeprecated gladtex for HTML math.
- Added `GladTeX` constructor to `Text.Pandoc.Options.HTMLMathMethod`
[API change, reverts removal in v2.2]
- Restored and undeprecated `--gladtex` option, removed in v2.2.
Closes #4607.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/App.hs | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Options.hs | 1 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 9 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 920462d48..a59fd9bbe 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -1403,6 +1403,12 @@ options = "URL") "" -- Use KaTeX for HTML Math + , Option "" ["gladtex"] + (NoArg + (\opt -> + return opt { optHTMLMathMethod = GladTeX })) + "" -- "Use gladtex for HTML math" + , Option "" ["abbreviations"] (ReqArg (\arg opt -> return opt { optAbbreviations = Just arg }) diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 4797a3094..e5ca1764c 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -107,6 +107,7 @@ data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read, Data, Typeable, Gener data HTMLMathMethod = PlainMath | WebTeX String -- url of TeX->image script. + | GladTeX | MathML | MathJax String -- url of MathJax.js | KaTeX String -- url of KaTeX files diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 535071ae2..a09ad2fda 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -58,7 +58,7 @@ import qualified Data.Text.Lazy as TL import Network.HTTP (urlEncode) import Network.URI (URI (..), parseURIReference, unEscapeString) import Numeric (showHex) -import Text.Blaze.Internal (customLeaf, MarkupM(Empty)) +import Text.Blaze.Internal (customLeaf, customParent, MarkupM(Empty)) #if MIN_VERSION_blaze_markup(0,6,3) #else import Text.Blaze.Internal (preEscapedString, preEscapedText) @@ -1029,6 +1029,13 @@ inlineToHtml opts inline = do return $ case t of InlineMath -> m DisplayMath -> brtag >> m >> brtag + GladTeX -> + return $ + customParent (textTag "eq") ! + customAttribute "env" + (toValue $ if t == InlineMath + then ("math" :: Text) + else "displaymath") $ strToHtml str MathML -> do let conf = useShortEmptyTags (const False) defaultConfigPP |