aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-01-09 10:56:28 -0800
committerJohn MacFarlane <[email protected]>2022-01-09 10:56:28 -0800
commit2e50c8d1378e911095918a42c04643d64946d554 (patch)
tree3c8a2ce9af33887e7bd61697c02da3156c5b5a29 /src
parentd908e31fe60abe54eb55434576a99cafe4d1e60b (diff)
Improve abstract in HTML template.
* Add localized title "abstract", unless `abstract-title` variable is set. * Add `abstract-title` div to abstract CSS. * Move abstract CSS out of CSL conditional. * Ensure that abstract is aligned left but indented on all sides. * Use smaller font for abstract. Improves #7588.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 988fc26bd..79846736a 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -43,6 +43,7 @@ import Text.DocLayout (render, literal, Doc)
import Text.Blaze.Internal (MarkupM (Empty), customLeaf, customParent)
import Text.DocTemplates (FromContext (lookupContext), Context (..))
import Text.Blaze.Html hiding (contents)
+import Text.Pandoc.Translations (Term(Abstract))
import Text.Pandoc.Definition
import Text.Pandoc.Highlighting (formatHtmlBlock, formatHtmlInline, highlight,
styleToCss)
@@ -65,7 +66,8 @@ import System.FilePath (takeBaseName)
import Text.Blaze.Html.Renderer.Text (renderHtml)
import qualified Text.Blaze.XHtml1.Transitional as H
import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
-import Text.Pandoc.Class.PandocMonad (PandocMonad, report)
+import Text.Pandoc.Class.PandocMonad (PandocMonad, report,
+ translateTerm)
import Text.Pandoc.Class.PandocPure (runPure)
import Text.Pandoc.Error
import Text.Pandoc.Logging
@@ -267,6 +269,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
let descriptionMeta = literal $ escapeStringForXML $
lookupMetaString "description" meta
slideVariant <- gets stSlideVariant
+ abstractTitle <- translateTerm Abstract
let sects = adjustNumbers opts $
makeSections (writerNumberSections opts) Nothing $
if slideVariant == NoSlides
@@ -355,6 +358,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
(if stMath st
then defField "math" math
else id) .
+ defField "abstract-title" abstractTitle .
(case writerHTMLMathMethod opts of
MathJax u -> defField "mathjax" True .
defField "mathjaxurl"