diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-10-17 13:36:18 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-10-17 13:36:18 -0700 |
| commit | 3666d79ae776ce4839262c9f9cbb9d76471d2eb0 (patch) | |
| tree | 50e9df4ce70360ec626680a4559003c50ec0d406 /data/templates | |
| parent | ef432b43240b20201ad8f7b369eb2ad806ecb4c2 (diff) | |
EPUB CSS changes.
With this change, we reduce the amount of inline CSS used
for EPUBs. Almost everything is now in the default EPUB
CSS (`data/epub.css`), which can be overridden either by
putting `epub.css` in the user data directory or by using
`--css` on the command line. Inline styles are only used
for syntax highlighting (which depends on the style specified,
and is only included on pages with highlighted code) and
for bibliography formatting (which can depend on the CSL
style, and is only used in the page containing the bibliography).
Note that, for compatibility with older readers, we don't
use flexbox to style `column/columns` divs by default, as
we do in HTML. Instead, we use an older method which only
works when there are two `column` divs inside a `columns`
div. If you need more than two columns and aren't worried
about support for older EPUB readers, you can modify the
default CSS (there is a comment in the CSS telling you what to do).
Closes #8379.
Diffstat (limited to 'data/templates')
| -rw-r--r-- | data/templates/default.epub2 | 4 | ||||
| -rw-r--r-- | data/templates/default.epub3 | 4 | ||||
| -rw-r--r-- | data/templates/styles.citations.html | 22 |
3 files changed, 28 insertions, 2 deletions
diff --git a/data/templates/default.epub2 b/data/templates/default.epub2 index 28de9c11b..dbc3905be 100644 --- a/data/templates/default.epub2 +++ b/data/templates/default.epub2 @@ -7,7 +7,9 @@ <meta name="generator" content="pandoc" /> <title>$pagetitle$</title> <style type="text/css"> - $styles.html()$ +$if(csl-css)$ + $styles.citations.html()$ +$endif$ $if(highlighting-css)$ $highlighting-css$ $endif$ diff --git a/data/templates/default.epub3 b/data/templates/default.epub3 index 19961ab13..3aa98b939 100644 --- a/data/templates/default.epub3 +++ b/data/templates/default.epub3 @@ -6,7 +6,9 @@ <meta name="generator" content="pandoc" /> <title>$pagetitle$</title> <style> - $styles.html()$ +$if(csl-css)$ + $styles.citations.html()$ +$endif$ $if(highlighting-css)$ $highlighting-css$ $endif$ diff --git a/data/templates/styles.citations.html b/data/templates/styles.citations.html new file mode 100644 index 000000000..2f7c1023a --- /dev/null +++ b/data/templates/styles.citations.html @@ -0,0 +1,22 @@ +div.csl-bib-body { } +div.csl-entry { + clear: both; +$if(csl-entry-spacing)$ + margin-bottom: $csl-entry-spacing$; +$endif$ +} +.hanging div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} |
