From cdbcd328e85f33e6ae32f80e62b58415a68fe386 Mon Sep 17 00:00:00 2001 From: Sebastian Flick Date: Fri, 1 Nov 2024 16:34:04 +0100 Subject: [PATCH] update odd for cb --- src/teipb/odd/parzival-verse.odd | 8 +- src/teipb/transform/parzival-verse-epub.xql | 420 +---------------- src/teipb/transform/parzival-verse-fo.xql | 402 +--------------- .../transform/parzival-verse-latex-main.xql | 3 - .../transform/parzival-verse-latex-module.xql | 3 - src/teipb/transform/parzival-verse-latex.xql | 430 +----------------- src/teipb/transform/parzival-verse-print.xql | 423 +---------------- src/teipb/transform/parzival-verse-web.xql | 420 +---------------- src/teipb/transform/parzival-verse.css | 93 ---- 9 files changed, 42 insertions(+), 2160 deletions(-) diff --git a/src/teipb/odd/parzival-verse.odd b/src/teipb/odd/parzival-verse.odd index 6b0ab205..228380d7 100644 --- a/src/teipb/odd/parzival-verse.odd +++ b/src/teipb/odd/parzival-verse.odd @@ -37,11 +37,17 @@ - + [[id]][[content]] + + + + + +

Spalte: [[label]]

diff --git a/src/teipb/transform/parzival-verse-epub.xql b/src/teipb/transform/parzival-verse-epub.xql index 0e0f4361..2e2ab42a 100644 --- a/src/teipb/transform/parzival-verse-epub.xql +++ b/src/teipb/transform/parzival-verse-epub.xql @@ -11,8 +11,6 @@ declare default element namespace "http://www.tei-c.org/ns/1.0"; declare namespace xhtml='http://www.w3.org/1999/xhtml'; -declare namespace mei='http://www.music-encoding.org/ns/mei'; - declare namespace pb='http://teipublisher.com/1.0'; import module namespace css="http://www.tei-c.org/tei-simple/xquery/css"; @@ -27,15 +25,9 @@ import module namespace global="http://www.tei-c.org/tei-simple/config" at "../m declare %private function model:template-l($config as map(*), $node as node()*, $params as map(*)) { {$config?apply-children($config, $node, $params?id)}{$config?apply-children($config, $node, $params?content)}/* }; -(: generated template function for element spec: ptr :) -declare %private function model:template-ptr($config as map(*), $node as node()*, $params as map(*)) { - - Original Clefs - /* -}; -(: generated template function for element spec: mei:mdiv :) -declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) { - /* +(: generated template function for element spec: cb :) +declare %private function model:template-cb($config as map(*), $node as node()*, $params as map(*)) { +

Spalte: {$config?apply-children($config, $node, $params?label)}

/* }; (:~ @@ -78,60 +70,6 @@ declare function model:apply($config as map(*), $input as node()*) { . return typeswitch(.) - case element(licence) return - if (@target) then - html:link($config, ., ("tei-licence1", "licence", css:map-rend-to-class(.)), 'Licence', @target, (), map {}) - else - html:omit($config, ., ("tei-licence2", css:map-rend-to-class(.)), .) - case element(castItem) return - (: Insert item, rendered as described in parent list rendition. :) - html:listItem($config, ., ("tei-castItem", css:map-rend-to-class(.)), ., ()) - case element(listBibl) return - if (bibl) then - html:list($config, ., ("tei-listBibl1", css:map-rend-to-class(.)), ., ()) - else - epub:block($config, ., ("tei-listBibl2", css:map-rend-to-class(.)), .) - case element(item) return - html:listItem($config, ., ("tei-item", css:map-rend-to-class(.)), ., ()) - case element(figure) return - if (head or @rendition='simple:display') then - epub:block($config, ., ("tei-figure1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-figure2", css:map-rend-to-class(.)), .) - case element(teiHeader) return - if ($parameters?header='short') then - epub:block($config, ., ("tei-teiHeader3", css:map-rend-to-class(.)), .) - else - html:metadata($config, ., ("tei-teiHeader4", css:map-rend-to-class(.)), .) - case element(g) return - if (not(text())) then - html:glyph($config, ., ("tei-g1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-g2", css:map-rend-to-class(.)), .) - case element(supplied) return - if (parent::choice) then - html:inline($config, ., ("tei-supplied1", css:map-rend-to-class(.)), .) - else - if (@reason='damage') then - html:inline($config, ., ("tei-supplied2", css:map-rend-to-class(.)), .) - else - if (@reason='illegible' or not(@reason)) then - html:inline($config, ., ("tei-supplied3", css:map-rend-to-class(.)), .) - else - if (@reason='omitted') then - html:inline($config, ., ("tei-supplied4", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-supplied5", css:map-rend-to-class(.)), .) - case element(author) return - if (ancestor::teiHeader) then - epub:block($config, ., ("tei-author1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-author2", css:map-rend-to-class(.)), .) - case element(castList) return - if (child::*) then - html:list($config, ., css:get-rendition(., ("tei-castList", css:map-rend-to-class(.))), castItem, ()) - else - $config?apply($config, ./node()) case element(l) return let $params := map { @@ -143,361 +81,17 @@ declare function model:apply($config as map(*), $input as node()*) { model:template-l($config, ., $params) return epub:block(map:merge(($config, map:entry("template", true()))), ., css:get-rendition(., ("tei-l", "line", css:map-rend-to-class(.))), $content) - case element(closer) return - epub:block($config, ., ("tei-closer", css:map-rend-to-class(.)), .) - case element(ptr) return - if (parent::notatedMusic) then - (: Load and display external MEI :) - let $params := - map { - "url": @target, - "content": . - } - - let $content := - model:template-ptr($config, ., $params) - return - html:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-ptr", css:map-rend-to-class(.)), $content) - else - $config?apply($config, ./node()) - case element(signed) return - if (parent::closer) then - epub:block($config, ., ("tei-signed1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-signed2", css:map-rend-to-class(.)), .) - case element(list) return - html:list($config, ., css:get-rendition(., ("tei-list", css:map-rend-to-class(.))), item, ()) - case element(p) return - html:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .) - case element(q) return - if (l) then - epub:block($config, ., css:get-rendition(., ("tei-q1", css:map-rend-to-class(.))), .) - else - if (ancestor::p or ancestor::cell) then - html:inline($config, ., css:get-rendition(., ("tei-q2", css:map-rend-to-class(.))), .) - else - epub:block($config, ., css:get-rendition(., ("tei-q3", css:map-rend-to-class(.))), .) - case element(epigraph) return - epub:block($config, ., ("tei-epigraph", css:map-rend-to-class(.)), .) - case element(pb) return - if (@facs) then - (: Use the url from the facs attribute to link with IIIF image :) - html:webcomponent($config, ., ("tei-pb1", css:map-rend-to-class(.)), ., 'pb-facs-link', map {"facs": @facs, "label": @n, "emit": 'transcription'}) - else - if (starts-with(@facs, 'iiif:')) then - (: If facs attribute starts with iiif prefix, use the trailing part as a link to the IIIF image :) - html:webcomponent($config, ., ("tei-pb2", css:map-rend-to-class(.)), ., 'pb-facs-link', map {"facs": replace(@facs, '^iiif:(.*)$', '$1'), "label": 'Page', "emit": 'transcription'}) - else - epub:break($config, ., css:get-rendition(., ("tei-pb3", css:map-rend-to-class(.))), ., 'page', (concat(if(@n) then concat(@n,' ') else '',if(@facs) then concat('@',@facs) else ''))) - case element(docTitle) return - epub:block($config, ., css:get-rendition(., ("tei-docTitle", css:map-rend-to-class(.))), .) - case element(lb) return - epub:break($config, ., css:get-rendition(., ("tei-lb", css:map-rend-to-class(.))), ., 'line', @n) - case element(anchor) return - html:anchor($config, ., ("tei-anchor", css:map-rend-to-class(.)), ., @xml:id) - case element(TEI) return - html:document($config, ., ("tei-TEI", css:map-rend-to-class(.)), .) - case element(w) return - html:inline($config, ., ("tei-w", css:map-rend-to-class(.)), .) - case element(stage) return - epub:block($config, ., ("tei-stage", css:map-rend-to-class(.)), .) - case element(titlePage) return - epub:block($config, ., css:get-rendition(., ("tei-titlePage", css:map-rend-to-class(.))), .) - case element(name) return - (: delete me after testing :) - html:inline($config, ., ("tei-name", css:map-rend-to-class(.)), (given-names,surname)) - case element(formula) return - if (@rendition='simple:display') then - epub:block($config, ., ("tei-formula1", css:map-rend-to-class(.)), .) - else - if (@rend='display') then - html:webcomponent($config, ., ("tei-formula4", css:map-rend-to-class(.)), ., 'pb-formula', map {"display": true()}) - else - html:webcomponent($config, ., ("tei-formula5", css:map-rend-to-class(.)), ., 'pb-formula', map {}) - case element(front) return - epub:block($config, ., ("tei-front", css:map-rend-to-class(.)), .) - case element(lg) return - epub:block($config, ., ("tei-lg", css:map-rend-to-class(.)), .) - case element(choice) return - if (sic and corr) then - epub:alternate($config, ., ("tei-choice1", css:map-rend-to-class(.)), ., corr[1], sic[1]) - else - if (abbr and expan) then - epub:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1]) - else - if (orig and reg) then - epub:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1]) - else - $config?apply($config, ./node()) - case element(publicationStmt) return - epub:block($config, ., ("tei-publicationStmt1", css:map-rend-to-class(.)), availability/licence) - case element(hi) return - html:inline($config, ., css:get-rendition(., ("tei-hi", css:map-rend-to-class(.))), .) - case element(role) return - epub:block($config, ., ("tei-role", css:map-rend-to-class(.)), .) - case element(code) return - html:inline($config, ., ("tei-code", css:map-rend-to-class(.)), .) - case element(note) return - epub:note($config, ., ("tei-note", css:map-rend-to-class(.)), ., @place, @n) - case element(dateline) return - epub:block($config, ., ("tei-dateline", css:map-rend-to-class(.)), .) - case element(postscript) return - epub:block($config, ., ("tei-postscript", css:map-rend-to-class(.)), .) - case element(back) return - epub:block($config, ., ("tei-back", css:map-rend-to-class(.)), .) - case element(edition) return - if (ancestor::teiHeader) then - epub:block($config, ., ("tei-edition", css:map-rend-to-class(.)), .) - else - $config?apply($config, ./node()) - case element(del) return - html:inline($config, ., ("tei-del", css:map-rend-to-class(.)), .) - case element(cell) return - (: Insert table cell. :) - html:cell($config, ., ("tei-cell", css:map-rend-to-class(.)), ., ()) - case element(div) return - if (@type='title_page') then - epub:block($config, ., ("tei-div1", css:map-rend-to-class(.)), .) - else - if (parent::body or parent::front or parent::back) then - html:section($config, ., ("tei-div2", css:map-rend-to-class(.)), .) - else - epub:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .) - case element(trailer) return - epub:block($config, ., ("tei-trailer", css:map-rend-to-class(.)), .) - case element(graphic) return - html:graphic($config, ., ("tei-graphic", css:map-rend-to-class(.)), ., @url, @width, @height, @scale, desc) - case element(ref) return - if (@target) then - html:link($config, ., ("tei-ref1", css:map-rend-to-class(.)), ., @target, (), map {}) - else - if (not(node())) then - html:link($config, ., ("tei-ref2", css:map-rend-to-class(.)), @target, @target, (), map {}) - else - html:inline($config, ., ("tei-ref3", css:map-rend-to-class(.)), .) - case element(titlePart) return - epub:block($config, ., css:get-rendition(., ("tei-titlePart", css:map-rend-to-class(.))), .) - case element(ab) return - html:paragraph($config, ., ("tei-ab", css:map-rend-to-class(.)), .) - case element(add) return - html:inline($config, ., ("tei-add", css:map-rend-to-class(.)), .) - case element(revisionDesc) return - html:omit($config, ., ("tei-revisionDesc", css:map-rend-to-class(.)), .) - case element(head) return - if ($parameters?header='short') then - html:inline($config, ., ("tei-head1", css:map-rend-to-class(.)), replace(string-join(.//text()[not(parent::ref)]), '^(.*?)[^\w]*$', '$1')) - else - if (parent::figure) then - epub:block($config, ., ("tei-head2", css:map-rend-to-class(.)), .) - else - if (parent::table) then - epub:block($config, ., ("tei-head3", css:map-rend-to-class(.)), .) - else - if (parent::lg) then - epub:block($config, ., ("tei-head4", css:map-rend-to-class(.)), .) - else - if (parent::list) then - epub:block($config, ., ("tei-head5", css:map-rend-to-class(.)), .) - else - if (parent::div) then - html:heading($config, ., ("tei-head6", css:map-rend-to-class(.)), ., count(ancestor::div)) - else - epub:block($config, ., ("tei-head7", css:map-rend-to-class(.)), .) - case element(roleDesc) return - epub:block($config, ., ("tei-roleDesc", css:map-rend-to-class(.)), .) - case element(opener) return - epub:block($config, ., ("tei-opener", css:map-rend-to-class(.)), .) - case element(speaker) return - epub:block($config, ., ("tei-speaker", css:map-rend-to-class(.)), .) - case element(castGroup) return - if (child::*) then - (: Insert list. :) - html:list($config, ., ("tei-castGroup", css:map-rend-to-class(.)), castItem|castGroup, ()) - else - $config?apply($config, ./node()) - case element(time) return - html:inline($config, ., ("tei-time", css:map-rend-to-class(.)), .) - case element(bibl) return - if (parent::listBibl) then - html:listItem($config, ., ("tei-bibl1", css:map-rend-to-class(.)), ., ()) - else - html:inline($config, ., ("tei-bibl2", css:map-rend-to-class(.)), .) - case element(imprimatur) return - epub:block($config, ., ("tei-imprimatur", css:map-rend-to-class(.)), .) - case element(salute) return - if (parent::closer) then - html:inline($config, ., ("tei-salute1", css:map-rend-to-class(.)), .) - else - epub:block($config, ., ("tei-salute2", css:map-rend-to-class(.)), .) - case element(unclear) return - html:inline($config, ., ("tei-unclear", css:map-rend-to-class(.)), .) - case element(argument) return - epub:block($config, ., ("tei-argument", css:map-rend-to-class(.)), .) - case element(date) return - if (@when) then - epub:alternate($config, ., ("tei-date1", css:map-rend-to-class(.)), ., ., @when) - else - html:inline($config, ., ("tei-date2", css:map-rend-to-class(.)), .) - case element(title) return - if ($parameters?header='short') then - html:heading($config, ., ("tei-title1", css:map-rend-to-class(.)), ., 5) - else - if (parent::titleStmt/parent::fileDesc) then - ( - if (preceding-sibling::title) then - html:text($config, ., ("tei-title2", css:map-rend-to-class(.)), ' — ') - else - (), - html:inline($config, ., ("tei-title3", css:map-rend-to-class(.)), .) - ) - - else - if (not(@level) and parent::bibl) then - html:inline($config, ., ("tei-title4", css:map-rend-to-class(.)), .) - else - if (@level='m' or not(@level)) then - ( - html:inline($config, ., ("tei-title5", css:map-rend-to-class(.)), .), - if (ancestor::biblFull) then - html:text($config, ., ("tei-title6", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='s' or @level='j') then - ( - html:inline($config, ., ("tei-title7", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - html:text($config, ., ("tei-title8", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='u' or @level='a') then - ( - html:inline($config, ., ("tei-title9", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - html:text($config, ., ("tei-title10", css:map-rend-to-class(.)), '. ') - else - () - ) - - else - html:inline($config, ., ("tei-title11", css:map-rend-to-class(.)), .) - case element(corr) return - if (parent::choice and count(parent::*/*) gt 1) then - (: simple inline, if in parent choice. :) - html:inline($config, ., ("tei-corr1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-corr2", css:map-rend-to-class(.)), .) - case element(foreign) return - html:inline($config, ., ("tei-foreign", css:map-rend-to-class(.)), .) - case element(mei:mdiv) return - (: Single MEI mdiv needs to be wrapped to create complete MEI document :) + case element(cb) return let $params := map { - "data": let $title := root($parameters?root)//titleStmt/title let $data := {.} return serialize($data), + "label": @xml:id, "content": . } let $content := - model:template-mei_mdiv($config, ., $params) + model:template-cb($config, ., $params) return - html:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-mei_mdiv", css:map-rend-to-class(.)), $content) - case element(cit) return - if (child::quote and child::bibl) then - (: Insert citation :) - html:cit($config, ., ("tei-cit", css:map-rend-to-class(.)), ., ()) - else - $config?apply($config, ./node()) - case element(sic) return - if (parent::choice and count(parent::*/*) gt 1) then - html:inline($config, ., ("tei-sic1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-sic2", css:map-rend-to-class(.)), .) - case element(fileDesc) return - if ($parameters?header='short') then - ( - epub:block($config, ., ("tei-fileDesc1", "header-short", css:map-rend-to-class(.)), titleStmt), - epub:block($config, ., ("tei-fileDesc2", "header-short", css:map-rend-to-class(.)), editionStmt), - epub:block($config, ., ("tei-fileDesc3", "header-short", css:map-rend-to-class(.)), publicationStmt), - (: Output abstract containing demo description :) - epub:block($config, ., ("tei-fileDesc4", "sample-description", css:map-rend-to-class(.)), ../profileDesc/abstract) - ) - - else - html:title($config, ., ("tei-fileDesc5", css:map-rend-to-class(.)), titleStmt) - case element(titleStmt) return - if ($parameters?mode='title') then - html:heading($config, ., ("tei-titleStmt3", css:map-rend-to-class(.)), title[not(@type)], 5) - else - if ($parameters?header='short') then - ( - html:link($config, ., ("tei-titleStmt4", css:map-rend-to-class(.)), title[1], $parameters?doc, (), map {}), - epub:block($config, ., ("tei-titleStmt5", css:map-rend-to-class(.)), subsequence(title, 2)), - epub:block($config, ., ("tei-titleStmt6", css:map-rend-to-class(.)), author) - ) - - else - epub:block($config, ., ("tei-titleStmt7", css:map-rend-to-class(.)), .) - case element(body) return - ( - html:index($config, ., ("tei-body1", css:map-rend-to-class(.)), 'toc', .), - epub:block($config, ., ("tei-body2", css:map-rend-to-class(.)), .) - ) - - case element(spGrp) return - epub:block($config, ., ("tei-spGrp", css:map-rend-to-class(.)), .) - case element(fw) return - if (ancestor::p or ancestor::ab) then - html:inline($config, ., ("tei-fw1", css:map-rend-to-class(.)), .) - else - epub:block($config, ., ("tei-fw2", css:map-rend-to-class(.)), .) - case element(encodingDesc) return - html:omit($config, ., ("tei-encodingDesc", css:map-rend-to-class(.)), .) - case element(gap) return - if (desc) then - html:inline($config, ., ("tei-gap1", css:map-rend-to-class(.)), .) - else - if (@extent) then - html:inline($config, ., ("tei-gap2", css:map-rend-to-class(.)), @extent) - else - html:inline($config, ., ("tei-gap3", css:map-rend-to-class(.)), .) - case element(quote) return - if (ancestor::p) then - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - html:inline($config, ., css:get-rendition(., ("tei-quote1", css:map-rend-to-class(.))), .) - else - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - epub:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .) - case element(notatedMusic) return - html:figure($config, ., ("tei-notatedMusic", css:map-rend-to-class(.)), (ptr, mei:mdiv), label) - case element(seg) return - html:inline($config, ., ("tei-seg1", "glory-initial", css:map-rend-to-class(.)), .) - case element(profileDesc) return - html:omit($config, ., ("tei-profileDesc", css:map-rend-to-class(.)), .) - case element(row) return - if (@role='label') then - html:row($config, ., ("tei-row1", css:map-rend-to-class(.)), .) - else - (: Insert table row. :) - html:row($config, ., ("tei-row2", css:map-rend-to-class(.)), .) - case element(floatingText) return - epub:block($config, ., ("tei-floatingText", css:map-rend-to-class(.)), .) - case element(text) return - html:body($config, ., ("tei-text", css:map-rend-to-class(.)), .) - case element(byline) return - epub:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .) - case element(sp) return - epub:block($config, ., ("tei-sp", css:map-rend-to-class(.)), .) - case element(table) return - html:table($config, ., ("tei-table", css:map-rend-to-class(.)), .) - case element(cb) return - epub:block($config, ., ("tei-cb", css:map-rend-to-class(.)), .) - case element(group) return - epub:block($config, ., ("tei-group", css:map-rend-to-class(.)), .) + epub:block(map:merge(($config, map:entry("template", true()))), ., ("tei-cb", css:map-rend-to-class(.)), $content) case element(exist:match) return html:match($config, ., .) case element() return diff --git a/src/teipb/transform/parzival-verse-fo.xql b/src/teipb/transform/parzival-verse-fo.xql index 2bc44ebc..5c5e2d00 100644 --- a/src/teipb/transform/parzival-verse-fo.xql +++ b/src/teipb/transform/parzival-verse-fo.xql @@ -11,8 +11,6 @@ declare default element namespace "http://www.tei-c.org/ns/1.0"; declare namespace xhtml='http://www.w3.org/1999/xhtml'; -declare namespace mei='http://www.music-encoding.org/ns/mei'; - declare namespace pb='http://teipublisher.com/1.0'; import module namespace css="http://www.tei-c.org/tei-simple/xquery/css"; @@ -25,15 +23,9 @@ import module namespace global="http://www.tei-c.org/tei-simple/config" at "../m declare %private function model:template-l($config as map(*), $node as node()*, $params as map(*)) { {$config?apply-children($config, $node, $params?id)}{$config?apply-children($config, $node, $params?content)}/* }; -(: generated template function for element spec: ptr :) -declare %private function model:template-ptr($config as map(*), $node as node()*, $params as map(*)) { - - Original Clefs - /* -}; -(: generated template function for element spec: mei:mdiv :) -declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) { - /* +(: generated template function for element spec: cb :) +declare %private function model:template-cb($config as map(*), $node as node()*, $params as map(*)) { +

Spalte: {$config?apply-children($config, $node, $params?label)}

/* }; (:~ @@ -76,54 +68,6 @@ declare function model:apply($config as map(*), $input as node()*) { . return typeswitch(.) - case element(licence) return - fo:omit($config, ., ("tei-licence2", css:map-rend-to-class(.)), .) - case element(castItem) return - (: Insert item, rendered as described in parent list rendition. :) - fo:listItem($config, ., ("tei-castItem", css:map-rend-to-class(.)), ., ()) - case element(listBibl) return - if (bibl) then - fo:list($config, ., ("tei-listBibl1", css:map-rend-to-class(.)), ., ()) - else - fo:block($config, ., ("tei-listBibl2", css:map-rend-to-class(.)), .) - case element(item) return - fo:listItem($config, ., ("tei-item", css:map-rend-to-class(.)), ., ()) - case element(figure) return - if (head or @rendition='simple:display') then - fo:block($config, ., ("tei-figure1", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-figure2", css:map-rend-to-class(.)), .) - case element(teiHeader) return - fo:omit($config, ., ("tei-teiHeader2", css:map-rend-to-class(.)), .) - case element(g) return - if (not(text())) then - fo:glyph($config, ., ("tei-g1", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-g2", css:map-rend-to-class(.)), .) - case element(supplied) return - if (parent::choice) then - fo:inline($config, ., ("tei-supplied1", css:map-rend-to-class(.)), .) - else - if (@reason='damage') then - fo:inline($config, ., ("tei-supplied2", css:map-rend-to-class(.)), .) - else - if (@reason='illegible' or not(@reason)) then - fo:inline($config, ., ("tei-supplied3", css:map-rend-to-class(.)), .) - else - if (@reason='omitted') then - fo:inline($config, ., ("tei-supplied4", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-supplied5", css:map-rend-to-class(.)), .) - case element(author) return - if (ancestor::teiHeader) then - fo:block($config, ., ("tei-author1", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-author2", css:map-rend-to-class(.)), .) - case element(castList) return - if (child::*) then - fo:list($config, ., css:get-rendition(., ("tei-castList", css:map-rend-to-class(.))), castItem, ()) - else - $config?apply($config, ./node()) case element(l) return let $params := map { @@ -135,349 +79,17 @@ declare function model:apply($config as map(*), $input as node()*) { model:template-l($config, ., $params) return fo:block(map:merge(($config, map:entry("template", true()))), ., css:get-rendition(., ("tei-l", "line", css:map-rend-to-class(.))), $content) - case element(closer) return - fo:block($config, ., ("tei-closer", css:map-rend-to-class(.)), .) - case element(ptr) return - if (parent::notatedMusic) then - (: Load and display external MEI :) - let $params := - map { - "url": @target, - "content": . - } - - let $content := - model:template-ptr($config, ., $params) - return - fo:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-ptr", css:map-rend-to-class(.)), $content) - else - $config?apply($config, ./node()) - case element(signed) return - if (parent::closer) then - fo:block($config, ., ("tei-signed1", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-signed2", css:map-rend-to-class(.)), .) - case element(list) return - fo:list($config, ., css:get-rendition(., ("tei-list", css:map-rend-to-class(.))), item, ()) - case element(p) return - fo:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .) - case element(q) return - if (l) then - fo:block($config, ., css:get-rendition(., ("tei-q1", css:map-rend-to-class(.))), .) - else - if (ancestor::p or ancestor::cell) then - fo:inline($config, ., css:get-rendition(., ("tei-q2", css:map-rend-to-class(.))), .) - else - fo:block($config, ., css:get-rendition(., ("tei-q3", css:map-rend-to-class(.))), .) - case element(epigraph) return - fo:block($config, ., ("tei-epigraph", css:map-rend-to-class(.)), .) - case element(pb) return - if (@facs) then - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - else - if (starts-with(@facs, 'iiif:')) then - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - else - fo:break($config, ., css:get-rendition(., ("tei-pb3", css:map-rend-to-class(.))), ., 'page', (concat(if(@n) then concat(@n,' ') else '',if(@facs) then concat('@',@facs) else ''))) - case element(docTitle) return - fo:block($config, ., css:get-rendition(., ("tei-docTitle", css:map-rend-to-class(.))), .) - case element(lb) return - fo:break($config, ., css:get-rendition(., ("tei-lb", css:map-rend-to-class(.))), ., 'line', @n) - case element(anchor) return - fo:anchor($config, ., ("tei-anchor", css:map-rend-to-class(.)), ., @xml:id) - case element(TEI) return - fo:document($config, ., ("tei-TEI", css:map-rend-to-class(.)), .) - case element(w) return - fo:inline($config, ., ("tei-w", css:map-rend-to-class(.)), .) - case element(stage) return - fo:block($config, ., ("tei-stage", css:map-rend-to-class(.)), .) - case element(titlePage) return - fo:block($config, ., css:get-rendition(., ("tei-titlePage", css:map-rend-to-class(.))), .) - case element(name) return - (: delete me after testing :) - fo:inline($config, ., ("tei-name", css:map-rend-to-class(.)), (given-names,surname)) - case element(formula) return - if (@rendition='simple:display') then - fo:block($config, ., ("tei-formula1", css:map-rend-to-class(.)), .) - else - if (@rend='display') then - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - else - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - case element(front) return - fo:block($config, ., ("tei-front", css:map-rend-to-class(.)), .) - case element(lg) return - fo:block($config, ., ("tei-lg", css:map-rend-to-class(.)), .) - case element(choice) return - if (sic and corr) then - fo:alternate($config, ., ("tei-choice1", css:map-rend-to-class(.)), ., corr[1], sic[1]) - else - if (abbr and expan) then - fo:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1]) - else - if (orig and reg) then - fo:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1]) - else - $config?apply($config, ./node()) - case element(publicationStmt) return - fo:omit($config, ., ("tei-publicationStmt2", css:map-rend-to-class(.)), .) - case element(hi) return - fo:inline($config, ., css:get-rendition(., ("tei-hi", css:map-rend-to-class(.))), .) - case element(role) return - fo:block($config, ., ("tei-role", css:map-rend-to-class(.)), .) - case element(code) return - fo:inline($config, ., ("tei-code", css:map-rend-to-class(.)), .) - case element(note) return - fo:note($config, ., ("tei-note", css:map-rend-to-class(.)), ., @place, @n) - case element(dateline) return - fo:block($config, ., ("tei-dateline", css:map-rend-to-class(.)), .) - case element(postscript) return - fo:block($config, ., ("tei-postscript", css:map-rend-to-class(.)), .) - case element(back) return - fo:block($config, ., ("tei-back", css:map-rend-to-class(.)), .) - case element(edition) return - if (ancestor::teiHeader) then - fo:block($config, ., ("tei-edition", css:map-rend-to-class(.)), .) - else - $config?apply($config, ./node()) - case element(del) return - fo:inline($config, ., ("tei-del", css:map-rend-to-class(.)), .) - case element(cell) return - (: Insert table cell. :) - fo:cell($config, ., ("tei-cell", css:map-rend-to-class(.)), ., ()) - case element(div) return - if (@type='title_page') then - fo:block($config, ., ("tei-div1", css:map-rend-to-class(.)), .) - else - if (parent::body or parent::front or parent::back) then - fo:section($config, ., ("tei-div2", css:map-rend-to-class(.)), .) - else - fo:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .) - case element(trailer) return - fo:block($config, ., ("tei-trailer", css:map-rend-to-class(.)), .) - case element(graphic) return - fo:graphic($config, ., ("tei-graphic", css:map-rend-to-class(.)), ., @url, @width, @height, @scale, desc) - case element(ref) return - if (@target) then - fo:link($config, ., ("tei-ref1", css:map-rend-to-class(.)), ., @target, map {}) - else - if (not(node())) then - fo:link($config, ., ("tei-ref2", css:map-rend-to-class(.)), @target, @target, map {}) - else - fo:inline($config, ., ("tei-ref3", css:map-rend-to-class(.)), .) - case element(titlePart) return - fo:block($config, ., css:get-rendition(., ("tei-titlePart", css:map-rend-to-class(.))), .) - case element(ab) return - fo:paragraph($config, ., ("tei-ab", css:map-rend-to-class(.)), .) - case element(add) return - fo:inline($config, ., ("tei-add", css:map-rend-to-class(.)), .) - case element(revisionDesc) return - fo:omit($config, ., ("tei-revisionDesc", css:map-rend-to-class(.)), .) - case element(head) return - if ($parameters?header='short') then - fo:inline($config, ., ("tei-head1", css:map-rend-to-class(.)), replace(string-join(.//text()[not(parent::ref)]), '^(.*?)[^\w]*$', '$1')) - else - if (parent::figure) then - fo:block($config, ., ("tei-head2", css:map-rend-to-class(.)), .) - else - if (parent::table) then - fo:block($config, ., ("tei-head3", css:map-rend-to-class(.)), .) - else - if (parent::lg) then - fo:block($config, ., ("tei-head4", css:map-rend-to-class(.)), .) - else - if (parent::list) then - fo:block($config, ., ("tei-head5", css:map-rend-to-class(.)), .) - else - if (parent::div) then - fo:heading($config, ., ("tei-head6", css:map-rend-to-class(.)), ., count(ancestor::div)) - else - fo:block($config, ., ("tei-head7", css:map-rend-to-class(.)), .) - case element(roleDesc) return - fo:block($config, ., ("tei-roleDesc", css:map-rend-to-class(.)), .) - case element(opener) return - fo:block($config, ., ("tei-opener", css:map-rend-to-class(.)), .) - case element(speaker) return - fo:block($config, ., ("tei-speaker", css:map-rend-to-class(.)), .) - case element(castGroup) return - if (child::*) then - (: Insert list. :) - fo:list($config, ., ("tei-castGroup", css:map-rend-to-class(.)), castItem|castGroup, ()) - else - $config?apply($config, ./node()) - case element(time) return - fo:inline($config, ., ("tei-time", css:map-rend-to-class(.)), .) - case element(bibl) return - if (parent::listBibl) then - fo:listItem($config, ., ("tei-bibl1", css:map-rend-to-class(.)), ., ()) - else - fo:inline($config, ., ("tei-bibl2", css:map-rend-to-class(.)), .) - case element(imprimatur) return - fo:block($config, ., ("tei-imprimatur", css:map-rend-to-class(.)), .) - case element(salute) return - if (parent::closer) then - fo:inline($config, ., ("tei-salute1", css:map-rend-to-class(.)), .) - else - fo:block($config, ., ("tei-salute2", css:map-rend-to-class(.)), .) - case element(unclear) return - fo:inline($config, ., ("tei-unclear", css:map-rend-to-class(.)), .) - case element(argument) return - fo:block($config, ., ("tei-argument", css:map-rend-to-class(.)), .) - case element(date) return - fo:inline($config, ., ("tei-date2", css:map-rend-to-class(.)), .) - case element(title) return - if ($parameters?header='short') then - fo:heading($config, ., ("tei-title1", css:map-rend-to-class(.)), ., 5) - else - if (parent::titleStmt/parent::fileDesc) then - ( - if (preceding-sibling::title) then - fo:text($config, ., ("tei-title2", css:map-rend-to-class(.)), ' — ') - else - (), - fo:inline($config, ., ("tei-title3", css:map-rend-to-class(.)), .) - ) - - else - if (not(@level) and parent::bibl) then - fo:inline($config, ., ("tei-title4", css:map-rend-to-class(.)), .) - else - if (@level='m' or not(@level)) then - ( - fo:inline($config, ., ("tei-title5", css:map-rend-to-class(.)), .), - if (ancestor::biblFull) then - fo:text($config, ., ("tei-title6", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='s' or @level='j') then - ( - fo:inline($config, ., ("tei-title7", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - fo:text($config, ., ("tei-title8", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='u' or @level='a') then - ( - fo:inline($config, ., ("tei-title9", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - fo:text($config, ., ("tei-title10", css:map-rend-to-class(.)), '. ') - else - () - ) - - else - fo:inline($config, ., ("tei-title11", css:map-rend-to-class(.)), .) - case element(corr) return - if (parent::choice and count(parent::*/*) gt 1) then - (: simple inline, if in parent choice. :) - fo:inline($config, ., ("tei-corr1", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-corr2", css:map-rend-to-class(.)), .) - case element(foreign) return - fo:inline($config, ., ("tei-foreign", css:map-rend-to-class(.)), .) - case element(mei:mdiv) return - (: Single MEI mdiv needs to be wrapped to create complete MEI document :) + case element(cb) return let $params := map { - "data": let $title := root($parameters?root)//titleStmt/title let $data := {.} return serialize($data), + "label": @xml:id, "content": . } let $content := - model:template-mei_mdiv($config, ., $params) + model:template-cb($config, ., $params) return - fo:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-mei_mdiv", css:map-rend-to-class(.)), $content) - case element(cit) return - if (child::quote and child::bibl) then - (: Insert citation :) - fo:cit($config, ., ("tei-cit", css:map-rend-to-class(.)), ., ()) - else - $config?apply($config, ./node()) - case element(sic) return - if (parent::choice and count(parent::*/*) gt 1) then - fo:inline($config, ., ("tei-sic1", css:map-rend-to-class(.)), .) - else - fo:inline($config, ., ("tei-sic2", css:map-rend-to-class(.)), .) - case element(fileDesc) return - if ($parameters?header='short') then - ( - fo:block($config, ., ("tei-fileDesc1", "header-short", css:map-rend-to-class(.)), titleStmt), - fo:block($config, ., ("tei-fileDesc2", "header-short", css:map-rend-to-class(.)), editionStmt), - fo:block($config, ., ("tei-fileDesc3", "header-short", css:map-rend-to-class(.)), publicationStmt), - (: Output abstract containing demo description :) - fo:block($config, ., ("tei-fileDesc4", "sample-description", css:map-rend-to-class(.)), ../profileDesc/abstract) - ) - - else - fo:title($config, ., ("tei-fileDesc5", css:map-rend-to-class(.)), titleStmt) - case element(titleStmt) return - fo:heading($config, ., ("tei-titleStmt2", css:map-rend-to-class(.)), ., ()) - case element(body) return - ( - fo:index($config, ., ("tei-body1", css:map-rend-to-class(.)), ., 'toc'), - fo:block($config, ., ("tei-body2", css:map-rend-to-class(.)), .) - ) - - case element(spGrp) return - fo:block($config, ., ("tei-spGrp", css:map-rend-to-class(.)), .) - case element(fw) return - if (ancestor::p or ancestor::ab) then - fo:inline($config, ., ("tei-fw1", css:map-rend-to-class(.)), .) - else - fo:block($config, ., ("tei-fw2", css:map-rend-to-class(.)), .) - case element(encodingDesc) return - fo:omit($config, ., ("tei-encodingDesc", css:map-rend-to-class(.)), .) - case element(gap) return - if (desc) then - fo:inline($config, ., ("tei-gap1", css:map-rend-to-class(.)), .) - else - if (@extent) then - fo:inline($config, ., ("tei-gap2", css:map-rend-to-class(.)), @extent) - else - fo:inline($config, ., ("tei-gap3", css:map-rend-to-class(.)), .) - case element(quote) return - if (ancestor::p) then - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - fo:inline($config, ., css:get-rendition(., ("tei-quote1", css:map-rend-to-class(.))), .) - else - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - fo:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .) - case element(notatedMusic) return - fo:figure($config, ., ("tei-notatedMusic", css:map-rend-to-class(.)), (ptr, mei:mdiv), label) - case element(seg) return - fo:inline($config, ., ("tei-seg1", "glory-initial", css:map-rend-to-class(.)), .) - case element(profileDesc) return - fo:omit($config, ., ("tei-profileDesc", css:map-rend-to-class(.)), .) - case element(row) return - if (@role='label') then - fo:row($config, ., ("tei-row1", css:map-rend-to-class(.)), .) - else - (: Insert table row. :) - fo:row($config, ., ("tei-row2", css:map-rend-to-class(.)), .) - case element(floatingText) return - fo:block($config, ., ("tei-floatingText", css:map-rend-to-class(.)), .) - case element(text) return - fo:body($config, ., ("tei-text", css:map-rend-to-class(.)), .) - case element(byline) return - fo:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .) - case element(sp) return - fo:block($config, ., ("tei-sp", css:map-rend-to-class(.)), .) - case element(table) return - fo:table($config, ., ("tei-table", css:map-rend-to-class(.)), .) - case element(cb) return - fo:block($config, ., ("tei-cb", css:map-rend-to-class(.)), .) - case element(group) return - fo:block($config, ., ("tei-group", css:map-rend-to-class(.)), .) + fo:block(map:merge(($config, map:entry("template", true()))), ., ("tei-cb", css:map-rend-to-class(.)), $content) case element() return if (namespace-uri(.) = 'http://www.tei-c.org/ns/1.0') then $config?apply($config, ./node()) diff --git a/src/teipb/transform/parzival-verse-latex-main.xql b/src/teipb/transform/parzival-verse-latex-main.xql index 7ed31629..e24718ee 100644 --- a/src/teipb/transform/parzival-verse-latex-main.xql +++ b/src/teipb/transform/parzival-verse-latex-main.xql @@ -5,9 +5,6 @@ declare variable $xml external; declare variable $parameters external; let $options := map { - "class": "article", - "section-numbers": false(), - "font-size": "11pt", "styles": ["transform/parzival-verse.css"], "collection": "/db/apps/parzival/transform", "parameters": if (exists($parameters)) then $parameters else map {} diff --git a/src/teipb/transform/parzival-verse-latex-module.xql b/src/teipb/transform/parzival-verse-latex-module.xql index 5401d2be..7b5d6e3d 100644 --- a/src/teipb/transform/parzival-verse-latex-module.xql +++ b/src/teipb/transform/parzival-verse-latex-module.xql @@ -8,9 +8,6 @@ import module namespace m='http://www.tei-c.org/pm/models/parzival-verse/latex' declare function pml:transform($xml as node()*, $parameters as map(*)?) { let $options := map { - "class": "article", - "section-numbers": false(), - "font-size": "11pt", "styles": ["transform/parzival-verse.css"], "collection": "/db/apps/parzival/transform", "parameters": if (exists($parameters)) then $parameters else map {} diff --git a/src/teipb/transform/parzival-verse-latex.xql b/src/teipb/transform/parzival-verse-latex.xql index a664af87..f96dd91b 100644 --- a/src/teipb/transform/parzival-verse-latex.xql +++ b/src/teipb/transform/parzival-verse-latex.xql @@ -11,8 +11,6 @@ declare default element namespace "http://www.tei-c.org/ns/1.0"; declare namespace xhtml='http://www.w3.org/1999/xhtml'; -declare namespace mei='http://www.music-encoding.org/ns/mei'; - declare namespace pb='http://teipublisher.com/1.0'; import module namespace css="http://www.tei-c.org/tei-simple/xquery/css"; @@ -25,23 +23,9 @@ import module namespace global="http://www.tei-c.org/tei-simple/config" at "../m declare %private function model:template-l($config as map(*), $node as node()*, $params as map(*)) { {$config?apply-children($config, $node, $params?id)}{$config?apply-children($config, $node, $params?content)}/* }; -(: generated template function for element spec: ptr :) -declare %private function model:template-ptr($config as map(*), $node as node()*, $params as map(*)) { - - Original Clefs - /* -}; -(: generated template function for element spec: formula :) -declare %private function model:template-formula2($config as map(*), $node as node()*, $params as map(*)) { - ``[\begin{equation}`{string-join($config?apply-children($config, $node, $params?content))}`\end{equation}]`` -}; -(: generated template function for element spec: formula :) -declare %private function model:template-formula3($config as map(*), $node as node()*, $params as map(*)) { - ``[\begin{math}`{string-join($config?apply-children($config, $node, $params?content))}`\end{math}]`` -}; -(: generated template function for element spec: mei:mdiv :) -declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) { - /* +(: generated template function for element spec: cb :) +declare %private function model:template-cb($config as map(*), $node as node()*, $params as map(*)) { +

Spalte: {$config?apply-children($config, $node, $params?label)}

/* }; (:~ @@ -84,54 +68,6 @@ declare function model:apply($config as map(*), $input as node()*) { . return typeswitch(.) - case element(licence) return - latex:omit($config, ., ("tei-licence2", css:map-rend-to-class(.)), .) - case element(castItem) return - (: Insert item, rendered as described in parent list rendition. :) - latex:listItem($config, ., ("tei-castItem", css:map-rend-to-class(.)), ., ()) - case element(listBibl) return - if (bibl) then - latex:list($config, ., ("tei-listBibl1", css:map-rend-to-class(.)), ., ()) - else - latex:block($config, ., ("tei-listBibl2", css:map-rend-to-class(.)), .) - case element(item) return - latex:listItem($config, ., ("tei-item", css:map-rend-to-class(.)), ., ()) - case element(figure) return - if (head or @rendition='simple:display') then - latex:block($config, ., ("tei-figure1", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-figure2", css:map-rend-to-class(.)), .) - case element(teiHeader) return - latex:metadata($config, ., ("tei-teiHeader1", css:map-rend-to-class(.)), .) - case element(g) return - if (not(text())) then - latex:glyph($config, ., ("tei-g1", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-g2", css:map-rend-to-class(.)), .) - case element(supplied) return - if (parent::choice) then - latex:inline($config, ., ("tei-supplied1", css:map-rend-to-class(.)), .) - else - if (@reason='damage') then - latex:inline($config, ., ("tei-supplied2", css:map-rend-to-class(.)), .) - else - if (@reason='illegible' or not(@reason)) then - latex:inline($config, ., ("tei-supplied3", css:map-rend-to-class(.)), .) - else - if (@reason='omitted') then - latex:inline($config, ., ("tei-supplied4", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-supplied5", css:map-rend-to-class(.)), .) - case element(author) return - if (ancestor::teiHeader) then - latex:block($config, ., ("tei-author1", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-author2", css:map-rend-to-class(.)), .) - case element(castList) return - if (child::*) then - latex:list($config, ., css:get-rendition(., ("tei-castList", css:map-rend-to-class(.))), castItem, ()) - else - $config?apply($config, ./node()) case element(l) return let $params := map { @@ -143,369 +79,17 @@ declare function model:apply($config as map(*), $input as node()*) { model:template-l($config, ., $params) return latex:block(map:merge(($config, map:entry("template", true()))), ., css:get-rendition(., ("tei-l", "line", css:map-rend-to-class(.))), $content) - case element(closer) return - latex:block($config, ., ("tei-closer", css:map-rend-to-class(.)), .) - case element(ptr) return - if (parent::notatedMusic) then - (: Load and display external MEI :) - let $params := - map { - "url": @target, - "content": . - } - - let $content := - model:template-ptr($config, ., $params) - return - latex:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-ptr", css:map-rend-to-class(.)), $content) - else - $config?apply($config, ./node()) - case element(signed) return - if (parent::closer) then - latex:block($config, ., ("tei-signed1", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-signed2", css:map-rend-to-class(.)), .) - case element(list) return - latex:list($config, ., css:get-rendition(., ("tei-list", css:map-rend-to-class(.))), item, ()) - case element(p) return - latex:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .) - case element(q) return - if (l) then - latex:block($config, ., css:get-rendition(., ("tei-q1", css:map-rend-to-class(.))), .) - else - if (ancestor::p or ancestor::cell) then - latex:inline($config, ., css:get-rendition(., ("tei-q2", css:map-rend-to-class(.))), .) - else - latex:block($config, ., css:get-rendition(., ("tei-q3", css:map-rend-to-class(.))), .) - case element(epigraph) return - latex:block($config, ., ("tei-epigraph", css:map-rend-to-class(.)), .) - case element(pb) return - if (@facs) then - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - else - if (starts-with(@facs, 'iiif:')) then - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - else - latex:break($config, ., css:get-rendition(., ("tei-pb3", css:map-rend-to-class(.))), ., 'page', (concat(if(@n) then concat(@n,' ') else '',if(@facs) then concat('@',@facs) else ''))) - case element(docTitle) return - latex:block($config, ., css:get-rendition(., ("tei-docTitle", css:map-rend-to-class(.))), .) - case element(lb) return - latex:break($config, ., css:get-rendition(., ("tei-lb", css:map-rend-to-class(.))), ., 'line', @n) - case element(anchor) return - latex:anchor($config, ., ("tei-anchor", css:map-rend-to-class(.)), ., @xml:id) - case element(TEI) return - latex:document($config, ., ("tei-TEI", css:map-rend-to-class(.)), .) - case element(w) return - latex:inline($config, ., ("tei-w", css:map-rend-to-class(.)), .) - case element(stage) return - latex:block($config, ., ("tei-stage", css:map-rend-to-class(.)), .) - case element(titlePage) return - latex:block($config, ., css:get-rendition(., ("tei-titlePage", css:map-rend-to-class(.))), .) - case element(name) return - (: delete me after testing :) - latex:inline($config, ., ("tei-name", css:map-rend-to-class(.)), (given-names,surname)) - case element(formula) return - if (@rendition='simple:display') then - latex:block($config, ., ("tei-formula1", css:map-rend-to-class(.)), .) - else - if (@rend="display") then - let $params := - map { - "content": string() - } - - let $content := - model:template-formula2($config, ., $params) - return - latex:inline(map:merge(($config, map:entry("template", true()))), ., ("tei-formula2", css:map-rend-to-class(.)), $content) - else - if (@rend='display') then - (: No function found for behavior: webcomponent :) - $config?apply($config, ./node()) - else - (: More than one model without predicate found for ident formula. Choosing first one. :) - let $params := - map { - "content": string() - } - - let $content := - model:template-formula3($config, ., $params) - return - latex:inline(map:merge(($config, map:entry("template", true()))), ., ("tei-formula3", css:map-rend-to-class(.)), $content) - case element(front) return - latex:block($config, ., ("tei-front", css:map-rend-to-class(.)), .) - case element(lg) return - latex:block($config, ., ("tei-lg", css:map-rend-to-class(.)), .) - case element(choice) return - if (sic and corr) then - latex:alternate($config, ., ("tei-choice1", css:map-rend-to-class(.)), ., corr[1], sic[1]) - else - if (abbr and expan) then - latex:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1]) - else - if (orig and reg) then - latex:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1]) - else - $config?apply($config, ./node()) - case element(publicationStmt) return - latex:omit($config, ., ("tei-publicationStmt2", css:map-rend-to-class(.)), .) - case element(hi) return - latex:inline($config, ., css:get-rendition(., ("tei-hi", css:map-rend-to-class(.))), .) - case element(role) return - latex:block($config, ., ("tei-role", css:map-rend-to-class(.)), .) - case element(code) return - latex:inline($config, ., ("tei-code", css:map-rend-to-class(.)), .) - case element(note) return - latex:note($config, ., ("tei-note", css:map-rend-to-class(.)), ., @place, @n) - case element(dateline) return - latex:block($config, ., ("tei-dateline", css:map-rend-to-class(.)), .) - case element(postscript) return - latex:block($config, ., ("tei-postscript", css:map-rend-to-class(.)), .) - case element(back) return - latex:block($config, ., ("tei-back", css:map-rend-to-class(.)), .) - case element(edition) return - if (ancestor::teiHeader) then - latex:block($config, ., ("tei-edition", css:map-rend-to-class(.)), .) - else - $config?apply($config, ./node()) - case element(del) return - latex:inline($config, ., ("tei-del", css:map-rend-to-class(.)), .) - case element(cell) return - (: Insert table cell. :) - latex:cell($config, ., ("tei-cell", css:map-rend-to-class(.)), ., ()) - case element(div) return - if (@type='title_page') then - latex:block($config, ., ("tei-div1", css:map-rend-to-class(.)), .) - else - if (parent::body or parent::front or parent::back) then - latex:section($config, ., ("tei-div2", css:map-rend-to-class(.)), .) - else - latex:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .) - case element(trailer) return - latex:block($config, ., ("tei-trailer", css:map-rend-to-class(.)), .) - case element(graphic) return - latex:graphic($config, ., ("tei-graphic", css:map-rend-to-class(.)), ., @url, @width, @height, @scale, desc) - case element(ref) return - if (@target) then - latex:link($config, ., ("tei-ref1", css:map-rend-to-class(.)), ., @target, map {}) - else - if (not(node())) then - latex:link($config, ., ("tei-ref2", css:map-rend-to-class(.)), @target, @target, map {}) - else - latex:inline($config, ., ("tei-ref3", css:map-rend-to-class(.)), .) - case element(titlePart) return - latex:block($config, ., css:get-rendition(., ("tei-titlePart", css:map-rend-to-class(.))), .) - case element(ab) return - latex:paragraph($config, ., ("tei-ab", css:map-rend-to-class(.)), .) - case element(add) return - latex:inline($config, ., ("tei-add", css:map-rend-to-class(.)), .) - case element(revisionDesc) return - latex:omit($config, ., ("tei-revisionDesc", css:map-rend-to-class(.)), .) - case element(head) return - if ($parameters?header='short') then - latex:inline($config, ., ("tei-head1", css:map-rend-to-class(.)), replace(string-join(.//text()[not(parent::ref)]), '^(.*?)[^\w]*$', '$1')) - else - if (parent::figure) then - latex:block($config, ., ("tei-head2", css:map-rend-to-class(.)), .) - else - if (parent::table) then - latex:block($config, ., ("tei-head3", css:map-rend-to-class(.)), .) - else - if (parent::lg) then - latex:block($config, ., ("tei-head4", css:map-rend-to-class(.)), .) - else - if (parent::list) then - latex:block($config, ., ("tei-head5", css:map-rend-to-class(.)), .) - else - if (parent::div) then - latex:heading($config, ., ("tei-head6", css:map-rend-to-class(.)), ., count(ancestor::div)) - else - latex:block($config, ., ("tei-head7", css:map-rend-to-class(.)), .) - case element(roleDesc) return - latex:block($config, ., ("tei-roleDesc", css:map-rend-to-class(.)), .) - case element(opener) return - latex:block($config, ., ("tei-opener", css:map-rend-to-class(.)), .) - case element(speaker) return - latex:block($config, ., ("tei-speaker", css:map-rend-to-class(.)), .) - case element(castGroup) return - if (child::*) then - (: Insert list. :) - latex:list($config, ., ("tei-castGroup", css:map-rend-to-class(.)), castItem|castGroup, ()) - else - $config?apply($config, ./node()) - case element(time) return - latex:inline($config, ., ("tei-time", css:map-rend-to-class(.)), .) - case element(bibl) return - if (parent::listBibl) then - latex:listItem($config, ., ("tei-bibl1", css:map-rend-to-class(.)), ., ()) - else - latex:inline($config, ., ("tei-bibl2", css:map-rend-to-class(.)), .) - case element(imprimatur) return - latex:block($config, ., ("tei-imprimatur", css:map-rend-to-class(.)), .) - case element(salute) return - if (parent::closer) then - latex:inline($config, ., ("tei-salute1", css:map-rend-to-class(.)), .) - else - latex:block($config, ., ("tei-salute2", css:map-rend-to-class(.)), .) - case element(unclear) return - latex:inline($config, ., ("tei-unclear", css:map-rend-to-class(.)), .) - case element(argument) return - latex:block($config, ., ("tei-argument", css:map-rend-to-class(.)), .) - case element(date) return - latex:inline($config, ., ("tei-date2", css:map-rend-to-class(.)), .) - case element(title) return - if ($parameters?header='short') then - latex:heading($config, ., ("tei-title1", css:map-rend-to-class(.)), ., 5) - else - if (parent::titleStmt/parent::fileDesc) then - ( - if (preceding-sibling::title) then - latex:text($config, ., ("tei-title2", css:map-rend-to-class(.)), ' — ') - else - (), - latex:inline($config, ., ("tei-title3", css:map-rend-to-class(.)), .) - ) - - else - if (not(@level) and parent::bibl) then - latex:inline($config, ., ("tei-title4", css:map-rend-to-class(.)), .) - else - if (@level='m' or not(@level)) then - ( - latex:inline($config, ., ("tei-title5", css:map-rend-to-class(.)), .), - if (ancestor::biblFull) then - latex:text($config, ., ("tei-title6", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='s' or @level='j') then - ( - latex:inline($config, ., ("tei-title7", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - latex:text($config, ., ("tei-title8", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='u' or @level='a') then - ( - latex:inline($config, ., ("tei-title9", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - latex:text($config, ., ("tei-title10", css:map-rend-to-class(.)), '. ') - else - () - ) - - else - latex:inline($config, ., ("tei-title11", css:map-rend-to-class(.)), .) - case element(corr) return - if (parent::choice and count(parent::*/*) gt 1) then - (: simple inline, if in parent choice. :) - latex:inline($config, ., ("tei-corr1", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-corr2", css:map-rend-to-class(.)), .) - case element(foreign) return - latex:inline($config, ., ("tei-foreign", css:map-rend-to-class(.)), .) - case element(mei:mdiv) return - (: Single MEI mdiv needs to be wrapped to create complete MEI document :) + case element(cb) return let $params := map { - "data": let $title := root($parameters?root)//titleStmt/title let $data := {.} return serialize($data), + "label": @xml:id, "content": . } let $content := - model:template-mei_mdiv($config, ., $params) + model:template-cb($config, ., $params) return - latex:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-mei_mdiv", css:map-rend-to-class(.)), $content) - case element(cit) return - if (child::quote and child::bibl) then - (: Insert citation :) - latex:cit($config, ., ("tei-cit", css:map-rend-to-class(.)), ., ()) - else - $config?apply($config, ./node()) - case element(sic) return - if (parent::choice and count(parent::*/*) gt 1) then - latex:inline($config, ., ("tei-sic1", css:map-rend-to-class(.)), .) - else - latex:inline($config, ., ("tei-sic2", css:map-rend-to-class(.)), .) - case element(fileDesc) return - if ($parameters?header='short') then - ( - latex:block($config, ., ("tei-fileDesc1", "header-short", css:map-rend-to-class(.)), titleStmt), - latex:block($config, ., ("tei-fileDesc2", "header-short", css:map-rend-to-class(.)), editionStmt), - latex:block($config, ., ("tei-fileDesc3", "header-short", css:map-rend-to-class(.)), publicationStmt), - (: Output abstract containing demo description :) - latex:block($config, ., ("tei-fileDesc4", "sample-description", css:map-rend-to-class(.)), ../profileDesc/abstract) - ) - - else - latex:title($config, ., ("tei-fileDesc5", css:map-rend-to-class(.)), titleStmt) - case element(titleStmt) return - (: No function found for behavior: meta :) - $config?apply($config, ./node()) - case element(body) return - ( - latex:index($config, ., ("tei-body1", css:map-rend-to-class(.)), ., 'toc'), - latex:block($config, ., ("tei-body2", css:map-rend-to-class(.)), .) - ) - - case element(spGrp) return - latex:block($config, ., ("tei-spGrp", css:map-rend-to-class(.)), .) - case element(fw) return - if (ancestor::p or ancestor::ab) then - latex:inline($config, ., ("tei-fw1", css:map-rend-to-class(.)), .) - else - latex:block($config, ., ("tei-fw2", css:map-rend-to-class(.)), .) - case element(encodingDesc) return - latex:omit($config, ., ("tei-encodingDesc", css:map-rend-to-class(.)), .) - case element(gap) return - if (desc) then - latex:inline($config, ., ("tei-gap1", css:map-rend-to-class(.)), .) - else - if (@extent) then - latex:inline($config, ., ("tei-gap2", css:map-rend-to-class(.)), @extent) - else - latex:inline($config, ., ("tei-gap3", css:map-rend-to-class(.)), .) - case element(quote) return - if (ancestor::p) then - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - latex:inline($config, ., css:get-rendition(., ("tei-quote1", css:map-rend-to-class(.))), .) - else - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - latex:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .) - case element(notatedMusic) return - latex:figure($config, ., ("tei-notatedMusic", css:map-rend-to-class(.)), (ptr, mei:mdiv), label) - case element(seg) return - latex:inline($config, ., ("tei-seg1", "glory-initial", css:map-rend-to-class(.)), .) - case element(profileDesc) return - latex:omit($config, ., ("tei-profileDesc", css:map-rend-to-class(.)), .) - case element(row) return - if (@role='label') then - latex:row($config, ., ("tei-row1", css:map-rend-to-class(.)), .) - else - (: Insert table row. :) - latex:row($config, ., ("tei-row2", css:map-rend-to-class(.)), .) - case element(floatingText) return - latex:block($config, ., ("tei-floatingText", css:map-rend-to-class(.)), .) - case element(text) return - latex:body($config, ., ("tei-text", css:map-rend-to-class(.)), .) - case element(byline) return - latex:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .) - case element(sp) return - latex:block($config, ., ("tei-sp", css:map-rend-to-class(.)), .) - case element(table) return - latex:table($config, ., ("tei-table", css:map-rend-to-class(.)), ., map {}) - case element(cb) return - latex:block($config, ., ("tei-cb", css:map-rend-to-class(.)), .) - case element(group) return - latex:block($config, ., ("tei-group", css:map-rend-to-class(.)), .) + latex:block(map:merge(($config, map:entry("template", true()))), ., ("tei-cb", css:map-rend-to-class(.)), $content) case element() return if (namespace-uri(.) = 'http://www.tei-c.org/ns/1.0') then $config?apply($config, ./node()) diff --git a/src/teipb/transform/parzival-verse-print.xql b/src/teipb/transform/parzival-verse-print.xql index 63e5c02a..62d7d18c 100644 --- a/src/teipb/transform/parzival-verse-print.xql +++ b/src/teipb/transform/parzival-verse-print.xql @@ -11,8 +11,6 @@ declare default element namespace "http://www.tei-c.org/ns/1.0"; declare namespace xhtml='http://www.w3.org/1999/xhtml'; -declare namespace mei='http://www.music-encoding.org/ns/mei'; - declare namespace pb='http://teipublisher.com/1.0'; import module namespace css="http://www.tei-c.org/tei-simple/xquery/css"; @@ -27,15 +25,9 @@ import module namespace global="http://www.tei-c.org/tei-simple/config" at "../m declare %private function model:template-l($config as map(*), $node as node()*, $params as map(*)) { {$config?apply-children($config, $node, $params?id)}{$config?apply-children($config, $node, $params?content)}/* }; -(: generated template function for element spec: ptr :) -declare %private function model:template-ptr($config as map(*), $node as node()*, $params as map(*)) { - - Original Clefs - /* -}; -(: generated template function for element spec: mei:mdiv :) -declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) { - /* +(: generated template function for element spec: cb :) +declare %private function model:template-cb($config as map(*), $node as node()*, $params as map(*)) { +

Spalte: {$config?apply-children($config, $node, $params?label)}

/* }; (:~ @@ -78,60 +70,6 @@ declare function model:apply($config as map(*), $input as node()*) { . return typeswitch(.) - case element(licence) return - if (@target) then - html:link($config, ., ("tei-licence1", "licence", css:map-rend-to-class(.)), 'Licence', @target, (), map {}) - else - html:omit($config, ., ("tei-licence2", css:map-rend-to-class(.)), .) - case element(castItem) return - (: Insert item, rendered as described in parent list rendition. :) - html:listItem($config, ., ("tei-castItem", css:map-rend-to-class(.)), ., ()) - case element(listBibl) return - if (bibl) then - html:list($config, ., ("tei-listBibl1", css:map-rend-to-class(.)), ., ()) - else - html:block($config, ., ("tei-listBibl2", css:map-rend-to-class(.)), .) - case element(item) return - html:listItem($config, ., ("tei-item", css:map-rend-to-class(.)), ., ()) - case element(figure) return - if (head or @rendition='simple:display') then - html:block($config, ., ("tei-figure1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-figure2", css:map-rend-to-class(.)), .) - case element(teiHeader) return - if ($parameters?header='short') then - html:block($config, ., ("tei-teiHeader3", css:map-rend-to-class(.)), .) - else - html:metadata($config, ., ("tei-teiHeader4", css:map-rend-to-class(.)), .) - case element(g) return - if (not(text())) then - html:glyph($config, ., ("tei-g1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-g2", css:map-rend-to-class(.)), .) - case element(supplied) return - if (parent::choice) then - html:inline($config, ., ("tei-supplied1", css:map-rend-to-class(.)), .) - else - if (@reason='damage') then - html:inline($config, ., ("tei-supplied2", css:map-rend-to-class(.)), .) - else - if (@reason='illegible' or not(@reason)) then - html:inline($config, ., ("tei-supplied3", css:map-rend-to-class(.)), .) - else - if (@reason='omitted') then - html:inline($config, ., ("tei-supplied4", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-supplied5", css:map-rend-to-class(.)), .) - case element(author) return - if (ancestor::teiHeader) then - html:block($config, ., ("tei-author1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-author2", css:map-rend-to-class(.)), .) - case element(castList) return - if (child::*) then - html:list($config, ., css:get-rendition(., ("tei-castList", css:map-rend-to-class(.))), castItem, ()) - else - $config?apply($config, ./node()) case element(l) return let $params := map { @@ -143,364 +81,17 @@ declare function model:apply($config as map(*), $input as node()*) { model:template-l($config, ., $params) return html:block(map:merge(($config, map:entry("template", true()))), ., css:get-rendition(., ("tei-l", "line", css:map-rend-to-class(.))), $content) - case element(closer) return - html:block($config, ., ("tei-closer", css:map-rend-to-class(.)), .) - case element(ptr) return - if (parent::notatedMusic) then - (: Load and display external MEI :) - let $params := - map { - "url": @target, - "content": . - } - - let $content := - model:template-ptr($config, ., $params) - return - html:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-ptr", css:map-rend-to-class(.)), $content) - else - $config?apply($config, ./node()) - case element(signed) return - if (parent::closer) then - html:block($config, ., ("tei-signed1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-signed2", css:map-rend-to-class(.)), .) - case element(list) return - html:list($config, ., css:get-rendition(., ("tei-list", css:map-rend-to-class(.))), item, ()) - case element(p) return - if (ancestor::note) then - html:inline($config, ., ("tei-p1", css:map-rend-to-class(.)), .) - else - html:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .) - case element(q) return - if (l) then - html:block($config, ., css:get-rendition(., ("tei-q1", css:map-rend-to-class(.))), .) - else - if (ancestor::p or ancestor::cell) then - html:inline($config, ., css:get-rendition(., ("tei-q2", css:map-rend-to-class(.))), .) - else - html:block($config, ., css:get-rendition(., ("tei-q3", css:map-rend-to-class(.))), .) - case element(epigraph) return - html:block($config, ., ("tei-epigraph", css:map-rend-to-class(.)), .) - case element(pb) return - if (@facs) then - (: Use the url from the facs attribute to link with IIIF image :) - html:webcomponent($config, ., ("tei-pb1", css:map-rend-to-class(.)), ., 'pb-facs-link', map {"facs": @facs, "label": @n, "emit": 'transcription'}) - else - if (starts-with(@facs, 'iiif:')) then - (: If facs attribute starts with iiif prefix, use the trailing part as a link to the IIIF image :) - html:webcomponent($config, ., ("tei-pb2", css:map-rend-to-class(.)), ., 'pb-facs-link', map {"facs": replace(@facs, '^iiif:(.*)$', '$1'), "label": 'Page', "emit": 'transcription'}) - else - html:break($config, ., css:get-rendition(., ("tei-pb3", css:map-rend-to-class(.))), ., 'page', (concat(if(@n) then concat(@n,' ') else '',if(@facs) then concat('@',@facs) else ''))) - case element(docTitle) return - html:block($config, ., css:get-rendition(., ("tei-docTitle", css:map-rend-to-class(.))), .) - case element(lb) return - html:break($config, ., css:get-rendition(., ("tei-lb", css:map-rend-to-class(.))), ., 'line', @n) - case element(anchor) return - html:anchor($config, ., ("tei-anchor", css:map-rend-to-class(.)), ., @xml:id) - case element(TEI) return - html:document($config, ., ("tei-TEI", css:map-rend-to-class(.)), .) - case element(w) return - html:inline($config, ., ("tei-w", css:map-rend-to-class(.)), .) - case element(stage) return - html:block($config, ., ("tei-stage", css:map-rend-to-class(.)), .) - case element(titlePage) return - html:block($config, ., css:get-rendition(., ("tei-titlePage", css:map-rend-to-class(.))), .) - case element(name) return - (: delete me after testing :) - html:inline($config, ., ("tei-name", css:map-rend-to-class(.)), (given-names,surname)) - case element(formula) return - if (@rendition='simple:display') then - html:block($config, ., ("tei-formula1", css:map-rend-to-class(.)), .) - else - if (@rend='display') then - html:webcomponent($config, ., ("tei-formula4", css:map-rend-to-class(.)), ., 'pb-formula', map {"display": true()}) - else - html:webcomponent($config, ., ("tei-formula5", css:map-rend-to-class(.)), ., 'pb-formula', map {}) - case element(front) return - html:block($config, ., ("tei-front", css:map-rend-to-class(.)), .) - case element(lg) return - html:block($config, ., ("tei-lg", css:map-rend-to-class(.)), .) - case element(choice) return - if (sic and corr) then - printcss:alternate($config, ., ("tei-choice1", css:map-rend-to-class(.)), ., corr[1], sic[1]) - else - if (abbr and expan) then - printcss:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1]) - else - if (orig and reg) then - printcss:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1]) - else - $config?apply($config, ./node()) - case element(publicationStmt) return - html:block($config, ., ("tei-publicationStmt1", css:map-rend-to-class(.)), availability/licence) - case element(hi) return - html:inline($config, ., css:get-rendition(., ("tei-hi", css:map-rend-to-class(.))), .) - case element(role) return - html:block($config, ., ("tei-role", css:map-rend-to-class(.)), .) - case element(code) return - html:inline($config, ., ("tei-code", css:map-rend-to-class(.)), .) - case element(note) return - printcss:note($config, ., ("tei-note", css:map-rend-to-class(.)), ., @place, @n) - case element(dateline) return - html:block($config, ., ("tei-dateline", css:map-rend-to-class(.)), .) - case element(postscript) return - html:block($config, ., ("tei-postscript", css:map-rend-to-class(.)), .) - case element(back) return - html:block($config, ., ("tei-back", css:map-rend-to-class(.)), .) - case element(edition) return - if (ancestor::teiHeader) then - html:block($config, ., ("tei-edition", css:map-rend-to-class(.)), .) - else - $config?apply($config, ./node()) - case element(del) return - html:inline($config, ., ("tei-del", css:map-rend-to-class(.)), .) - case element(cell) return - (: Insert table cell. :) - html:cell($config, ., ("tei-cell", css:map-rend-to-class(.)), ., ()) - case element(div) return - if (@type='title_page') then - html:block($config, ., ("tei-div1", css:map-rend-to-class(.)), .) - else - if (parent::body or parent::front or parent::back) then - html:section($config, ., ("tei-div2", css:map-rend-to-class(.)), .) - else - html:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .) - case element(trailer) return - html:block($config, ., ("tei-trailer", css:map-rend-to-class(.)), .) - case element(graphic) return - html:graphic($config, ., ("tei-graphic", css:map-rend-to-class(.)), ., @url, @width, @height, @scale, desc) - case element(ref) return - if (@target) then - html:link($config, ., ("tei-ref1", css:map-rend-to-class(.)), ., @target, (), map {}) - else - if (not(node())) then - html:link($config, ., ("tei-ref2", css:map-rend-to-class(.)), @target, @target, (), map {}) - else - html:inline($config, ., ("tei-ref3", css:map-rend-to-class(.)), .) - case element(titlePart) return - html:block($config, ., css:get-rendition(., ("tei-titlePart", css:map-rend-to-class(.))), .) - case element(ab) return - html:paragraph($config, ., ("tei-ab", css:map-rend-to-class(.)), .) - case element(add) return - html:inline($config, ., ("tei-add", css:map-rend-to-class(.)), .) - case element(revisionDesc) return - html:omit($config, ., ("tei-revisionDesc", css:map-rend-to-class(.)), .) - case element(head) return - if ($parameters?header='short') then - html:inline($config, ., ("tei-head1", css:map-rend-to-class(.)), replace(string-join(.//text()[not(parent::ref)]), '^(.*?)[^\w]*$', '$1')) - else - if (parent::figure) then - html:block($config, ., ("tei-head2", css:map-rend-to-class(.)), .) - else - if (parent::table) then - html:block($config, ., ("tei-head3", css:map-rend-to-class(.)), .) - else - if (parent::lg) then - html:block($config, ., ("tei-head4", css:map-rend-to-class(.)), .) - else - if (parent::list) then - html:block($config, ., ("tei-head5", css:map-rend-to-class(.)), .) - else - if (parent::div) then - html:heading($config, ., ("tei-head6", css:map-rend-to-class(.)), ., count(ancestor::div)) - else - html:block($config, ., ("tei-head7", css:map-rend-to-class(.)), .) - case element(roleDesc) return - html:block($config, ., ("tei-roleDesc", css:map-rend-to-class(.)), .) - case element(opener) return - html:block($config, ., ("tei-opener", css:map-rend-to-class(.)), .) - case element(speaker) return - html:block($config, ., ("tei-speaker", css:map-rend-to-class(.)), .) - case element(castGroup) return - if (child::*) then - (: Insert list. :) - html:list($config, ., ("tei-castGroup", css:map-rend-to-class(.)), castItem|castGroup, ()) - else - $config?apply($config, ./node()) - case element(time) return - html:inline($config, ., ("tei-time", css:map-rend-to-class(.)), .) - case element(bibl) return - if (parent::listBibl) then - html:listItem($config, ., ("tei-bibl1", css:map-rend-to-class(.)), ., ()) - else - html:inline($config, ., ("tei-bibl2", css:map-rend-to-class(.)), .) - case element(imprimatur) return - html:block($config, ., ("tei-imprimatur", css:map-rend-to-class(.)), .) - case element(salute) return - if (parent::closer) then - html:inline($config, ., ("tei-salute1", css:map-rend-to-class(.)), .) - else - html:block($config, ., ("tei-salute2", css:map-rend-to-class(.)), .) - case element(unclear) return - html:inline($config, ., ("tei-unclear", css:map-rend-to-class(.)), .) - case element(argument) return - html:block($config, ., ("tei-argument", css:map-rend-to-class(.)), .) - case element(date) return - if (@when) then - printcss:alternate($config, ., ("tei-date1", css:map-rend-to-class(.)), ., ., @when) - else - html:inline($config, ., ("tei-date2", css:map-rend-to-class(.)), .) - case element(title) return - if ($parameters?header='short') then - html:heading($config, ., ("tei-title1", css:map-rend-to-class(.)), ., 5) - else - if (parent::titleStmt/parent::fileDesc) then - ( - if (preceding-sibling::title) then - html:text($config, ., ("tei-title2", css:map-rend-to-class(.)), ' — ') - else - (), - html:inline($config, ., ("tei-title3", css:map-rend-to-class(.)), .) - ) - - else - if (not(@level) and parent::bibl) then - html:inline($config, ., ("tei-title4", css:map-rend-to-class(.)), .) - else - if (@level='m' or not(@level)) then - ( - html:inline($config, ., ("tei-title5", css:map-rend-to-class(.)), .), - if (ancestor::biblFull) then - html:text($config, ., ("tei-title6", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='s' or @level='j') then - ( - html:inline($config, ., ("tei-title7", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - html:text($config, ., ("tei-title8", css:map-rend-to-class(.)), ', ') - else - () - ) - - else - if (@level='u' or @level='a') then - ( - html:inline($config, ., ("tei-title9", css:map-rend-to-class(.)), .), - if (following-sibling::* and ( ancestor::biblFull)) then - html:text($config, ., ("tei-title10", css:map-rend-to-class(.)), '. ') - else - () - ) - - else - html:inline($config, ., ("tei-title11", css:map-rend-to-class(.)), .) - case element(corr) return - if (parent::choice and count(parent::*/*) gt 1) then - (: simple inline, if in parent choice. :) - html:inline($config, ., ("tei-corr1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-corr2", css:map-rend-to-class(.)), .) - case element(foreign) return - html:inline($config, ., ("tei-foreign", css:map-rend-to-class(.)), .) - case element(mei:mdiv) return - (: Single MEI mdiv needs to be wrapped to create complete MEI document :) + case element(cb) return let $params := map { - "data": let $title := root($parameters?root)//titleStmt/title let $data := {.} return serialize($data), + "label": @xml:id, "content": . } let $content := - model:template-mei_mdiv($config, ., $params) + model:template-cb($config, ., $params) return - html:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-mei_mdiv", css:map-rend-to-class(.)), $content) - case element(cit) return - if (child::quote and child::bibl) then - (: Insert citation :) - html:cit($config, ., ("tei-cit", css:map-rend-to-class(.)), ., ()) - else - $config?apply($config, ./node()) - case element(sic) return - if (parent::choice and count(parent::*/*) gt 1) then - html:inline($config, ., ("tei-sic1", css:map-rend-to-class(.)), .) - else - html:inline($config, ., ("tei-sic2", css:map-rend-to-class(.)), .) - case element(fileDesc) return - if ($parameters?header='short') then - ( - html:block($config, ., ("tei-fileDesc1", "header-short", css:map-rend-to-class(.)), titleStmt), - html:block($config, ., ("tei-fileDesc2", "header-short", css:map-rend-to-class(.)), editionStmt), - html:block($config, ., ("tei-fileDesc3", "header-short", css:map-rend-to-class(.)), publicationStmt), - (: Output abstract containing demo description :) - html:block($config, ., ("tei-fileDesc4", "sample-description", css:map-rend-to-class(.)), ../profileDesc/abstract) - ) - - else - html:title($config, ., ("tei-fileDesc5", css:map-rend-to-class(.)), titleStmt) - case element(titleStmt) return - if ($parameters?mode='title') then - html:heading($config, ., ("tei-titleStmt3", css:map-rend-to-class(.)), title[not(@type)], 5) - else - if ($parameters?header='short') then - ( - html:link($config, ., ("tei-titleStmt4", css:map-rend-to-class(.)), title[1], $parameters?doc, (), map {}), - html:block($config, ., ("tei-titleStmt5", css:map-rend-to-class(.)), subsequence(title, 2)), - html:block($config, ., ("tei-titleStmt6", css:map-rend-to-class(.)), author) - ) - - else - html:block($config, ., ("tei-titleStmt7", css:map-rend-to-class(.)), .) - case element(body) return - ( - html:index($config, ., ("tei-body1", css:map-rend-to-class(.)), 'toc', .), - html:block($config, ., ("tei-body2", css:map-rend-to-class(.)), .) - ) - - case element(spGrp) return - html:block($config, ., ("tei-spGrp", css:map-rend-to-class(.)), .) - case element(fw) return - if (ancestor::p or ancestor::ab) then - html:inline($config, ., ("tei-fw1", css:map-rend-to-class(.)), .) - else - html:block($config, ., ("tei-fw2", css:map-rend-to-class(.)), .) - case element(encodingDesc) return - html:omit($config, ., ("tei-encodingDesc", css:map-rend-to-class(.)), .) - case element(gap) return - if (desc) then - html:inline($config, ., ("tei-gap1", css:map-rend-to-class(.)), .) - else - if (@extent) then - html:inline($config, ., ("tei-gap2", css:map-rend-to-class(.)), @extent) - else - html:inline($config, ., ("tei-gap3", css:map-rend-to-class(.)), .) - case element(quote) return - if (ancestor::p) then - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - html:inline($config, ., css:get-rendition(., ("tei-quote1", css:map-rend-to-class(.))), .) - else - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - html:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .) - case element(notatedMusic) return - html:figure($config, ., ("tei-notatedMusic", css:map-rend-to-class(.)), (ptr, mei:mdiv), label) - case element(seg) return - html:inline($config, ., ("tei-seg1", "glory-initial", css:map-rend-to-class(.)), .) - case element(profileDesc) return - html:omit($config, ., ("tei-profileDesc", css:map-rend-to-class(.)), .) - case element(row) return - if (@role='label') then - html:row($config, ., ("tei-row1", css:map-rend-to-class(.)), .) - else - (: Insert table row. :) - html:row($config, ., ("tei-row2", css:map-rend-to-class(.)), .) - case element(floatingText) return - html:block($config, ., ("tei-floatingText", css:map-rend-to-class(.)), .) - case element(text) return - html:body($config, ., ("tei-text", css:map-rend-to-class(.)), .) - case element(byline) return - html:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .) - case element(sp) return - html:block($config, ., ("tei-sp", css:map-rend-to-class(.)), .) - case element(table) return - html:table($config, ., ("tei-table", css:map-rend-to-class(.)), .) - case element(cb) return - html:block($config, ., ("tei-cb", css:map-rend-to-class(.)), .) - case element(group) return - html:block($config, ., ("tei-group", css:map-rend-to-class(.)), .) + html:block(map:merge(($config, map:entry("template", true()))), ., ("tei-cb", css:map-rend-to-class(.)), $content) case element(exist:match) return html:match($config, ., .) case element() return diff --git a/src/teipb/transform/parzival-verse-web.xql b/src/teipb/transform/parzival-verse-web.xql index 6e469948..d85f34b5 100644 --- a/src/teipb/transform/parzival-verse-web.xql +++ b/src/teipb/transform/parzival-verse-web.xql @@ -11,8 +11,6 @@ declare default element namespace "http://www.tei-c.org/ns/1.0"; declare namespace xhtml='http://www.w3.org/1999/xhtml'; -declare namespace mei='http://www.music-encoding.org/ns/mei'; - declare namespace pb='http://teipublisher.com/1.0'; import module namespace css="http://www.tei-c.org/tei-simple/xquery/css"; @@ -25,15 +23,9 @@ import module namespace global="http://www.tei-c.org/tei-simple/config" at "../m declare %private function model:template-l($config as map(*), $node as node()*, $params as map(*)) { {$config?apply-children($config, $node, $params?id)}{$config?apply-children($config, $node, $params?content)}/* }; -(: generated template function for element spec: ptr :) -declare %private function model:template-ptr($config as map(*), $node as node()*, $params as map(*)) { - - Original Clefs - /* -}; -(: generated template function for element spec: mei:mdiv :) -declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) { - /* +(: generated template function for element spec: cb :) +declare %private function model:template-cb($config as map(*), $node as node()*, $params as map(*)) { +

Spalte: {$config?apply-children($config, $node, $params?label)}

/* }; (:~ @@ -76,60 +68,6 @@ declare function model:apply($config as map(*), $input as node()*) { . return typeswitch(.) - case element(licence) return - if (@target) then - html:link($config, ., ("tei-licence1", "licence", css:map-rend-to-class(.)), 'Licence', @target, (), map {}) => model:map($node, $trackIds) - else - html:omit($config, ., ("tei-licence2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(castItem) return - (: Insert item, rendered as described in parent list rendition. :) - html:listItem($config, ., ("tei-castItem", css:map-rend-to-class(.)), ., ()) => model:map($node, $trackIds) - case element(listBibl) return - if (bibl) then - html:list($config, ., ("tei-listBibl1", css:map-rend-to-class(.)), ., ()) => model:map($node, $trackIds) - else - html:block($config, ., ("tei-listBibl2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(item) return - html:listItem($config, ., ("tei-item", css:map-rend-to-class(.)), ., ()) => model:map($node, $trackIds) - case element(figure) return - if (head or @rendition='simple:display') then - html:block($config, ., ("tei-figure1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-figure2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(teiHeader) return - if ($parameters?header='short') then - html:block($config, ., ("tei-teiHeader3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:metadata($config, ., ("tei-teiHeader4", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(g) return - if (not(text())) then - html:glyph($config, ., ("tei-g1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-g2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(supplied) return - if (parent::choice) then - html:inline($config, ., ("tei-supplied1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (@reason='damage') then - html:inline($config, ., ("tei-supplied2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (@reason='illegible' or not(@reason)) then - html:inline($config, ., ("tei-supplied3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (@reason='omitted') then - html:inline($config, ., ("tei-supplied4", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-supplied5", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(author) return - if (ancestor::teiHeader) then - html:block($config, ., ("tei-author1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-author2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(castList) return - if (child::*) then - html:list($config, ., css:get-rendition(., ("tei-castList", css:map-rend-to-class(.))), castItem, ()) => model:map($node, $trackIds) - else - $config?apply($config, ./node()) case element(l) return let $params := map { @@ -141,361 +79,17 @@ declare function model:apply($config as map(*), $input as node()*) { model:template-l($config, ., $params) return html:block(map:merge(($config, map:entry("template", true()))), ., css:get-rendition(., ("tei-l", "line", css:map-rend-to-class(.))), $content) => model:map($node, $trackIds) - case element(closer) return - html:block($config, ., ("tei-closer", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(ptr) return - if (parent::notatedMusic) then - (: Load and display external MEI :) - let $params := - map { - "url": @target, - "content": . - } - - let $content := - model:template-ptr($config, ., $params) - return - html:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-ptr", css:map-rend-to-class(.)), $content) => model:map($node, $trackIds) - else - $config?apply($config, ./node()) - case element(signed) return - if (parent::closer) then - html:block($config, ., ("tei-signed1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-signed2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(list) return - html:list($config, ., css:get-rendition(., ("tei-list", css:map-rend-to-class(.))), item, ()) => model:map($node, $trackIds) - case element(p) return - html:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(q) return - if (l) then - html:block($config, ., css:get-rendition(., ("tei-q1", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - else - if (ancestor::p or ancestor::cell) then - html:inline($config, ., css:get-rendition(., ("tei-q2", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - else - html:block($config, ., css:get-rendition(., ("tei-q3", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(epigraph) return - html:block($config, ., ("tei-epigraph", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(pb) return - if (@facs) then - (: Use the url from the facs attribute to link with IIIF image :) - html:webcomponent($config, ., ("tei-pb1", css:map-rend-to-class(.)), ., 'pb-facs-link', map {"facs": @facs, "label": @n, "emit": 'transcription'}) => model:map($node, $trackIds) - else - if (starts-with(@facs, 'iiif:')) then - (: If facs attribute starts with iiif prefix, use the trailing part as a link to the IIIF image :) - html:webcomponent($config, ., ("tei-pb2", css:map-rend-to-class(.)), ., 'pb-facs-link', map {"facs": replace(@facs, '^iiif:(.*)$', '$1'), "label": 'Page', "emit": 'transcription'}) => model:map($node, $trackIds) - else - html:break($config, ., css:get-rendition(., ("tei-pb3", css:map-rend-to-class(.))), ., 'page', (concat(if(@n) then concat(@n,' ') else '',if(@facs) then concat('@',@facs) else ''))) => model:map($node, $trackIds) - case element(docTitle) return - html:block($config, ., css:get-rendition(., ("tei-docTitle", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(lb) return - html:break($config, ., css:get-rendition(., ("tei-lb", css:map-rend-to-class(.))), ., 'line', @n) => model:map($node, $trackIds) - case element(anchor) return - html:anchor($config, ., ("tei-anchor", css:map-rend-to-class(.)), ., @xml:id) => model:map($node, $trackIds) - case element(TEI) return - html:document($config, ., ("tei-TEI", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(w) return - html:inline($config, ., ("tei-w", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(stage) return - html:block($config, ., ("tei-stage", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(titlePage) return - html:block($config, ., css:get-rendition(., ("tei-titlePage", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(name) return - (: delete me after testing :) - html:inline($config, ., ("tei-name", css:map-rend-to-class(.)), (given-names,surname)) => model:map($node, $trackIds) - case element(formula) return - if (@rendition='simple:display') then - html:block($config, ., ("tei-formula1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (@rend='display') then - html:webcomponent($config, ., ("tei-formula4", css:map-rend-to-class(.)), ., 'pb-formula', map {"display": true()}) => model:map($node, $trackIds) - else - html:webcomponent($config, ., ("tei-formula5", css:map-rend-to-class(.)), ., 'pb-formula', map {}) => model:map($node, $trackIds) - case element(front) return - html:block($config, ., ("tei-front", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(lg) return - html:block($config, ., ("tei-lg", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(choice) return - if (sic and corr) then - html:alternate($config, ., ("tei-choice1", css:map-rend-to-class(.)), ., corr[1], sic[1], map {}) => model:map($node, $trackIds) - else - if (abbr and expan) then - html:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1], map {}) => model:map($node, $trackIds) - else - if (orig and reg) then - html:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1], map {}) => model:map($node, $trackIds) - else - $config?apply($config, ./node()) - case element(publicationStmt) return - html:block($config, ., ("tei-publicationStmt1", css:map-rend-to-class(.)), availability/licence) => model:map($node, $trackIds) - case element(hi) return - html:inline($config, ., css:get-rendition(., ("tei-hi", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(role) return - html:block($config, ., ("tei-role", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(code) return - html:inline($config, ., ("tei-code", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(note) return - html:note($config, ., ("tei-note", css:map-rend-to-class(.)), ., @place, @n) => model:map($node, $trackIds) - case element(dateline) return - html:block($config, ., ("tei-dateline", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(postscript) return - html:block($config, ., ("tei-postscript", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(back) return - html:block($config, ., ("tei-back", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(edition) return - if (ancestor::teiHeader) then - html:block($config, ., ("tei-edition", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - $config?apply($config, ./node()) - case element(del) return - html:inline($config, ., ("tei-del", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(cell) return - (: Insert table cell. :) - html:cell($config, ., ("tei-cell", css:map-rend-to-class(.)), ., ()) => model:map($node, $trackIds) - case element(div) return - if (@type='title_page') then - html:block($config, ., ("tei-div1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (parent::body or parent::front or parent::back) then - html:section($config, ., ("tei-div2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(trailer) return - html:block($config, ., ("tei-trailer", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(graphic) return - html:graphic($config, ., ("tei-graphic", css:map-rend-to-class(.)), ., @url, @width, @height, @scale, desc) => model:map($node, $trackIds) - case element(ref) return - if (@target) then - html:link($config, ., ("tei-ref1", css:map-rend-to-class(.)), ., @target, (), map {}) => model:map($node, $trackIds) - else - if (not(node())) then - html:link($config, ., ("tei-ref2", css:map-rend-to-class(.)), @target, @target, (), map {}) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-ref3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(titlePart) return - html:block($config, ., css:get-rendition(., ("tei-titlePart", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(ab) return - html:paragraph($config, ., ("tei-ab", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(add) return - html:inline($config, ., ("tei-add", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(revisionDesc) return - html:omit($config, ., ("tei-revisionDesc", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(head) return - if ($parameters?header='short') then - html:inline($config, ., ("tei-head1", css:map-rend-to-class(.)), replace(string-join(.//text()[not(parent::ref)]), '^(.*?)[^\w]*$', '$1')) => model:map($node, $trackIds) - else - if (parent::figure) then - html:block($config, ., ("tei-head2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (parent::table) then - html:block($config, ., ("tei-head3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (parent::lg) then - html:block($config, ., ("tei-head4", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (parent::list) then - html:block($config, ., ("tei-head5", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (parent::div) then - html:heading($config, ., ("tei-head6", css:map-rend-to-class(.)), ., count(ancestor::div)) => model:map($node, $trackIds) - else - html:block($config, ., ("tei-head7", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(roleDesc) return - html:block($config, ., ("tei-roleDesc", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(opener) return - html:block($config, ., ("tei-opener", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(speaker) return - html:block($config, ., ("tei-speaker", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(castGroup) return - if (child::*) then - (: Insert list. :) - html:list($config, ., ("tei-castGroup", css:map-rend-to-class(.)), castItem|castGroup, ()) => model:map($node, $trackIds) - else - $config?apply($config, ./node()) - case element(time) return - html:inline($config, ., ("tei-time", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(bibl) return - if (parent::listBibl) then - html:listItem($config, ., ("tei-bibl1", css:map-rend-to-class(.)), ., ()) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-bibl2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(imprimatur) return - html:block($config, ., ("tei-imprimatur", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(salute) return - if (parent::closer) then - html:inline($config, ., ("tei-salute1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:block($config, ., ("tei-salute2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(unclear) return - html:inline($config, ., ("tei-unclear", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(argument) return - html:block($config, ., ("tei-argument", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(date) return - if (@when) then - html:alternate($config, ., ("tei-date1", css:map-rend-to-class(.)), ., ., @when, map {}) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-date2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(title) return - if ($parameters?header='short') then - html:heading($config, ., ("tei-title1", css:map-rend-to-class(.)), ., 5) => model:map($node, $trackIds) - else - if (parent::titleStmt/parent::fileDesc) then - ( - if (preceding-sibling::title) then - html:text($config, ., ("tei-title2", css:map-rend-to-class(.)), ' — ') => model:map($node, $trackIds) - else - (), - html:inline($config, ., ("tei-title3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - ) - - else - if (not(@level) and parent::bibl) then - html:inline($config, ., ("tei-title4", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (@level='m' or not(@level)) then - ( - html:inline($config, ., ("tei-title5", css:map-rend-to-class(.)), .) => model:map($node, $trackIds), - if (ancestor::biblFull) then - html:text($config, ., ("tei-title6", css:map-rend-to-class(.)), ', ') => model:map($node, $trackIds) - else - () - ) - - else - if (@level='s' or @level='j') then - ( - html:inline($config, ., ("tei-title7", css:map-rend-to-class(.)), .) => model:map($node, $trackIds), - if (following-sibling::* and ( ancestor::biblFull)) then - html:text($config, ., ("tei-title8", css:map-rend-to-class(.)), ', ') => model:map($node, $trackIds) - else - () - ) - - else - if (@level='u' or @level='a') then - ( - html:inline($config, ., ("tei-title9", css:map-rend-to-class(.)), .) => model:map($node, $trackIds), - if (following-sibling::* and ( ancestor::biblFull)) then - html:text($config, ., ("tei-title10", css:map-rend-to-class(.)), '. ') => model:map($node, $trackIds) - else - () - ) - - else - html:inline($config, ., ("tei-title11", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(corr) return - if (parent::choice and count(parent::*/*) gt 1) then - (: simple inline, if in parent choice. :) - html:inline($config, ., ("tei-corr1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-corr2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(foreign) return - html:inline($config, ., ("tei-foreign", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(mei:mdiv) return - (: Single MEI mdiv needs to be wrapped to create complete MEI document :) + case element(cb) return let $params := map { - "data": let $title := root($parameters?root)//titleStmt/title let $data := {.} return serialize($data), + "label": @xml:id, "content": . } let $content := - model:template-mei_mdiv($config, ., $params) + model:template-cb($config, ., $params) return - html:pass-through(map:merge(($config, map:entry("template", true()))), ., ("tei-mei_mdiv", css:map-rend-to-class(.)), $content) => model:map($node, $trackIds) - case element(cit) return - if (child::quote and child::bibl) then - (: Insert citation :) - html:cit($config, ., ("tei-cit", css:map-rend-to-class(.)), ., ()) => model:map($node, $trackIds) - else - $config?apply($config, ./node()) - case element(sic) return - if (parent::choice and count(parent::*/*) gt 1) then - html:inline($config, ., ("tei-sic1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-sic2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(fileDesc) return - if ($parameters?header='short') then - ( - html:block($config, ., ("tei-fileDesc1", "header-short", css:map-rend-to-class(.)), titleStmt) => model:map($node, $trackIds), - html:block($config, ., ("tei-fileDesc2", "header-short", css:map-rend-to-class(.)), editionStmt) => model:map($node, $trackIds), - html:block($config, ., ("tei-fileDesc3", "header-short", css:map-rend-to-class(.)), publicationStmt) => model:map($node, $trackIds), - (: Output abstract containing demo description :) - html:block($config, ., ("tei-fileDesc4", "sample-description", css:map-rend-to-class(.)), ../profileDesc/abstract) => model:map($node, $trackIds) - ) - - else - html:title($config, ., ("tei-fileDesc5", css:map-rend-to-class(.)), titleStmt) => model:map($node, $trackIds) - case element(titleStmt) return - if ($parameters?mode='title') then - html:heading($config, ., ("tei-titleStmt3", css:map-rend-to-class(.)), title[not(@type)], 5) => model:map($node, $trackIds) - else - if ($parameters?header='short') then - ( - html:link($config, ., ("tei-titleStmt4", css:map-rend-to-class(.)), title[1], $parameters?doc, (), map {}) => model:map($node, $trackIds), - html:block($config, ., ("tei-titleStmt5", css:map-rend-to-class(.)), subsequence(title, 2)) => model:map($node, $trackIds), - html:block($config, ., ("tei-titleStmt6", css:map-rend-to-class(.)), author) => model:map($node, $trackIds) - ) - - else - html:block($config, ., ("tei-titleStmt7", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(body) return - ( - html:index($config, ., ("tei-body1", css:map-rend-to-class(.)), 'toc', .) => model:map($node, $trackIds), - html:block($config, ., ("tei-body2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - ) - - case element(spGrp) return - html:block($config, ., ("tei-spGrp", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(fw) return - if (ancestor::p or ancestor::ab) then - html:inline($config, ., ("tei-fw1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - html:block($config, ., ("tei-fw2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(encodingDesc) return - html:omit($config, ., ("tei-encodingDesc", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(gap) return - if (desc) then - html:inline($config, ., ("tei-gap1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - if (@extent) then - html:inline($config, ., ("tei-gap2", css:map-rend-to-class(.)), @extent) => model:map($node, $trackIds) - else - html:inline($config, ., ("tei-gap3", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(quote) return - if (ancestor::p) then - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - html:inline($config, ., css:get-rendition(., ("tei-quote1", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - else - (: If it is inside a paragraph then it is inline, otherwise it is block level :) - html:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .) => model:map($node, $trackIds) - case element(notatedMusic) return - html:figure($config, ., ("tei-notatedMusic", css:map-rend-to-class(.)), (ptr, mei:mdiv), label) => model:map($node, $trackIds) - case element(seg) return - html:inline($config, ., ("tei-seg1", "glory-initial", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(profileDesc) return - html:omit($config, ., ("tei-profileDesc", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(row) return - if (@role='label') then - html:row($config, ., ("tei-row1", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - else - (: Insert table row. :) - html:row($config, ., ("tei-row2", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(floatingText) return - html:block($config, ., ("tei-floatingText", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(text) return - html:body($config, ., ("tei-text", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(byline) return - html:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(sp) return - html:block($config, ., ("tei-sp", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(table) return - html:table($config, ., ("tei-table", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(cb) return - html:block($config, ., ("tei-cb", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) - case element(group) return - html:block($config, ., ("tei-group", css:map-rend-to-class(.)), .) => model:map($node, $trackIds) + html:block(map:merge(($config, map:entry("template", true()))), ., ("tei-cb", css:map-rend-to-class(.)), $content) => model:map($node, $trackIds) case element(exist:match) return html:match($config, ., .) case element() return diff --git a/src/teipb/transform/parzival-verse.css b/src/teipb/transform/parzival-verse.css index 1dcfd6cf..a4b30c66 100644 --- a/src/teipb/transform/parzival-verse.css +++ b/src/teipb/transform/parzival-verse.css @@ -1,98 +1,5 @@ /* Generated stylesheet. Do not edit. */ /* Global styles */ -.simple_allcaps { text-transform: uppercase; } -.simple_blackletter { font-family: fantasy; } -.simple_bold { font-weight: bold; } -.simple_bottombraced { padding-bottom: 2pt; border-bottom: dashed gray 2pt; } -.simple_block { display:block; } -.simple_boxed { padding: 2pt; border: solid black 1pt; } -.simple_centre { text-align: center; } -.simple_cursive { font-family: cursive; } -.simple_doublestrikethrough { text-decoration: line-through; color: red; } -.simple_doubleunderline { text-decoration: underline; color: red; } -.simple_dropcap { font-size : 6em; font-family: cursive; font-weight : bold; vertical-align: top; height: 1em; line-height: 1em; float : left; width : 1em; color : #c00; margin: 0em; padding: 0px; } -.simple_float { float:right; display: block; font-size: smaller; clear: right; padding: 4pt; width: 15%; } -.simple_hyphen { } -.simple_inline { display:inline; } -.simple_italic { font-style: italic; } -.simple_justify { text-align: justify; } -.simple_larger { font-size: larger; } -.simple_left { text-align: left; } -.simple_leftbraced { padding-left: 2pt; border-left: dotted gray 2pt; } -.simple_letterspace { letter-spacing: 0.5em; } -.simple_literal { font-family:monospace; white-space:pre; } -.simple_normalstyle { font-style:roman; } -.simple_normalweight { font-weight:normal; } -.simple_right { text-align: right; } -.simple_rightbraced { padding-right: 2pt; border-right: dotted gray 2pt; } -.simple_rotateleft { -webkit-transform: rotate(90deg); transform: rotate(90deg); } -.simple_rotateright { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } -.simple_rules { border: 1px solid black; padding: 2px;border-collapse:collapse;border-spacing:0; } -.simple_smallcaps { font-variant: small-caps; } -.simple_smaller { font-size: smaller; } -.simple_strikethrough { text-decoration: line-through; } -.simple_subscript { vertical-align: bottom; font-size: smaller; } -.simple_superscript { vertical-align: super; font-size: smaller; } -.simple_topbraced { padding-top: 2pt; border-top: dotted gray 2pt; } -.simple_typewriter { font-family:monospace; } -.simple_underline { text-decoration: underline; } -.simple_wavyunderline { text-decoration: underline; text-decoration-style: wavy; } /* Model rendition styles */ - -.tei-supplied2:before { content:"<"; } -.tei-supplied2:after { content:">"; } -.tei-supplied3:before { content:"["; } -.tei-supplied3:after { content:"]"; } -.tei-supplied4:before { content:"("; } -.tei-supplied4:after { content:")"; } -.tei-supplied5:before { content:"{"; } -.tei-supplied5:after { content:"}"; } -.tei-castList { list-style: ordered; } -.tei-signed1 { text-align: right; } -.tei-signed2 { font-style: italic; } -.tei-p2 { text-align: justify; } -.tei-q1 { margin-left: 10px; margin-right: 10px; } -.tei-q2:before { content: '‘'; } -.tei-q2:after { content: '’'; } -.tei-q3 { margin-left: 10px; margin-right: 10px; } -.tei-pb3 { display: block; margin-left: 4pt; color: grey; float: right; } -.tei-pb3:before { content: '[Page '; } -.tei-pb3:after { content: ']'; } -.tei-docTitle { font-size: larger; } -.tei-stage { font-style: italic; } -.tei-titlePage { text-align: center; } -.tei-hi { font-style: italic; } -.tei-code { font-family:monospace } -.tei-edition:before { content: 'Edition: '; } -.tei-del { text-decoration: line-through; } -.tei-div1 { border: 1px solid black; padding: 5px; } -.tei-trailer { color: green; } -.tei-add { color: green; text-decoration: underline; } -.tei-head2 { font-style: italic; } -.tei-head3 { font-style: italic; } -.tei-head4 { font-style: italic; } -.tei-head5 { font-weight: bold; } -.tei-speaker { font-style:italic; } -.tei-unclear:after { content: ' [?] '; } -.tei-title5 { font-style: italic; } -.tei-title7 { font-style: italic; } -.tei-title9 { font-style: italic; } -.tei-title11 { font-style: italic; } -.tei-corr2:before { content: '['; } -.tei-corr2:after { content: ']'; } -.tei-foreign { font-style:italic; } -.tei-sic2:before { content: '{'; } -.tei-sic2:after { content: '}'; } -.tei-gap1 { color: grey; } -.tei-gap2:before { content: '[..'; } -.tei-gap2:after { content: '..]'; } -.tei-gap2 { color: grey; } -.tei-gap3:before { content: '[...]'; } -.tei-quote1:before { content: '‘'; } -.tei-quote1:after { content: '’'; } -.tei-quote2 { margin-left: 10px; margin-right: 10px; } -.tei-row1 { font-weight: bold; } -.tei-floatingText { margin: 6pt; border: solid black 1pt; } -.tei-table { font-size: smaller; background-color: #F0F0F0; } \ No newline at end of file