CSS for Shallow NumberingEdit online
There is a file located in [PLUGIN_DIR]/css/print/p-numbering-shallow. The following examples are from this file.
Note: This is listed solely for illustration
purposes, as the plugin might use something different.
The counters should be reset on the root element. This is the element that has the class
map/map. Note that bookmaps derive from maps and the following selector
will also match them:
*[class ~= "map/map"] { counter-reset: page 1 toc-chapter 0 chapter 0 figcount 0 tablecount 0; }
Table of Contents
There is only one counter for the chapters, named
toc-chapter. This is
reset on the book parts (for bookmaps) and is incremented on each chapter that is not a
part.Note: The parts are also marked as
chapters.
To
display the numbers in the TOC, a *[class ~= "map/topicref"][is-chapter]:not([is-part]) { counter-increment:toc-chapter; } *[class ~= "map/topicref"][is-part] { counter-reset:toc-chapter !important; counter-increment:toc-part; } /* All other topicrefs that follow a part should not have a number (i.e appendices) */ *[class ~= "map/topicref"][is-part] ~ *[class ~= "map/topicref"]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{ content: none !important; counter-increment:none; }
:before pseudo element is used on the
navigation titles from the <topicref>
elements:*[class ~= "map/topicref"][is-part] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{ content:"Part " counter(toc-part, upper-roman) ". " !important; color:inherit; } *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{ content:"Chapter " counter(toc-chapter) ". " !important; color:inherit; }
The Titles of Chapters in the Main Content
The
part and chapter counters are incremented on the
elements that have the class
topic/topic:*[class ~= "topic/topic"][is-part]{ counter-increment:part; counter-reset:chapter; } *[class ~= "topic/topic"][is-chapter]:not([is-part]){ counter-increment:chapter; }Except for
<frontmatter>, <backmatter>, and other
topics following the last book part (for
bookmaps).*[class ~= "bookmap/frontmatter"], *[class ~= "bookmap/frontmatter"] *[class ~= "topic/topic"], *[class ~= "bookmap/backmatter"], *[class ~= "bookmap/backmatter"] *[class ~= "topic/topic"], *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) { counter-increment:none !important; counter-reset: chapter part; }
These counters are used in the content, before the titles:
*[class ~= "topic/topic"][is-part] > *[class ~= "topic/title"]:before { content: "Part " counter(part, upper-roman) ". "; } *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"]:before { content: "Chapter " counter(chapter) ". "; }
Except for
<frontmatter>, <backmatter>, and
other topics following the last book part (for
bookmaps).*[class ~= "bookmap/frontmatter"] > *[class ~= "topic/title"]:before, *[class ~= "bookmap/frontmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before, *[class ~= "bookmap/backmatter"] > *[class ~= "topic/title"]:before, *[class ~= "bookmap/backmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before, *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) > *[class ~= "topic/title"]:before, *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before{ content:none !important; }
Headers
Define the string-sets used in the header, using the
part and
chapter
counters:*[class ~= "topic/topic"][is-part] > *[class ~= "topic/title"] { string-set: parttitle " | " counter(part, upper-roman) " - " content(), chaptertitle ""; /* Avoid propagating a past chapter title on a new part */ } *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"] { string-set: chaptertitle " | " counter(chapter) " - " content(); }
Except for front matter, backmatter and other topics following the last book part (for
bookmaps).
*[class ~= "bookmap/frontmatter"] > *[class ~= "topic/title"], *[class ~= "bookmap/frontmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"], *[class ~= "bookmap/backmatter"] > *[class ~= "topic/title"], *[class ~= "bookmap/backmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"], *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) > *[class ~= "topic/title"], *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) *[class ~= "topic/topic"] > *[class ~= "topic/title"]{ string-set: parttitle "", chaptertitle ""; }