diff --git a/CHANGES.txt b/CHANGES.txt index a7584d8935..bfc8f22cb1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,9 @@ Features -------- * New ``listings`` shortcode similar to the reStructuredText listings directive (Issue #2868) +* Switch to reStructuredText’s new HTML 5 renderer (Issue #2874) +* Deprecate ``html4css1.css`` in favor of ``rst_base.css`` (Issue + #2874) * Add support for ``MetadataExtractor`` plugins that allow custom, extensible metadata extraction from posts (Issue #2830) * Support YAML and TOML metadata in 2-file posts (via Issue #2830) diff --git a/docs/creating-a-theme.txt b/docs/creating-a-theme.txt index 2f86c50bb4..a6388d9e02 100644 --- a/docs/creating-a-theme.txt +++ b/docs/creating-a-theme.txt @@ -177,7 +177,7 @@ see something fairly similar: My Nikola Site | My Nikola Site - + @@ -200,7 +200,7 @@ in a particular way, using a setting called ``CODE_COLOR_SCHEME`` where you can what color scheme the syntax highlighter uses. You can use your own ``assets/css/code.css`` if you don’t like the provided ones. -Nikola **requires** ``assets/css/html4css1.css`` and ``assets/css/code.css`` to function properly. +Nikola **requires** ``assets/css/rst_base.css`` and ``assets/css/code.css`` to function properly. We will also add themes for Jupyter (``assets/css/ipython.min.css`` and ``assets/css/nikola_ipython.css``) into the template; note that they are activated only if you configured your ``POSTS``/``PAGES`` with ipynb support. @@ -228,7 +228,7 @@ The part we want to change is this: %endif %else: - + @@ -250,7 +250,7 @@ And we will change it so it uses the lanyon styles instead of theme.css (again, %if use_bundles: %else: - + @@ -403,7 +403,7 @@ So, first, lets change that base template to be more lanyon-like: And that’s after I exposed the sidebar by clicking on an invisible widget! One problem, which causes that yellow color in the sidebar is a CSS conflict. -We are loading ``html4css1.css`` which specifies +We are loading ``rst_base.css`` which specifies the background color of ``div.sidebar`` which is more specific than ``lanyon.css``, which specifies for ``.sidebar`` alone. @@ -507,7 +507,7 @@ and at the bottom a label for the sidebar toggle. Easy to do in ``base.tmpl`` Getting there! -The sidebar looks bad because of yet more CSS conflicts with ``html4css1.css``. By +The sidebar looks bad because of yet more CSS conflicts with ``rst_base.css``. By adding some extra styling in ``lanyon.css``, it will look better. .. code:: css @@ -817,7 +817,7 @@ which makes sites load faster. To do that, your theme needs a ``bundles`` file w For the Lanyon theme, it should be like this:: - assets/css/all.css=html4css1.css,nikola_rst.css,code.css,poole.css,lanyon.css,custom.css + assets/css/all.css=rst_base.css,nikola_rst.css,code.css,poole.css,lanyon.css,custom.css **Note:** Some themes also support the ``USE_CDN`` option meaning that in some cases it will load one bundle with all CSS and in other will load some CSS files from a CDN and others from a bundle. This is complicated and probably not worth the effort. diff --git a/docs/manual.txt b/docs/manual.txt index 32e828c8dc..cf20b1dbe7 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -598,7 +598,7 @@ default set to: TRANSLATIONS_PATTERN = "{path}.{lang}.{ext}" -.. note:: Considered languages +.. admonition:: Considered languages Nikola will only look for translation of input files for languages specified in the TRANSLATIONS variable. @@ -669,7 +669,7 @@ options. The exact mechanism is explained above the config options in the ("pages/*.html", "pages", "story.tmpl"), ) -.. note:: POSTS and PAGES are not flat! +.. admonition:: POSTS and PAGES are not flat! Even if the syntax may suggest you can't, you can create any directory structure you want inside ``posts/`` or ``pages/`` and it will be reflected in the output. For example, @@ -1155,7 +1155,7 @@ Example of a paired shortcode (note that we don't have a highlight shortcode yet {{% raw %}}{{% highlight python %}} A bunch of code here {{% /highlight %}}{{% /raw %}} -.. note:: Shortcodes and reStructuredText +.. admonition:: Shortcodes and reStructuredText In reStructuredText shortcodes may fail because docutils turns URL into links and everything breaks. For some shortcodes there are alternative docutils directives (example, you can use the media diff --git a/docs/theming.txt b/docs/theming.txt index 19f4eaf8bb..abed7aca6c 100644 --- a/docs/theming.txt +++ b/docs/theming.txt @@ -78,7 +78,7 @@ bundles .. code:: text - assets/css/all.css=bootstrap.css,html4css1.css,nikola_rst.css,code.css,colorbox.css,custom.css + assets/css/all.css=bootstrap.css,rst_base.css,nikola_rst.css,code.css,colorbox.css,custom.css This creates a file called "assets/css/all.css" in your output that is the combination of all the other file paths, relative to the output file. diff --git a/nikola/data/themes/base-jinja/templates/base_helper.tmpl b/nikola/data/themes/base-jinja/templates/base_helper.tmpl index a782df1a98..b9a5421959 100644 --- a/nikola/data/themes/base-jinja/templates/base_helper.tmpl +++ b/nikola/data/themes/base-jinja/templates/base_helper.tmpl @@ -85,7 +85,7 @@ lang="{{ lang }}"> {% endif %} {% else %} - + diff --git a/nikola/data/themes/base/assets/css/html4css1.css b/nikola/data/themes/base/assets/css/html4css1.css index 427d33e192..cc29335945 100644 --- a/nikola/data/themes/base/assets/css/html4css1.css +++ b/nikola/data/themes/base/assets/css/html4css1.css @@ -1,349 +1 @@ -/* -:Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ -:Copyright: This stylesheet has been placed in the public domain. - -Default cascading style sheet for the HTML output of Docutils. - -See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to -customize this style sheet. -*/ - -/* used to remove borders from tables and images */ -.borderless, table.borderless td, table.borderless th { - border: 0 } - -table.borderless td, table.borderless th { - /* Override padding for "table.docutils td" with "! important". - The right padding separates the table cells. */ - padding: 0 0.5em 0 0 ! important } - -.first { - /* Override more specific margin styles with "! important". */ - margin-top: 0 ! important } - -.last, .with-subtitle { - margin-bottom: 0 ! important } - -.hidden { - display: none } - -.subscript { - vertical-align: sub; - font-size: smaller } - -.superscript { - vertical-align: super; - font-size: smaller } - -a.toc-backref { - text-decoration: none ; - color: black } - -blockquote.epigraph { - margin: 2em 5em ; } - -dl.docutils dd { - margin-bottom: 0.5em } - -object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] { - overflow: hidden; -} - -/* Uncomment (and remove this text!) to get bold-faced definition list terms -dl.docutils dt { - font-weight: bold } -*/ - -div.abstract { - margin: 2em 5em } - -div.abstract p.topic-title { - font-weight: bold ; - text-align: center } - -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - margin: 2em ; - border: medium outset ; - padding: 1em } - -div.admonition p.admonition-title, div.hint p.admonition-title, -div.important p.admonition-title, div.note p.admonition-title, -div.tip p.admonition-title { - font-weight: bold ; - font-family: sans-serif } - -div.attention p.admonition-title, div.caution p.admonition-title, -div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title, .code .error { - color: red ; - font-weight: bold ; - font-family: sans-serif } - -/* Uncomment (and remove this text!) to get reduced vertical space in - compound paragraphs. -div.compound .compound-first, div.compound .compound-middle { - margin-bottom: 0.5em } - -div.compound .compound-last, div.compound .compound-middle { - margin-top: 0.5em } -*/ - -div.dedication { - margin: 2em 5em ; - text-align: center ; - font-style: italic } - -div.dedication p.topic-title { - font-weight: bold ; - font-style: normal } - -div.figure { - margin-left: 2em ; - margin-right: 2em } - -div.footer, div.header { - clear: both; - font-size: smaller } - -div.line-block { - display: block ; - margin-top: 1em ; - margin-bottom: 1em } - -div.line-block div.line-block { - margin-top: 0 ; - margin-bottom: 0 ; - margin-left: 1.5em } - -div.sidebar { - margin: 0 0 0.5em 1em ; - border: medium outset ; - padding: 1em ; - background-color: #ffffee ; - width: 40% ; - float: right ; - clear: right } - -div.sidebar p.rubric { - font-family: sans-serif ; - font-size: medium } - -div.system-messages { - margin: 5em } - -div.system-messages h1 { - color: red } - -div.system-message { - border: medium outset ; - padding: 1em } - -div.system-message p.system-message-title { - color: red ; - font-weight: bold } - -div.topic { - margin: 2em } - -h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, -h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { - margin-top: 0.4em } - -h1.title { - text-align: center } - -h2.subtitle { - text-align: center } - -hr.docutils { - width: 75% } - -img.align-left, .figure.align-left, object.align-left, table.align-left { - clear: left ; - float: left ; - margin-right: 1em } - -img.align-right, .figure.align-right, object.align-right, table.align-right { - clear: right ; - float: right ; - margin-left: 1em } - -img.align-center, .figure.align-center, object.align-center { - display: block; - margin-left: auto; - margin-right: auto; -} - -table.align-center { - margin-left: auto; - margin-right: auto; -} - -.align-left { - text-align: left } - -.align-center { - clear: both ; - text-align: center } - -.align-right { - text-align: right } - -/* reset inner alignment in figures */ -div.align-right { - text-align: inherit } - -/* div.align-center * { */ -/* text-align: left } */ - -.align-top { - vertical-align: top } - -.align-middle { - vertical-align: middle } - -.align-bottom { - vertical-align: bottom } - -ol.simple, ul.simple { - margin-bottom: 1em } - -ol.arabic { - list-style: decimal } - -ol.loweralpha { - list-style: lower-alpha } - -ol.upperalpha { - list-style: upper-alpha } - -ol.lowerroman { - list-style: lower-roman } - -ol.upperroman { - list-style: upper-roman } - -p.attribution { - text-align: right ; - margin-left: 50% } - -p.caption { - font-style: italic } - -p.credits { - font-style: italic ; - font-size: smaller } - -p.label { - white-space: nowrap } - -p.rubric { - font-weight: bold ; - font-size: larger ; - color: maroon ; - text-align: center } - -p.sidebar-title { - font-family: sans-serif ; - font-weight: bold ; - font-size: larger } - -p.sidebar-subtitle { - font-family: sans-serif ; - font-weight: bold } - -p.topic-title { - font-weight: bold } - -pre.address { - margin-bottom: 0 ; - margin-top: 0 ; - font: inherit } - -pre.literal-block, pre.doctest-block, pre.math, pre.code { - margin-left: 2em ; - margin-right: 2em } - -pre.code .ln { color: grey; } /* line numbers */ -pre.code, code { background-color: #eeeeee } -pre.code .comment, code .comment { color: #5C6576 } -pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } -pre.code .literal.string, code .literal.string { color: #0C5404 } -pre.code .name.builtin, code .name.builtin { color: #352B84 } -pre.code .deleted, code .deleted { background-color: #DEB0A1} -pre.code .inserted, code .inserted { background-color: #A3D289} - -span.classifier { - font-family: sans-serif ; - font-style: oblique } - -span.classifier-delimiter { - font-family: sans-serif ; - font-weight: bold } - -span.interpreted { - font-family: sans-serif } - -span.option { - white-space: nowrap } - -span.pre { - white-space: pre } - -span.problematic { - color: red } - -span.section-subtitle { - /* font-size relative to parent (h1..h6 element) */ - font-size: 80% } - -table.citation { - border-left: solid 1px gray; - margin-left: 1px } - -table.docinfo { - margin: 2em 4em } - -table.docutils { - margin-top: 0.5em ; - margin-bottom: 0.5em } - -table.footnote { - border-left: solid 1px black; - margin-left: 1px } - -table.docutils td, table.docutils th, -table.docinfo td, table.docinfo th { - padding-left: 0.5em ; - padding-right: 0.5em ; - vertical-align: top } - -table.docutils th.field-name, table.docinfo th.docinfo-name { - font-weight: bold ; - text-align: left ; - white-space: nowrap ; - padding-left: 0 } - -/* "booktabs" style (no vertical lines) */ -table.docutils.booktabs { - border: 0px; - border-top: 2px solid; - border-bottom: 2px solid; - border-collapse: collapse; -} -table.docutils.booktabs * { - border: 0px; -} -table.docutils.booktabs th { - border-bottom: thin solid; - text-align: left; -} - -h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, -h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { - font-size: 100% } - -ul.auto-toc { - list-style-type: none } +@import url("rst_base.css"); diff --git a/nikola/data/themes/base/assets/css/nikola_rst.css b/nikola/data/themes/base/assets/css/nikola_rst.css index 3b17adcd85..d413dd9542 100644 --- a/nikola/data/themes/base/assets/css/nikola_rst.css +++ b/nikola/data/themes/base/assets/css/nikola_rst.css @@ -1,5 +1,6 @@ div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning, div.sidebar { +div.hint, div.important, div.note, div.tip, div.warning, div.sidebar, +div.system-message { /* stolen from Boostrap 3 (.panel .panel-default) */ margin-bottom: 20px; background-color: #fff; @@ -20,27 +21,30 @@ div.important p.admonition-title, div.note p.admonition-title, div.tip p.admonition-title, div.sidebar p.sidebar-title, div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { +div.warning p.admonition-title, div.system-message p.system-message-title { /* stolen from Boostrap 3 (.panel .panel-default .panel-heading) */ font-size: 16px; color: #333; background-color: #F5F5F5; padding: 10px 15px; - margin-left: -15px; - margin-right: -15px; border-bottom: 1px solid rgba(0, 0, 0, 0); border-top-left-radius: 3px; border-top-right-radius: 3px; color: #333; background-color: #F5F5F5; border-color: #DDD; + margin: 0 -15px 15px -15px; } div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { +div.warning p.admonition-title, div.system-message p.system-message-title { /* stolen from Boostrap 3 (.panel .panel-danger) */ color: #A94442; background-color: #F2DEDE; border-color: #EBCCD1; } + +div.sidebar { + margin-right: 0; +} diff --git a/nikola/data/themes/base/assets/css/rst.css b/nikola/data/themes/base/assets/css/rst.css index b6b4924af9..03424a8dd4 100644 --- a/nikola/data/themes/base/assets/css/rst.css +++ b/nikola/data/themes/base/assets/css/rst.css @@ -1,2 +1,2 @@ -@import url("html4css1.css"); +@import url("rst_base.css"); @import url("nikola_rst.css"); diff --git a/nikola/data/themes/base/assets/css/rst_base.css b/nikola/data/themes/base/assets/css/rst_base.css new file mode 100644 index 0000000000..c92adfa97a --- /dev/null +++ b/nikola/data/themes/base/assets/css/rst_base.css @@ -0,0 +1,474 @@ +/* Minimal style sheet for the HTML output of Docutils. */ +/* */ +/* :Author: Günter Milde, based on html4css1.css by David Goodger */ +/* :Id: $Id: minimal.css 7952 2016-07-26 18:15:59Z milde $ */ +/* :Copyright: © 2015 Günter Milde. */ +/* :License: Released under the terms of the `2-Clause BSD license`_, */ +/* in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ + +/* This CSS2.1_ stylesheet defines rules for Docutils elements without */ +/* HTML equivalent. It is required to make the document semantic visible. */ +/* */ +/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */ +/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */ + +/* alignment of text and inline objects inside block objects*/ +.align-left { text-align: left; } +.align-right { text-align: right; } +.align-center { clear: both; text-align: center; } +.align-top { vertical-align: top; } +.align-middle { vertical-align: middle; } +.align-bottom { vertical-align: bottom; } + +/* titles */ +h1.title, p.subtitle { + text-align: center; +} +p.admonition-title, +p.topic-title, +p.sidebar-title, +p.rubric, +p.system-message-title { + font-weight: bold; +} +h1 + p.subtitle, +h1 + p.section-subtitle { + font-size: 1.6em; +} +h2 + p.section-subtitle { font-size: 1.28em; } +p.subtitle, +p.section-subtitle, +p.sidebar-subtitle { + font-weight: bold; + margin-top: -0.5em; +} +p.sidebar-title, +p.rubric { + font-size: larger; +} +p.rubric { color: maroon; } +a.toc-backref { + color: black; + text-decoration: none; } + +/* Warnings, Errors */ +div.caution p.admonition-title, +div.attention p.admonition-title, +div.danger p.admonition-title, +div.error p.admonition-title, +div.warning p.admonition-title, +div.system-messages h1, +div.error, +span.problematic, +p.system-message-title { + color: red; +} + +/* inline literals */ +span.docutils.literal { + font-family: monospace; + white-space: pre-wrap; +} +/* do not wraph at hyphens and similar: */ +.literal > span.pre { white-space: nowrap; } + +/* Lists */ + +/* compact and simple lists: no margin between items */ +.simple li, .compact li, +.simple ul, .compact ul, +.simple ol, .compact ol, +.simple > li p, .compact > li p, +dl.simple > dd, dl.compact > dd { + margin-top: 0; + margin-bottom: 0; +} + +/* Table of Contents */ +/*div.topic.contents { margin: 0; }*/ +ul.auto-toc { + list-style-type: none; + padding-left: 1.5em; } + +/* Enumerated Lists */ +ol.arabic { list-style: decimal } +ol.loweralpha { list-style: lower-alpha } +ol.upperalpha { list-style: upper-alpha } +ol.lowerroman { list-style: lower-roman } +ol.upperroman { list-style: upper-roman } + +dt span.classifier { font-style: italic } +dt span.classifier:before { + font-style: normal; + margin: 0.5em; + content: ":"; +} + +/* Field Lists and drivatives */ +/* bold field name, content starts on the same line */ +dl.field-list > dt, +dl.option-list > dt, +dl.docinfo > dt, +dl.footnote > dt, +dl.citation > dt { + font-weight: bold; + clear: left; + float: left; + margin: 0; + padding: 0; + padding-right: 0.5em; +} +/* Offset for field content (corresponds to the --field-name-limit option) */ +dl.field-list > dd, +dl.option-list > dd, +dl.docinfo > dd { + margin-left: 9em; /* ca. 14 chars in the test examples */ +} +/* start field-body on a new line after long field names */ +dl.field-list > dd > *:first-child, +dl.option-list > dd > *:first-child +{ + display: inline-block; + width: 100%; + margin: 0; +} +/* field names followed by a colon */ +dl.field-list > dt:after, +dl.docinfo > dt:after { + content: ":"; +} + +/* Bibliographic Fields (docinfo) */ +pre.address { font: inherit; } +dd.authors > p { margin: 0; } + +/* Option Lists */ +dl.option-list { margin-left: 40px; } +dl.option-list > dt { font-weight: normal; } +span.option { white-space: nowrap; } + +/* Footnotes and Citations */ +dl.footnote.superscript > dd {margin-left: 1em; } +dl.footnote.brackets > dd {margin-left: 2em; } +dl > dt.label { font-weight: normal; } +a.footnote-reference.brackets:before, +dt.label > span.brackets:before { content: "["; } +a.footnote-reference.brackets:after, +dt.label > span.brackets:after { content: "]"; } +a.footnote-reference.superscript, +dl.footnote.superscript > dt.label { + vertical-align: super; + font-size: smaller; +} +dt.label > span.fn-backref { margin-left: 0.2em; } +dt.label > span.fn-backref > a { font-style: italic; } + +/* Line Blocks */ +div.line-block { display: block; } +div.line-block div.line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 40px; +} + +/* Figures, Images, and Tables */ +.figure.align-left, +img.align-left, +object.align-left, +table.align-left { + margin-right: auto; +} +.figure.align-center, +img.align-center, +object.align-center { + margin-left: auto; + margin-right: auto; + display: block; +} +table.align-center { + margin-left: auto; + margin-right: auto; +} +.figure.align-right, +img.align-right, +object.align-right, +table.align-right { + margin-left: auto; +} +/* reset inner alignment in figures and tables */ +div.align-left, div.align-center, div.align-right, +table.align-left, table.align-center, table.align-right +{ text-align: inherit } + +/* Admonitions and System Messages */ +div.admonition, +div.system-message, +div.sidebar{ + margin: 40px; + border: medium outset; + padding-right: 1em; + padding-left: 1em; +} + +/* Sidebar */ +div.sidebar { + width: 30%; + max-width: 26em; + float: right; + clear: right; +} + +/* Text Blocks */ +div.topic, +pre.literal-block, +pre.doctest-block, +pre.math, +pre.code { + margin-right: 40px; + margin-left: 40px; +} +pre.code .ln { color: gray; } /* line numbers */ + +/* Tables */ +table { border-collapse: collapse; } +td, th { + border-style: solid; + border-color: silver; + padding: 0 1ex; + border-width: thin; +} +td > p:first-child, th > p:first-child { margin-top: 0; } +td > p, th > p { margin-bottom: 0; } + +table > caption { + text-align: left; + margin-bottom: 0.25em +} + +table.borderless td, table.borderless th { + border: 0; + padding: 0; + padding-right: 0.5em /* separate table cells */ +} + +/* CSS31_ style sheet for the output of Docutils HTML writers. */ +/* Rules for easy reading and pre-defined style variants. */ +/* */ +/* :Author: Günter Milde, based on html4css1.css by David Goodger */ +/* :Id: $Id: plain.css 7952 2016-07-26 18:15:59Z milde $ */ +/* :Copyright: © 2015 Günter Milde. */ +/* :License: Released under the terms of the `2-Clause BSD license`_, */ +/* in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ +/* .. _CSS3: http://www.w3.org/TR/CSS3 */ + + +/* Document Structure */ +/* ****************** */ + +/* Sections */ + +/* Transitions */ + +hr.docutils { + width: 80%; + margin-top: 1em; + margin-bottom: 1em; + clear: both; +} + +/* Paragraphs */ +/* ========== */ + +/* vertical space (parskip) */ +p, ol, ul, dl, +div.line-block, +table{ + margin-top: 0.5em; + margin-bottom: 0.5em; +} +h1, h2, h3, h4, h5, h6, +dl > dd { + margin-bottom: 0.5em; +} + +/* Lists */ +/* ========== */ + +/* Definition Lists */ + +dl > dd p:first-child { margin-top: 0; } +/* :last-child is not part of CSS 2.1 (introduced in CSS 3) */ +/* dl > dd p:last-child { margin-bottom: 0; } */ + +/* lists nested in definition lists */ +/* :only-child is not part of CSS 2.1 (introduced in CSS 3) */ +dd > ul:only-child, dd > ol:only-child { padding-left: 1em; } + +/* Description Lists */ +/* styled like in most dictionaries, encyclopedias etc. */ +dl.description > dt { + font-weight: bold; + clear: left; + float: left; + margin: 0; + padding: 0; + padding-right: 0.5em; +} + +/* Field Lists */ + +/* example for custom field-name width */ +dl.field-list.narrow > dd { + margin-left: 5em; +} +/* run-in: start field-body on same line after long field names */ +dl.field-list.run-in > dd p { + display: block; +} + +/* Bibliographic Fields */ + +/* generally, bibliographic fields use special definition list dl.docinfo */ +/* but dedication and abstract are placed into "topic" divs */ +div.abstract p.topic-title { + text-align: center; +} +div.dedication { + margin: 2em 5em; + text-align: center; + font-style: italic; +} +div.dedication p.topic-title { + font-style: normal; +} + +/* Citations */ +dl.citation dt.label { + font-weight: bold; +} +span.fn-backref { + font-weight: normal; +} + +/* Text Blocks */ +/* ============ */ + +/* Literal Blocks */ +pre.literal-block, pre.doctest-block, +pre.math, pre.code { + margin-left: 1.5em; + margin-right: 1.5em +} + +/* Block Quotes */ + +blockquote, +div.topic { + margin-left: 1.5em; + margin-right: 1.5em +} +blockquote > table, +div.topic > table { + margin-top: 0; + margin-bottom: 0; +} +blockquote p.attribution, +div.topic p.attribution { + text-align: right; + margin-left: 20%; +} + +/* Tables */ +/* ====== */ + +/* th { vertical-align: bottom; } */ + +table tr { text-align: left; } + +/* "booktabs" style (no vertical lines) */ +table.booktabs { + border: 0; + border-top: 2px solid; + border-bottom: 2px solid; + border-collapse: collapse; +} +table.booktabs * { + border: 0; +} +table.booktabs th { + border-bottom: thin solid; +} + +/* numbered tables (counter defined in div.document) */ +table.numbered > caption:before { + counter-increment: table; + content: "Table " counter(table) ": "; + font-weight: bold; +} + +/* Explicit Markup Blocks */ +/* ====================== */ + +/* Footnotes and Citations */ +/* ----------------------- */ + +/* line on the left */ +dl.footnote { + padding-left: 1ex; + border-left: solid; + border-left-width: thin; +} + +/* Directives */ +/* ---------- */ + +/* Body Elements */ +/* ~~~~~~~~~~~~~ */ + +/* Images and Figures */ + +/* let content flow to the side of aligned images and figures */ +.figure.align-left, +img.align-left, +object.align-left { + display: block; + clear: left; + float: left; + margin-right: 1em +} +.figure.align-right, +img.align-right, +object.align-right { + display: block; + clear: right; + float: right; + margin-left: 1em +} + +/* Sidebar */ + +/* Move into the margin. In a layout with fixed margins, */ +/* it can be moved into the margin completely. */ +div.sidebar { + width: 30%; + max-width: 26em; + margin-left: 1em; + margin-right: -5.5%; + background-color: #ffffee ; +} diff --git a/nikola/data/themes/base/bundles b/nikola/data/themes/base/bundles index c10e24d8ab..26cefee783 100644 --- a/nikola/data/themes/base/bundles +++ b/nikola/data/themes/base/bundles @@ -1,2 +1,2 @@ -assets/css/all.css=html4css1.css,nikola_rst.css,code.css,theme.css -assets/css/all-nocdn.css=html4css1.css,nikola_rst.css,code.css,theme.css,baguetteBox.min.css +assets/css/all.css=rst_base.css,nikola_rst.css,code.css,theme.css +assets/css/all-nocdn.css=rst_base.css,nikola_rst.css,code.css,theme.css,baguetteBox.min.css diff --git a/nikola/data/themes/base/templates/base_helper.tmpl b/nikola/data/themes/base/templates/base_helper.tmpl index c9597da393..2ac99f926a 100644 --- a/nikola/data/themes/base/templates/base_helper.tmpl +++ b/nikola/data/themes/base/templates/base_helper.tmpl @@ -85,7 +85,7 @@ lang="${lang}"> %endif %else: - + diff --git a/nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl b/nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl index 15d7867e6a..5bd5d795d0 100644 --- a/nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl +++ b/nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl @@ -117,7 +117,7 @@ lang="{{ lang }}"> {% else %} {% endif %} - + diff --git a/nikola/data/themes/bootstrap3/bundles b/nikola/data/themes/bootstrap3/bundles index 85bc0a6043..465e993fb1 100644 --- a/nikola/data/themes/bootstrap3/bundles +++ b/nikola/data/themes/bootstrap3/bundles @@ -1,4 +1,4 @@ -assets/css/all-nocdn.css=bootstrap.min.css,html4css1.css,nikola_rst.css,code.css,colorbox.css,theme.css,custom.css -assets/css/all.css=html4css1.css,nikola_rst.css,code.css,colorbox.css,theme.css,custom.css +assets/css/all-nocdn.css=bootstrap.min.css,rst_base.css,nikola_rst.css,code.css,colorbox.css,theme.css,custom.css +assets/css/all.css=rst_base.css,nikola_rst.css,code.css,colorbox.css,theme.css,custom.css assets/js/all-nocdn.js=jquery.min.js,bootstrap.min.js,jquery.colorbox-min.js,moment-with-locales.min.js,fancydates.js assets/js/all.js=jquery.colorbox-min.js,moment-with-locales.min.js,fancydates.js diff --git a/nikola/data/themes/bootstrap3/templates/base_helper.tmpl b/nikola/data/themes/bootstrap3/templates/base_helper.tmpl index e549cf3fe6..d638f0470d 100644 --- a/nikola/data/themes/bootstrap3/templates/base_helper.tmpl +++ b/nikola/data/themes/bootstrap3/templates/base_helper.tmpl @@ -117,7 +117,7 @@ lang="${lang}"> %else: %endif - + diff --git a/nikola/metadata_extractors.py b/nikola/metadata_extractors.py index 14c95eb75c..2de76f4708 100644 --- a/nikola/metadata_extractors.py +++ b/nikola/metadata_extractors.py @@ -76,7 +76,7 @@ def check_conditions(post, filename: str, conditions: list, config: dict, source ct == MetaCondition.config_bool and not config.get(arg, False), ct == MetaCondition.config_present and arg not in config, ct == MetaCondition.extension and not filename.endswith(arg), - ct == MetaCondition.compiler and post.compiler.name != arg, + ct == MetaCondition.compiler and (post is None or post.compiler.name != arg), ct == MetaCondition.never )): return False diff --git a/nikola/plugins/command/rst2html/__init__.py b/nikola/plugins/command/rst2html/__init__.py index de79777740..6a33054011 100644 --- a/nikola/plugins/command/rst2html/__init__.py +++ b/nikola/plugins/command/rst2html/__init__.py @@ -53,7 +53,7 @@ def _execute(self, options, args): data = in_file.read() output, error_level, deps, shortcode_deps = compiler.compile_string(data, source, True) - rstcss_path = resource_filename('nikola', 'data/themes/base/assets/css/html4css1.css') + rstcss_path = resource_filename('nikola', 'data/themes/base/assets/css/rst_base.css') with io.open(rstcss_path, "r", encoding="utf8") as fh: rstcss = fh.read() diff --git a/nikola/plugins/compile/rest/__init__.py b/nikola/plugins/compile/rest/__init__.py index 7d9dada597..500bef0fd8 100644 --- a/nikola/plugins/compile/rest/__init__.py +++ b/nikola/plugins/compile/rest/__init__.py @@ -35,7 +35,7 @@ import docutils.utils import docutils.io import docutils.readers.standalone -import docutils.writers.html4css1 +import docutils.writers.html5_polyglot import docutils.parsers.rst.directives from docutils.parsers.rst import roles @@ -285,9 +285,9 @@ def depart_Math(self, node): """ docutils.nodes._add_node_class_names([node.__name__]) if visit_function: - setattr(docutils.writers.html4css1.HTMLTranslator, 'visit_' + node.__name__, visit_function) + setattr(docutils.writers.html5_polygot.HTMLTranslator, 'visit_' + node.__name__, visit_function) if depart_function: - setattr(docutils.writers.html4css1.HTMLTranslator, 'depart_' + node.__name__, depart_function) + setattr(docutils.writers.html5_polyglot.HTMLTranslator, 'depart_' + node.__name__, depart_function) def rst2html(source, source_path=None, source_class=docutils.io.StringInput, diff --git a/requirements.txt b/requirements.txt index 49da63f56d..b4b23b21ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ doit>=0.30.1 Pygments>=1.6 Pillow>=2.4.0 python-dateutil>=2.4.0 -docutils>=0.12 +docutils>=0.13 mako>=1.0.0 Markdown>=2.4.0 unidecode>=0.04.16