Skip to content

Commit

Permalink
odd edit
Browse files Browse the repository at this point in the history
  • Loading branch information
flicksolutions committed Jan 10, 2025
1 parent cbd45b8 commit bfc3a33
Show file tree
Hide file tree
Showing 18 changed files with 1,208 additions and 236 deletions.
25 changes: 23 additions & 2 deletions src/teipb/odd/parzival.odd
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
</elementSpec>
<elementSpec ident="name" mode="add">
<model behaviour="inline">
<param name="content" value="."/>
<pb:template xmlns="" xml:space="preserve">.</pb:template>
<param name="default" value="."/>
<param name="ref" value="@ref"/>
<pb:template xmlns="" xml:space="preserve"><span data-ref="[[ref]]">[[default]]</span></pb:template>
</model>
</elementSpec>
<elementSpec ident="reg" mode="add">
Expand Down Expand Up @@ -96,9 +97,29 @@
</model>
</elementSpec>
<elementSpec ident="hi" mode="change">
<model predicate="@rend='rot'" behaviour="inline" cssClass="red"/>
<model predicate="@rend='unterstrichen'" behaviour="inline" cssClass="underline"/>
<model predicate="@rend='rasur'" behaviour="inline" cssClass="rasure"/>
</elementSpec>
<elementSpec ident="choice" mode="change">
<model predicate="am and ex" behaviour="inline">
<param name="default" value="ex[1]"/>
<param name="alternate" value="am[1]"/>
<pb:template xmlns="" xml:space="preserve">([[default]])</pb:template>
</model>
<model predicate="sic and corr" behaviour="alternate">
<param name="default" value="corr[1]"/>
<param name="alternate" value="sic[1]"/>
</model>
<model predicate="abbr and expan" behaviour="alternate">
<param name="default" value="expan[1]"/>
<param name="alternate" value="abbr[1]"/>
</model>
<model predicate="orig and reg" behaviour="alternate">
<param name="default" value="reg[1]"/>
<param name="alternate" value="orig[1]"/>
</model>
</elementSpec>
</schemaSpec>
</body>
</text>
Expand Down
48 changes: 35 additions & 13 deletions src/teipb/transform/parzival-epub.xql
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ declare %private function model:template-ptr($config as map(*), $node as node()*
<pb-option name="appXPath" on="./rdg[contains(@label, 'original')]" off="">Original Clefs</pb-option>
</pb-mei></t>/*
};
(: generated template function for element spec: choice :)
declare %private function model:template-choice($config as map(*), $node as node()*, $params as map(*)) {
``[(`{string-join($config?apply-children($config, $node, $params?default))}`)]``
};
(: generated template function for element spec: mei:mdiv :)
declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) {
<t xmlns=""><pb-mei player="player" data="{$config?apply-children($config, $node, $params?data)}"/></t>/*
};
(: generated template function for element spec: name :)
declare %private function model:template-name($config as map(*), $node as node()*, $params as map(*)) {
``[.]``
<t xmlns=""><span data-ref="{$config?apply-children($config, $node, $params?ref)}">{$config?apply-children($config, $node, $params?default)}</span></t>/*
};
(:~
Expand Down Expand Up @@ -209,26 +213,42 @@ declare function model:apply($config as map(*), $input as node()*) {
case element(publicationStmt) return
epub:block($config, ., ("tei-publicationStmt1", css:map-rend-to-class(.)), availability/licence)
case element(choice) return
if (sic and corr) then
epub:alternate($config, ., ("tei-choice1", css:map-rend-to-class(.)), ., corr[1], sic[1])
if (am and ex) then
let $params :=
map {
"default": ex[1],
"alternate": am[1],
"content": .
}

let $content :=
model:template-choice($config, ., $params)
return
html:inline(map:merge(($config, map:entry("template", true()))), ., ("tei-choice1", css:map-rend-to-class(.)), $content)
else
if (abbr and expan) then
epub:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1])
if (sic and corr) then
epub:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., corr[1], sic[1])
else
if (orig and reg) then
epub:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1])
if (abbr and expan) then
epub:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., expan[1], abbr[1])
else
$config?apply($config, ./node())
if (orig and reg) then
epub:alternate($config, ., ("tei-choice4", css:map-rend-to-class(.)), ., reg[1], orig[1])
else
$config?apply($config, ./node())
case element(role) return
epub:block($config, ., ("tei-role", css:map-rend-to-class(.)), .)
case element(hi) return
if (@rend='unterstrichen') then
html:inline($config, ., ("tei-hi1", "underline", css:map-rend-to-class(.)), .)
if (@rend='rot') then
html:inline($config, ., ("tei-hi1", "red", css:map-rend-to-class(.)), .)
else
if (@rend='rasur') then
html:inline($config, ., ("tei-hi2", "rasure", css:map-rend-to-class(.)), .)
if (@rend='unterstrichen') then
html:inline($config, ., ("tei-hi2", "underline", css:map-rend-to-class(.)), .)
else
$config?apply($config, ./node())
if (@rend='rasur') then
html:inline($config, ., ("tei-hi3", "rasure", css:map-rend-to-class(.)), .)
else
$config?apply($config, ./node())
case element(note) return
if (@type='Notiz') then
html:inline($config, ., ("tei-note1", "note", css:map-rend-to-class(.)), .)
Expand Down Expand Up @@ -534,6 +554,8 @@ declare function model:apply($config as map(*), $input as node()*) {
case element(name) return
let $params :=
map {
"default": .,
"ref": @ref,
"content": .
}

Expand Down
48 changes: 35 additions & 13 deletions src/teipb/transform/parzival-fo.xql
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ declare %private function model:template-ptr($config as map(*), $node as node()*
<pb-option name="appXPath" on="./rdg[contains(@label, 'original')]" off="">Original Clefs</pb-option>
</pb-mei></t>/*
};
(: generated template function for element spec: choice :)
declare %private function model:template-choice($config as map(*), $node as node()*, $params as map(*)) {
``[(`{string-join($config?apply-children($config, $node, $params?default))}`)]``
};
(: generated template function for element spec: mei:mdiv :)
declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) {
<t xmlns=""><pb-mei player="player" data="{$config?apply-children($config, $node, $params?data)}"/></t>/*
};
(: generated template function for element spec: name :)
declare %private function model:template-name($config as map(*), $node as node()*, $params as map(*)) {
``[.]``
<t xmlns=""><span data-ref="{$config?apply-children($config, $node, $params?ref)}">{$config?apply-children($config, $node, $params?default)}</span></t>/*
};
(:~
Expand Down Expand Up @@ -203,26 +207,42 @@ declare function model:apply($config as map(*), $input as node()*) {
case element(publicationStmt) return
fo:omit($config, ., ("tei-publicationStmt2", 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])
if (am and ex) then
let $params :=
map {
"default": ex[1],
"alternate": am[1],
"content": .
}

let $content :=
model:template-choice($config, ., $params)
return
fo:inline(map:merge(($config, map:entry("template", true()))), ., ("tei-choice1", css:map-rend-to-class(.)), $content)
else
if (abbr and expan) then
fo:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1])
if (sic and corr) then
fo:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., corr[1], sic[1])
else
if (orig and reg) then
fo:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1])
if (abbr and expan) then
fo:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., expan[1], abbr[1])
else
$config?apply($config, ./node())
if (orig and reg) then
fo:alternate($config, ., ("tei-choice4", css:map-rend-to-class(.)), ., reg[1], orig[1])
else
$config?apply($config, ./node())
case element(role) return
fo:block($config, ., ("tei-role", css:map-rend-to-class(.)), .)
case element(hi) return
if (@rend='unterstrichen') then
fo:inline($config, ., ("tei-hi1", "underline", css:map-rend-to-class(.)), .)
if (@rend='rot') then
fo:inline($config, ., ("tei-hi1", "red", css:map-rend-to-class(.)), .)
else
if (@rend='rasur') then
fo:inline($config, ., ("tei-hi2", "rasure", css:map-rend-to-class(.)), .)
if (@rend='unterstrichen') then
fo:inline($config, ., ("tei-hi2", "underline", css:map-rend-to-class(.)), .)
else
$config?apply($config, ./node())
if (@rend='rasur') then
fo:inline($config, ., ("tei-hi3", "rasure", css:map-rend-to-class(.)), .)
else
$config?apply($config, ./node())
case element(note) return
if (@type='Notiz') then
fo:inline($config, ., ("tei-note1", "note", css:map-rend-to-class(.)), .)
Expand Down Expand Up @@ -514,6 +534,8 @@ declare function model:apply($config as map(*), $input as node()*) {
case element(name) return
let $params :=
map {
"default": .,
"ref": @ref,
"content": .
}

Expand Down
48 changes: 35 additions & 13 deletions src/teipb/transform/parzival-latex.xql
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ declare %private function model:template-formula2($config as map(*), $node as no
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: choice :)
declare %private function model:template-choice($config as map(*), $node as node()*, $params as map(*)) {
``[(`{string-join($config?apply-children($config, $node, $params?default))}`)]``
};
(: generated template function for element spec: mei:mdiv :)
declare %private function model:template-mei_mdiv($config as map(*), $node as node()*, $params as map(*)) {
<t xmlns=""><pb-mei player="player" data="{$config?apply-children($config, $node, $params?data)}"/></t>/*
};
(: generated template function for element spec: name :)
declare %private function model:template-name($config as map(*), $node as node()*, $params as map(*)) {
``[.]``
<t xmlns=""><span data-ref="{$config?apply-children($config, $node, $params?ref)}">{$config?apply-children($config, $node, $params?default)}</span></t>/*
};
(:~
Expand Down Expand Up @@ -230,26 +234,42 @@ declare function model:apply($config as map(*), $input as node()*) {
case element(publicationStmt) return
latex:omit($config, ., ("tei-publicationStmt2", 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])
if (am and ex) then
let $params :=
map {
"default": ex[1],
"alternate": am[1],
"content": .
}

let $content :=
model:template-choice($config, ., $params)
return
latex:inline(map:merge(($config, map:entry("template", true()))), ., ("tei-choice1", css:map-rend-to-class(.)), $content)
else
if (abbr and expan) then
latex:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., expan[1], abbr[1])
if (sic and corr) then
latex:alternate($config, ., ("tei-choice2", css:map-rend-to-class(.)), ., corr[1], sic[1])
else
if (orig and reg) then
latex:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., reg[1], orig[1])
if (abbr and expan) then
latex:alternate($config, ., ("tei-choice3", css:map-rend-to-class(.)), ., expan[1], abbr[1])
else
$config?apply($config, ./node())
if (orig and reg) then
latex:alternate($config, ., ("tei-choice4", css:map-rend-to-class(.)), ., reg[1], orig[1])
else
$config?apply($config, ./node())
case element(role) return
latex:block($config, ., ("tei-role", css:map-rend-to-class(.)), .)
case element(hi) return
if (@rend='unterstrichen') then
latex:inline($config, ., ("tei-hi1", "underline", css:map-rend-to-class(.)), .)
if (@rend='rot') then
latex:inline($config, ., ("tei-hi1", "red", css:map-rend-to-class(.)), .)
else
if (@rend='rasur') then
latex:inline($config, ., ("tei-hi2", "rasure", css:map-rend-to-class(.)), .)
if (@rend='unterstrichen') then
latex:inline($config, ., ("tei-hi2", "underline", css:map-rend-to-class(.)), .)
else
$config?apply($config, ./node())
if (@rend='rasur') then
latex:inline($config, ., ("tei-hi3", "rasure", css:map-rend-to-class(.)), .)
else
$config?apply($config, ./node())
case element(note) return
if (@type='Notiz') then
latex:inline($config, ., ("tei-note1", "note", css:map-rend-to-class(.)), .)
Expand Down Expand Up @@ -542,6 +562,8 @@ declare function model:apply($config as map(*), $input as node()*) {
case element(name) return
let $params :=
map {
"default": .,
"ref": @ref,
"content": .
}

Expand Down
Loading

0 comments on commit bfc3a33

Please sign in to comment.