...
 
Commits (3)
......@@ -2847,6 +2847,7 @@ declare function pmf:code($config as map(*), $node as element(), $class as xs:st
<para>For longer documents, embedding the entire content in a page may not be too user-friendly. A better way is to use the library of webcomponents
provided by TEI Publisher. This way, we can show the content page by page or division by division, allowing the reader to navigate between
sections.</para>
<programlisting role="codepen" xlink:href="wolfgangmm#YzXEvvw"></programlisting>
<para>Because webcomponents are part of the HTML5 standard and supported natively by most modern browsers, we can easily import the component library
which is at the core of the TEI Publisher app and reuse the components it provides in other contexts. They should work in any HTML5 page, no matter if
it was written by hand, is generated by PHP, Python or a CMS.</para>
......@@ -2879,7 +2880,6 @@ declare function pmf:code($config as map(*), $node as element(), $class as xs:st
<para><tag>pb-navigation</tag> adds forward/backward navigation buttons to the page, allowing the user to switch to the next/previous page of the
document. You can use various types of buttons, but in this case we're choosing a <tag>paper-fab</tag> element, which creates a rounded, floating button
(<tag>paper-fab</tag> is part of the standard <link xlink:href="https://www.webcomponents.org/element/@polymer/paper-fab">components library</link>).</para>
<para>Please have a look at the <link xlink:href="../embed.html" xlink:show="new">working example page</link> to see everything in action and read through its <link xlink:href="embed.html" role="source">source code</link>.</para>
</section>
</section>
......
......@@ -161,6 +161,7 @@ declare function local:recompile($source as xs:string, $root as xs:string) {
declare function local:save($oddPath as xs:string, $root as xs:string, $data as xs:string) {
let $odd := local:add-tags-decl(doc($root || "/" || $oddPath))
(: let $odd := doc($root || "/" || $oddPath) :)
let $parsed := parse-xml($data)
let $updated := local:update($odd, $parsed, $odd)
let $serialized := serialize($updated,
......@@ -257,6 +258,10 @@ declare function local:add-tags-decl($nodes as node()*) {
}
case element(TEI) return
element { node-name($node) } {
for $prefix in in-scope-prefixes($node)[. != "http://www.tei-c.org/ns/1.0"][. != ""]
let $namespace := namespace-uri-for-prefix($prefix, $node)
return
namespace { $prefix } { $namespace },
$node/@*,
local:add-tags-decl($node/teiHeader),
$node/* except $node/teiHeader
......
......@@ -531,8 +531,8 @@ declare function pages:parse-params($node as node(), $model as map(*)) {
typeswitch($token)
case element(fn:non-match) return $token/string()
case element(fn:match) return
let $paramName := $token/fn:group[1]
let $default := $token/fn:group[2]
let $paramName := $token/fn:group[1]/string()
let $default := $token/fn:group[2]/string()
let $found := [
request:get-parameter($paramName, $default),
$model($paramName),
......
......@@ -6,6 +6,8 @@
<title>Processing Model for Docbook v5
<desc>Processing of Docbook format</desc>
</title>
<title type="short">Docbook v5 </title>
......@@ -93,11 +95,11 @@
<iframe xmlns="" src="[[src]]" width="[[width]]" height="[[height]]" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen="allowfullscreen"> </iframe>
</pb:template>
</pb:behaviour>
<rendition source="docbook.css"/>
<rendition selector="h3">
font-family: serif;
font-weight: 400;
</rendition>
<rendition source="docbook.css"/>
</tagsDecl>
</encodingDesc>
</teiHeader>
......@@ -214,6 +216,8 @@
<model predicate="$parameters?mode='breadcrumbs'" behaviour="inline">
<outputRendition xml:space="preserve" scope="before">
......@@ -231,6 +235,8 @@
</outputRendition>
</model>
<model predicate="parent::note" behaviour="inline"/>
......@@ -374,6 +380,8 @@
<param name="content" value="text()"/>
<outputRendition xml:space="preserve">
......@@ -385,12 +393,21 @@ white-space: pre-wrap;
</outputRendition>
</model>
<model output="latex" behaviour="code">
<param name="language" value="@language"/>
</model>
<modelGrp output="web">
<model predicate="@role='codepen'" behaviour="webcomponent">
<param name="hash" value="substring-after(@xlink:href, '#')"/>
<param name="user" value="substring-before(@xlink:href, '#')"/>
<param name="name" value="'pb-codepen'"/>
<param name="theme" value="'dark'"/>
<param name="height" value="480"/>
</model>
<model predicate="parent::cell|parent::para|parent::ab" behaviour="inline" cssClass="code"/>
<model behaviour="webcomponent">
<param name="name" value="'pb-code-highlight'"/>
......@@ -405,6 +422,8 @@ white-space: pre-wrap;
<param name="content" value="text()"/>
<outputRendition xml:space="preserve">
......@@ -416,6 +435,8 @@ white-space: pre-wrap;
</outputRendition>
</model>
<model output="latex" behaviour="code"/>
......@@ -447,6 +468,8 @@ white-space: pre-wrap;
<model output="epub" behaviour="block">
<outputRendition xml:space="preserve">
......@@ -463,6 +486,8 @@ padding: 1em 0 1em .5em;
</outputRendition>
</model>
<model output="latex" behaviour="inline">
......@@ -499,10 +524,14 @@ padding: 1em 0 1em .5em;
[[content]] <iron-icon icon="icons:open-in-new"/>
</pb-edit-xml></pb:template>
<outputRendition xml:space="preserve">
text-decoration: underline;
--iron-icon-height: 16px;
vertical-align: top;
cursor: pointer;
</outputRendition>
</model>
<model predicate="@linkend" behaviour="link">
......@@ -523,6 +552,8 @@ cursor: pointer;
<model behaviour="inline">
<outputRendition xml:space="preserve">
......@@ -543,6 +574,8 @@ cursor: pointer;
</outputRendition>
</model>
</elementSpec>
......@@ -577,6 +610,8 @@ Not available in PDF edition. Go to \url{[[content]]} to view.
<model behaviour="block">
<outputRendition xml:space="preserve">
......@@ -591,6 +626,8 @@ border-left: 3px solid #c0c0c0;
</outputRendition>
</model>
</elementSpec>
......@@ -599,6 +636,8 @@ border-left: 3px solid #c0c0c0;
<param name="content" value="format-date(., '[MNn] [D1], [Y0001]', 'en_US', (), ())"/>
<outputRendition xml:space="preserve" scope="before">
......@@ -617,6 +656,8 @@ border-left: 3px solid #c0c0c0;
</outputRendition>
<outputRendition xml:space="preserve">
color: #808080;
......
......@@ -170,7 +170,6 @@ declare function model:apply($config as map(*), $input as node()*) {
return
typeswitch(.)
case element(article) return
(: Output LaTeX prolog :)
let $params :=
map {
"image-dir": $parameters?image-dir,
......@@ -291,7 +290,6 @@ declare function model:apply($config as map(*), $input as node()*) {
else
latex:inline($config, ., ("tei-emphasis2"), .)
case element(code) return
(: Output inline code example :)
let $params :=
map {
"content": .
......
......@@ -215,7 +215,7 @@ declare function model:apply($config as map(*), $input as node()*) {
else
fo:cell($config, ., ("tei-td2"), ., ())
case element(programlisting) return
fo:block($config, ., ("tei-programlisting5", "programlisting"), .)
fo:block($config, ., ("tei-programlisting6", "programlisting"), .)
case element(synopsis) return
fo:block($config, ., ("tei-synopsis3", "programlisting"), .)
case element(example) return
......
......@@ -208,10 +208,13 @@ declare function model:apply($config as map(*), $input as node()*) {
else
html:cell($config, ., ("tei-td2"), ., ())
case element(programlisting) return
if (parent::cell|parent::para|parent::ab) then
html:inline($config, ., ("tei-programlisting3", "code"), .)
if (@role='codepen') then
html:webcomponent($config, ., ("tei-programlisting3"), ., 'pb-codepen', map {"hash": substring-after(@xlink:href, '#'), "user": substring-before(@xlink:href, '#'), "theme": 'dark', "height": 480})
else
html:webcomponent($config, ., ("tei-programlisting4"), text(), 'pb-code-highlight', map {"lang": @language})
if (parent::cell|parent::para|parent::ab) then
html:inline($config, ., ("tei-programlisting4", "code"), .)
else
html:webcomponent($config, ., ("tei-programlisting5"), text(), 'pb-code-highlight', map {"lang": @language})
case element(synopsis) return
html:webcomponent($config, ., ("tei-synopsis4"), ., 'pb-code-highlight', map {"lang": @language})
case element(example) return
......