Medieval Nordic primary sources
Appendix H: Stylesheets (XSL and CSS) for the handbook
Version 3.0 (12 December 2019)
by Marco Bianchi
H.1 Introduction
Version 3 of the Menota handbook is transformed to html with the stylesheet
handbook_v3.xsl. The stylesheet outputs clean box-based html5. Generally, all
are converted to html classes. All styling is taken care of by
menota_handbook_3.css.@rend
H.2 The HTML
handbook_v3.xls produces clean html5 without any form styling in html code. The html skeleton:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="page">
<div id="main-wrapper">
<div id="header-wrapper">
<header> </header>
<nav> Site-navigation</nav>
</div>
<div id="content-wrapper">
<section id="sidebar" role="navigation">Page-MENU</section>
<main id="content">
<article>HANDBOOK ENTRIES</article>
</main>
</div>
</div>
<footer></footer>
</div>
</body>
</html>H.3 The CSS
The css sheets use css3 but should degrade gracefully in non-compliant browsers. The
main typeface for handbook v3 is Andron, which is read in with css
and thus does not need to be installed on users’ computers.
@font-face
is supported in all major modern browsers. Non compliant
browsers will display a serif-font.@font-face
Handbook v3 uses one css sheet: menota_handbook_3.css
Breaking points for small screens are set at 960px (width of header items and main content 100%) and 450px in portrait mode (larger main font-size).
H.4 XML markup
In the tables below supported xml markup and its corresponding html output is listed.
All values of
and @rend
will be passed to html
@xml:id
and @class
respectively, unless otherwise noted.@id
H.4.1 CSS Block elements
| tei:xml | html | function | Comment |
|---|---|---|---|
| | Code example | See H.7 on styling of code |
| |||
| Inline code example | ||
| | Example of code | See H.7 on styling of code |
| |||
| Inline code example | ||
| | Example of xml code | See H.7 on styling of code |
| |||
| Inline code example | ||
| | Illustration | Typically, a element contains a and a element. See H.6 on styling of images |
| |||
| The figure is placed to the left, with text floating to the right | ||
| The figure is placed to the right, with text floating to the left | ||
| The figure is placed in the center. No floating occurs. | ||
/ | <figcaption span class="imagelabel"> | Figure caption | Should be used together with a sibling and a parent |
| |||
| <figcaption><span class="imagelabel">Fig. <span class="imageid">2.1<>/span>.</span>Caption</figcaption> | Usage in xml: <figDesc n="2.1">Caption</figDesc>, i.e. the figure’s number should passed through and not be put between the tags | |
| | Image | If used together with a parent element , the image element will be wrapped in a element together with its caption. It may, however, also be used alone. |
| |||
| , , , , | Heading | – are chosen according to their position in the dom. If the position does not match, a generic is output. |
| |||
| When no is passed, the xsl will introduce an with a random value | ||
| | List item | |
| | Unordered list | |
| | List | Unordered list |
| |||
| | Ordered list | Ordered (= numbered) list |
| is converted to a css for backwards compatibility with earlier style sheets | ||
| |||
/ | | List item | |
| | Paragraph | |
| |||
| | Blockquote | |
| |||
| | Blockquote | |
| | Table | See H.5 on styling of tables |
| |||
| This value can be used for tables with lists of xml-elements and their attributes. See H.5.1 for more information | ||
| This value can be used for tables with explanations of abbreviations and other glyphs. See H.5.2 for more information | ||
| |||
/ | | Table row | |
| |||
| |||
| |||
| / | Table header | i.e. table header |
/ | or | Table cell | when the parent = |
|
H.4.2 CSS Inline elements
| tei:xml | html | Function | Comment |
|---|---|---|---|
| <span class="attribute"><code>@att</code></span> | xml/html attribute | In a table with = attributes in the first columns are automatically indented 1em. See H.7 on styling of code. |
| | Emphasis | |
| <span class="tag"><code>@att</code></span> | xml/html element | See H.7 on styling of code |
| | Highlighted | |
| |||
| | If contains multiple values, is passed to <span class="bold [othervalue]"> | |
| | If contains multiple values, is passed to <span class="code [othervalue]">See H.7 on styling of code | |
| <span class="codepoint"><code>U+01eb</code></span> | A Unicode codepoint: U+01eb | Lowercase letters are transformed to uppercase letters in the css stylesheet. |
| <span class="descname"><code>LATIN SMALL LETTER O WITH OGONEK</code></span> | A Unicode descriptive name: LATIN SMALL LETTER O WITH OGONEK | Lowercase letters are transformed to uppercase letters in the css stylesheet. |
| <span class="entity"><code>&oogon;</code></span> | A Unicode entity: &oogon; | |
| <span class="glyph"> | Characters marked upp with are displayed in a deviant color. See also the section about styling tables. | |
| | If contains multiple values, is passed to <span class="italic [othervalue]"> | |
| <span class="red"> | ||
| <span class="blue"> | ||
| <span class="initial"> | ||
| | Line break | |
| | Quoted | |
| | Reference | |
| | ||
| |||
| <code><span class="tag">@att</span></code> | Tagged content | See H.7 on styling of code |
| | Title of a work | |
| <span class="value">'value'</span> | Value of a xml/html element | See H.7 on styling of code. In a table with = values in the first columns are automatically indented 2em |
H.4.3 Generic values for @rend
The following
values can be given to any xml-element with support
for @rend
:@rend
(blue font color)"blue"
(bold style)"bold"
(monospace font)"code"
(red font color)"red"
(italic style)"style"
The following
values can be given to any xml-element that
translates into a block-element in html/css and supports the
@rend
attribute. Percentages are always relative to the width of the
parent element’s width. The available values for @rend
behave the
following way at different screen resolutions:@rend
=... | default | medium screens | small screens |
|---|---|---|---|
| align:left | ||
| align:right | ||
| centered | ||
| text-align:center | ||
| float:none; clear:both (forces the element to be placed on a new line, i.e surrounding text will not float around the element) | ||
| width:10% | width:50% | width:100% |
| width:20% | width:50% | width:100% |
| width:25% | width:50% | width:100% |
| width:30% | width:50% | width:100% |
| width:33,33% | width:50% | width:100% |
| width:40% | width:50% | width:100% |
| width:50% | width:100% | |
| width:60% | width:100% | width:100% |
| width:66,66% | width:100% | width:100% |
| width:70% | width:100% | width:100% |
| width:75% | width:100% | width:100% |
| width:80% | width:100% | width:100% |
| width:90% | width:100% | width:100% |
| width:100% | width:100% | width:100% |
H.5 Styling tables
Tables are structured according to the following pattern in html:
<table>
<colgroup>
<col style="width20">
<col style="width80">
</colgroup>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>The
element is created dynamically if the first row contains cells
with the attribute <colgroup>
. This means that the column widths of the
html table can be controlled with the attribute @rend
in the cells of the
first table row. Below is the xml code of the html table above:@rend
<table>
<row rend="label">
<cell rend="width20"></cell>
<cell rend="width80"></cell>
</row>
<row>
<cell></cell>
<cell></cell>
</row>
</table>H.5.1 Styling tables with explanations of xml-elements
A table with explanations of xml-elements and their attributes (such as H.4.1 above) can be given
=@rend
in the "xml-elements"
element. The
xls stylesheet tries to wrap all rows with a <table>
or a <gi>
in
the first cell into a <tag>
element together with the following rows.
Such tables must adhere to the following principles:<tbody>
- The
tag must have a<table>
with the value@rend"xml-elements" - The first cell of the first row in each block must contain a
or a<gi>
element<tag> - The first cells of all other rows in a block must not contain any
element (otherwise, the respective row will be treated as the first row in a block)<gi>
Strings marked with
and <att>
in the first cell of each row
are indented automatically.<val>
H.5.2 Styling glyph tables
Tables with explanations of abbreviations and other glyphs can be marked upp with
. In such tables, cells containing a tag <table rend="abbr">
(and nothing else) are rendered differently.<hi rend="glyph">
H.6 Styling images
An image and its caption should be structured as follows:
<figure rend="leftalign width33">
<graphic url="path/to/image.jpg" />
<figDesc n="1.2">Figure Caption</figDesc>
</figure>The position and width of the image can be controlled with
in the
wrapping <rend>
element. By default, <figure>
is displayed floating
to the left of the text at a width of 50% with a border around the containing
elements. The figure’s number should passed through <figure>
in @n
.
The xslt adds automatically a figure label. The above <figDesc>
will thus be
rendered as “Fig. 1.2: Figure Caption”.<figDesc>
If used without a wrapping
element, images placed in a
<figure>
element are displayed at their original size without any
border<graphic>
H.7 Styling code
Block level code elements are wrapped into a html
tag that preserves
line breaks, white spaces and indentations. Such elements should thus not follow the
indentation of surrounding xml. The following coding of a CDATA section with
surrounding xml ...<pre>
<p>Some text before the code</p>
<egXML><![CDATA[<figure rend="leftalign width33">
<graphic url="path/to/image.jpg"/>
<figDesc n="1.2">Figure Caption</figDesc>
</figure>]]>
</egXML>
<p>Some text after the code</p>... will be output as:
<figure rend="leftalign width33">
<graphic url="path/to/image.jpg" />
<figDesc n="1.2">Figure Caption</figDesc>
</figure>By default, code within
, <eg>
and <egXML>
is displayed as
a block element. With <code>
=@rend
it can be forced to be
treated as an inline element. Alternatively, the markup "inline"<hi rend="code"> or
may be used for inline code.<tag>
Xml elements, attributes and values should be tagged with their respective semantic
markup:
, <gi>
and <att>
.<val>
H.8 Table of Contents
A table of contents is added automatically in the beginning of each page. The table includes all second level headers.