"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Text/Pandoc/Writers/HTML.hs" between
pandoc-2.14.0.3.tar.gz and pandoc-2.14.1.tar.gz

About: Pandoc converts files from one markup format into another.

HTML.hs  (pandoc-2.14.0.3):HTML.hs  (pandoc-2.14.1)
skipping to change at line 320 skipping to change at line 320
_ -> case lookupContext "mathml-script" _ -> case lookupContext "mathml-script"
(writerVariables opts) of (writerVariables opts) of
Just s | not (stHtml5 st) -> Just s | not (stHtml5 st) ->
H.script ! A.type_ "text/javascript" H.script ! A.type_ "text/javascript"
$ preEscapedString $ preEscapedString
("/*<![CDATA[*/\n" ++ T.unpack s ++ ("/*<![CDATA[*/\n" ++ T.unpack s ++
"/*]]>*/\n") "/*]]>*/\n")
| otherwise -> mempty | otherwise -> mempty
Nothing -> mempty Nothing -> mempty
let mCss :: Maybe [Text] = lookupContext "css" metadata let mCss :: Maybe [Text] = lookupContext "css" metadata
let true :: Text
true = "true"
let false :: Text
false = "false"
let context = (if stHighlighting st let context = (if stHighlighting st
then case writerHighlightStyle opts of then case writerHighlightStyle opts of
Just sty -> defField "highlighting-css" Just sty -> defField "highlighting-css"
(T.pack $ styleToCss sty) (T.pack $ styleToCss sty)
Nothing -> id Nothing -> id
else id) . else id) .
(if stCsl st (if stCsl st
then defField "csl-css" True . then defField "csl-css" True .
(case stCslEntrySpacing st of (case stCslEntrySpacing st of
Nothing -> id Nothing -> id
skipping to change at line 354 skipping to change at line 350
defField "mathjaxurl" defField "mathjaxurl"
(T.takeWhile (/='?') u) (T.takeWhile (/='?') u)
_ -> defField "mathjax" False) . _ -> defField "mathjax" False) .
(case writerHTMLMathMethod opts of (case writerHTMLMathMethod opts of
PlainMath -> defField "displaymath-css" True PlainMath -> defField "displaymath-css" True
WebTeX _ -> defField "displaymath-css" True WebTeX _ -> defField "displaymath-css" True
_ -> id) . _ -> id) .
(if slideVariant == RevealJsSlides (if slideVariant == RevealJsSlides
then -- set boolean options explicitly, since then -- set boolean options explicitly, since
-- template can't distinguish False/undefined -- template can't distinguish False/undefined
defField "controls" true . defField "controls" True .
defField "controlsTutorial" true . defField "controlsTutorial" True .
defField "controlsLayout" ("bottom-right" :: Text) . defField "controlsLayout" ("bottom-right" :: Text) .
defField "controlsBackArrows" ("faded" :: Text) . defField "controlsBackArrows" ("faded" :: Text) .
defField "progress" true . defField "progress" True .
defField "slideNumber" false . defField "slideNumber" False .
defField "showSlideNumber" ("all" :: Text) . defField "showSlideNumber" ("all" :: Text) .
defField "hashOneBasedIndex" false . defField "hashOneBasedIndex" False .
defField "hash" false . defField "hash" False .
defField "respondToHashChanges" true . defField "respondToHashChanges" True .
defField "history" false . defField "history" False .
defField "keyboard" true . defField "keyboard" True .
defField "overview" true . defField "overview" True .
defField "disableLayout" false . defField "disableLayout" False .
defField "center" true . defField "center" True .
defField "touch" true . defField "touch" True .
defField "loop" false . defField "loop" False .
defField "rtl" false . defField "rtl" False .
defField "navigationMode" ("default" :: Text) . defField "navigationMode" ("default" :: Text) .
defField "shuffle" false . defField "shuffle" False .
defField "fragments" true . defField "fragments" True .
defField "fragmentInURL" true . defField "fragmentInURL" True .
defField "embedded" false . defField "embedded" False .
defField "help" true . defField "help" True .
defField "pause" true . defField "pause" True .
defField "showNotes" false . defField "showNotes" False .
defField "autoPlayMedia" ("null" :: Text) . defField "autoPlayMedia" ("null" :: Text) .
defField "preloadIframes" ("null" :: Text) . defField "preloadIframes" ("null" :: Text) .
defField "autoSlide" ("0" :: Text) . defField "autoSlide" ("0" :: Text) .
defField "autoSlideStoppable" true . defField "autoSlideStoppable" True .
defField "autoSlideMethod" ("null" :: Text) . defField "autoSlideMethod" ("null" :: Text) .
defField "defaultTiming" ("null" :: Text) . defField "defaultTiming" ("null" :: Text) .
defField "mouseWheel" false . defField "mouseWheel" False .
defField "display" ("block" :: Text) . defField "display" ("block" :: Text) .
defField "hideInactiveCursor" true . defField "hideInactiveCursor" True .
defField "hideCursorTime" ("5000" :: Text) . defField "hideCursorTime" ("5000" :: Text) .
defField "previewLinks" false . defField "previewLinks" False .
defField "transition" ("slide" :: Text) . defField "transition" ("slide" :: Text) .
defField "transitionSpeed" ("default" :: Text) . defField "transitionSpeed" ("default" :: Text) .
defField "backgroundTransition" ("fade" :: Text) . defField "backgroundTransition" ("fade" :: Text) .
defField "viewDistance" ("3" :: Text) . defField "viewDistance" ("3" :: Text) .
defField "mobileViewDistance" ("2" :: Text) defField "mobileViewDistance" ("2" :: Text)
else id) . else id) .
defField "document-css" (isNothing mCss && slideVariant == NoS lides) . defField "document-css" (isNothing mCss && slideVariant == NoS lides) .
defField "quotes" (stQuotes st) . defField "quotes" (stQuotes st) .
-- for backwards compatibility we populate toc -- for backwards compatibility we populate toc
-- with the contents of the toc, rather than a -- with the contents of the toc, rather than a
skipping to change at line 666 skipping to change at line 662
isStyle ("style", _) = True isStyle ("style", _) = True
isStyle _ = False isStyle _ = False
go dir = case dimension dir attr of go dir = case dimension dir attr of
(Just (Pixel a)) -> [(tshow dir, tshow a)] (Just (Pixel a)) -> [(tshow dir, tshow a)]
(Just x) -> [("style", tshow dir <> ":" <> tshow x)] (Just x) -> [("style", tshow dir <> ":" <> tshow x)]
Nothing -> [] Nothing -> []
figure :: PandocMonad m figure :: PandocMonad m
=> WriterOptions -> Attr -> [Inline] -> (Text, Text) => WriterOptions -> Attr -> [Inline] -> (Text, Text)
-> StateT WriterState m Html -> StateT WriterState m Html
figure opts attr txt (s,tit) = do figure opts attr@(_, _, attrList) txt (s,tit) = do
html5 <- gets stHtml5 html5 <- gets stHtml5
-- Screen-readers will normally read the @alt@ text and the figure; we -- Screen-readers will normally read the @alt@ text and the figure; we
-- want to avoid them reading the same text twice. With HTML5 we can -- want to avoid them reading the same text twice. With HTML5 we can
-- use aria-hidden for the caption; with HTML4, we use an empty -- use aria-hidden for the caption; with HTML4, we use an empty
-- alt-text instead. -- alt-text instead.
-- When the alt text differs from the caption both should be read.
let alt = if html5 then txt else [Str ""] let alt = if html5 then txt else [Str ""]
let tocapt = if html5 let tocapt = if html5
then H5.figcaption ! then (H5.figcaption !) $
H5.customAttribute (textTag "aria-hidden") if isJust (lookup "alt" attrList)
(toValue @Text "true") then mempty
else H5.customAttribute (textTag "aria-hidden")
(toValue @Text "true")
else H.p ! A.class_ "caption" else H.p ! A.class_ "caption"
img <- inlineToHtml opts (Image attr alt (s,tit)) img <- inlineToHtml opts (Image attr alt (s,tit))
capt <- if null txt capt <- if null txt
then return mempty then return mempty
else tocapt `fmap` inlineListToHtml opts txt else tocapt `fmap` inlineListToHtml opts txt
return $ if html5 return $ if html5
then H5.figure $ mconcat then H5.figure $ mconcat
[nl opts, img, capt, nl opts] [nl opts, img, capt, nl opts]
else H.div ! A.class_ "figure" $ mconcat else H.div ! A.class_ "figure" $ mconcat
[nl opts, img, nl opts, capt, nl opts] [nl opts, img, nl opts, capt, nl opts]
skipping to change at line 1437 skipping to change at line 1436
Just ('#',xs) -> let prefix = if slideVariant == RevealJsSlides Just ('#',xs) -> let prefix = if slideVariant == RevealJsSlides
then "/" then "/"
else writerIdentifi erPrefix opts else writerIdentifi erPrefix opts
in "#" <> prefix <> xs in "#" <> prefix <> xs
_ -> s _ -> s
let link = H.a ! A.href (toValue s') $ linkText let link = H.a ! A.href (toValue s') $ linkText
link' <- addAttrs opts (ident, classes, kvs) link link' <- addAttrs opts (ident, classes, kvs) link
return $ if T.null tit return $ if T.null tit
then link' then link'
else link' ! A.title (toValue tit) else link' ! A.title (toValue tit)
(Image attr txt (s,tit)) -> do (Image attr@(_, _, attrList) txt (s, tit)) -> do
let alternate = stringify txt let alternate = stringify txt
slideVariant <- gets stSlideVariant slideVariant <- gets stSlideVariant
let isReveal = slideVariant == RevealJsSlides let isReveal = slideVariant == RevealJsSlides
attrs <- imgAttrsToHtml opts attr attrs <- imgAttrsToHtml opts attr
let attributes = let attributes =
-- reveal.js uses data-src for lazy loading -- reveal.js uses data-src for lazy loading
(if isReveal (if isReveal
then customAttribute "data-src" $ toValue s then customAttribute "data-src" $ toValue s
else A.src $ toValue s) : else A.src $ toValue s) :
[A.title $ toValue tit | not (T.null tit)] ++ [A.title $ toValue tit | not (T.null tit)] ++
attrs attrs
imageTag = (if html5 then H5.img else H.img imageTag = (if html5 then H5.img else H.img
, [A.alt $ toValue alternate | not (null txt)] ) , [A.alt $ toValue alternate | not (null txt) &&
isNothing (lookup "alt" attrList)] )
mediaTag tg fallbackTxt = mediaTag tg fallbackTxt =
let linkTxt = if null txt let linkTxt = if null txt
then fallbackTxt then fallbackTxt
else alternate else alternate
in (tg $ H.a ! A.href (toValue s) $ toHtml linkTxt in (tg $ H.a ! A.href (toValue s) $ toHtml linkTxt
, [A5.controls ""] ) , [A5.controls ""] )
normSrc = maybe (T.unpack s) uriPath (parseURIRefere nce $ T.unpack s) normSrc = maybe (T.unpack s) uriPath (parseURIRefere nce $ T.unpack s)
(tag, specAttrs) = case mediaCategory normSrc of (tag, specAttrs) = case mediaCategory normSrc of
Just "image" -> imageTag Just "image" -> imageTag
Just "video" -> mediaTag H5.video "Video" Just "video" -> mediaTag H5.video "Video"
 End of changes. 14 change blocks. 
36 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)