mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-25 17:56:32 +00:00
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.
This commit is contained in:
@@ -48,6 +48,7 @@ $if(date)$
|
||||
$endif$
|
||||
$if(abstract)$
|
||||
<div class="abstract">
|
||||
<div class="abstract-title">$abstract-title$</div>
|
||||
$abstract$
|
||||
</div>
|
||||
$endif$
|
||||
|
||||
@@ -51,6 +51,7 @@ $if(date)$
|
||||
$endif$
|
||||
$if(abstract)$
|
||||
<div class="abstract">
|
||||
<div class="abstract-title">$abstract-title$</div>
|
||||
$abstract$
|
||||
</div>
|
||||
$endif$
|
||||
|
||||
@@ -73,6 +73,19 @@ blockquote {
|
||||
border-left: 2px solid #e6e6e6;
|
||||
color: #606060;
|
||||
}
|
||||
$if(abstract)$
|
||||
div.abstract {
|
||||
margin: 2em 2em 2em 2em;
|
||||
text-align: left;
|
||||
font-size: 85%;
|
||||
}
|
||||
div.abstract-title {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
$endif$
|
||||
code {
|
||||
font-family: $if(monofont)$$monofont$$else$Menlo, Monaco, 'Lucida Console', Consolas, monospace$endif$;
|
||||
$if(monobackgroundcolor)$
|
||||
@@ -161,12 +174,6 @@ div.csl-entry {
|
||||
$if(csl-entry-spacing)$
|
||||
margin-bottom: $csl-entry-spacing$;
|
||||
$endif$
|
||||
$if(abstract)$
|
||||
div.abstract{
|
||||
margin: auto;
|
||||
width: 90%;
|
||||
}
|
||||
$endif$
|
||||
}
|
||||
.hanging div.csl-entry {
|
||||
margin-left:2em;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user