Skip to content

Commit 98a8e38

Browse files
authored
Merge pull request #571 from HistoryAtState/fix-sectiontitleital
Fix sectiontitleital
2 parents 15ee19a + f4d85e7 commit 98a8e38

File tree

7 files changed

+40
-22
lines changed

7 files changed

+40
-22
lines changed

app/scss/_tei.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@
100100
font-size: inherit;
101101
}
102102

103+
.section-title {
104+
margin-top: 2em;
105+
}
106+
103107
// list in tei titleStmt for editors,
104108
// hotfix: override wrong odd transformation
105109
.hsg-list-editors {

modules/frus-html.xqm

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -841,12 +841,6 @@ function fh:mobi-size($node as node(), $model as map(*), $document-id as xs:stri
841841
fh:mobi-size($document-id)
842842
};
843843

844-
declare
845-
%templates:wrap
846-
function fh:pdf-size-templating($node as node(), $model as map(*), $document-id as xs:string) {
847-
fh:pdf-size($document-id)
848-
};
849-
850844
declare
851845
%templates:wrap
852846
function fh:pdf-size-templating($node as node(), $model as map(*), $document-id as xs:string, $section-id as xs:string?) {
@@ -859,7 +853,7 @@ declare function fh:mobi-url($document-id as xs:string) {
859853
};
860854

861855
declare function fh:pdf-url($document-id as xs:string, $section-id as xs:string?) {
862-
if ($section-id) then
856+
if (exists($section-id)) then
863857
doc($config:FRUS_COL_VOLUMES || "/" || $document-id || ".xml")//tei:relatedItem[@corresp eq "#" || $section-id and @type eq "pdf"]//tei:ref/@target
864858
else
865859
doc($config:FRUS_COL_VOLUMES || "/" || $document-id || ".xml")//tei:relatedItem[@corresp eq "#" || $document-id and @type eq "pdf"]//tei:ref/@target

resources/odd/compiled/frus-web-module.xql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module namespace pml='http://www.tei-c.org/pm/models/frus/web/module';
22

3-
import module namespace m='http://www.tei-c.org/pm/models/frus/web/module' at '/db/apps/hsg-shell/resources/odd/compiled/frus-web.xql';
3+
import module namespace m='http://www.tei-c.org/pm/models/frus/web' at '/db/apps/hsg-shell/transform/frus-web.xql';
44

55
(: Generated library module to be directly imported into code which
66
: needs to transform TEI nodes using the ODD this module is based on.
77
:)
88
declare function pml:transform($xml as node()*, $parameters as map(*)?) {
99

1010
let $options := map {
11-
"styles": ["/db/apps/hsg-shell/resources/odd/compiled/frus.css"],
12-
"collection": "/db/apps/hsg-shell/resources/odd/compiled",
11+
"styles": ["../transform/frus.css"],
12+
"collection": "/db/apps/hsg-shell/transform",
1313
"parameters": if (exists($parameters)) then $parameters else map {}
1414
}
1515
return m:transform($options, $xml)

resources/odd/compiled/frus-web.xql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ declare function model:apply($config as map(*), $input as node()*) {
264264
if (@rend = 'flushleft') then
265265
html:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .)
266266
else
267-
html:paragraph($config, ., css:get-rendition(., ("tei-p3", css:map-rend-to-class(.))), .)
267+
if (@rend = 'sectiontitleital') then
268+
html:paragraph($config, ., ("tei-p4", "section-title", "font-italic", css:map-rend-to-class(.)), .)
269+
else
270+
html:paragraph($config, ., css:get-rendition(., ("tei-p3", css:map-rend-to-class(.))), .)
268271
case element(list) return
269272
if (head) then
270273
(
@@ -360,7 +363,7 @@ declare function model:apply($config as map(*), $input as node()*) {
360363
if ($parameters?document-list and div[@type='question']) then
361364
ext-html:document-list($config, ., ("tei-div1", css:map-rend-to-class(.)))
362365
else
363-
if ($parameters?document-list and @type = ('compilation', 'chapter', 'subchapter', 'section', 'part') and exists(div[@type and not(@type = 'online-supplement')])) then
366+
if ($parameters?document-list and @type = ('compilation', 'chapter', 'chapter-pending', 'subchapter', 'section', 'section-pending', 'part') and exists(div[@type and not(@type = 'online-supplement')])) then
364367
ext-html:document-list($config, ., ("tei-div2", css:map-rend-to-class(.)))
365368
else
366369
html:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .)
@@ -479,7 +482,10 @@ declare function model:apply($config as map(*), $input as node()*) {
479482
(: If it is inside a paragraph then it is inline, otherwise it is block level :)
480483
html:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .)
481484
case element(gap) return
482-
html:omit($config, ., ("tei-gap", css:map-rend-to-class(.)), .)
485+
if (exists(@unit) and @quantity castable as xs:integer) then
486+
ext-html:gap($config, ., ("tei-gap1", css:map-rend-to-class(.)), ., @unit, @quantity cast as xs:integer)
487+
else
488+
html:omit($config, ., ("tei-gap2", css:map-rend-to-class(.)), .)
483489
case element(addrLine) return
484490
html:block($config, ., ("tei-addrLine", css:map-rend-to-class(.)), .)
485491
case element(row) return
@@ -495,7 +501,7 @@ declare function model:apply($config as map(*), $input as node()*) {
495501
html:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .)
496502
case element(titleStmt) return
497503
(
498-
html:heading($config, ., ("tei-titleStmt1", css:map-rend-to-class(.)), title[@type="complete"], ()),
504+
html:heading($config, ., ("tei-titleStmt1", css:map-rend-to-class(.)), title[@type="complete"], 1),
499505
if (count(editor[@role = 'primary']) gt 1) then
500506
html:block($config, ., ("tei-titleStmt2", css:map-rend-to-class(.)), "Editors:")
501507
else

resources/odd/source/frus.odd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
<model behaviour="paragraph" useSourceRendition="true">
163163
<outputRendition>text-indent: 0em;</outputRendition>
164164
</model>
165+
<model predicate="@rend = 'sectiontitleital'" behaviour="paragraph" cssClass="section-title font-italic"/>
165166
</elementSpec>
166167
<elementSpec mode="change" ident="dateline">
167168
<!-- Override any rendition values and make all datelines right-aligned block -->

transform/frus-epub.xql

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ declare function model:apply($config as map(*), $input as node()*) {
264264
if (@rend = 'flushleft') then
265265
html:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .)
266266
else
267-
html:paragraph($config, ., css:get-rendition(., ("tei-p3", css:map-rend-to-class(.))), .)
267+
if (@rend = 'sectiontitleital') then
268+
html:paragraph($config, ., ("tei-p4", "section-title", "font-italic", css:map-rend-to-class(.)), .)
269+
else
270+
html:paragraph($config, ., css:get-rendition(., ("tei-p3", css:map-rend-to-class(.))), .)
268271
case element(list) return
269272
if (head) then
270273
(
@@ -361,7 +364,7 @@ declare function model:apply($config as map(*), $input as node()*) {
361364
(: No function found for behavior: document-list :)
362365
$config?apply($config, ./node())
363366
else
364-
if ($parameters?document-list and @type = ('compilation', 'chapter', 'subchapter', 'section', 'part') and exists(div[@type and not(@type = 'online-supplement')])) then
367+
if ($parameters?document-list and @type = ('compilation', 'chapter', 'chapter-pending', 'subchapter', 'section', 'section-pending', 'part') and exists(div[@type and not(@type = 'online-supplement')])) then
365368
(: No function found for behavior: document-list :)
366369
$config?apply($config, ./node())
367370
else
@@ -482,7 +485,11 @@ declare function model:apply($config as map(*), $input as node()*) {
482485
(: If it is inside a paragraph then it is inline, otherwise it is block level :)
483486
epub:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .)
484487
case element(gap) return
485-
html:omit($config, ., ("tei-gap", css:map-rend-to-class(.)), .)
488+
if (exists(@unit) and @quantity castable as xs:integer) then
489+
(: No function found for behavior: gap :)
490+
$config?apply($config, ./node())
491+
else
492+
html:omit($config, ., ("tei-gap2", css:map-rend-to-class(.)), .)
486493
case element(addrLine) return
487494
epub:block($config, ., ("tei-addrLine", css:map-rend-to-class(.)), .)
488495
case element(row) return
@@ -498,7 +505,7 @@ declare function model:apply($config as map(*), $input as node()*) {
498505
epub:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .)
499506
case element(titleStmt) return
500507
(
501-
html:heading($config, ., ("tei-titleStmt1", css:map-rend-to-class(.)), title[@type="complete"], ()),
508+
html:heading($config, ., ("tei-titleStmt1", css:map-rend-to-class(.)), title[@type="complete"], 1),
502509
if (count(editor[@role = 'primary']) gt 1) then
503510
epub:block($config, ., ("tei-titleStmt2", css:map-rend-to-class(.)), "Editors:")
504511
else

transform/frus-web.xql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ declare function model:apply($config as map(*), $input as node()*) {
264264
if (@rend = 'flushleft') then
265265
html:paragraph($config, ., css:get-rendition(., ("tei-p2", css:map-rend-to-class(.))), .)
266266
else
267-
html:paragraph($config, ., css:get-rendition(., ("tei-p3", css:map-rend-to-class(.))), .)
267+
if (@rend = 'sectiontitleital') then
268+
html:paragraph($config, ., ("tei-p4", "section-title", "font-italic", css:map-rend-to-class(.)), .)
269+
else
270+
html:paragraph($config, ., css:get-rendition(., ("tei-p3", css:map-rend-to-class(.))), .)
268271
case element(list) return
269272
if (head) then
270273
(
@@ -360,7 +363,7 @@ declare function model:apply($config as map(*), $input as node()*) {
360363
if ($parameters?document-list and div[@type='question']) then
361364
ext-html:document-list($config, ., ("tei-div1", css:map-rend-to-class(.)))
362365
else
363-
if ($parameters?document-list and @type = ('compilation', 'chapter', 'subchapter', 'section', 'part') and exists(div[@type and not(@type = 'online-supplement')])) then
366+
if ($parameters?document-list and @type = ('compilation', 'chapter', 'chapter-pending', 'subchapter', 'section', 'section-pending', 'part') and exists(div[@type and not(@type = 'online-supplement')])) then
364367
ext-html:document-list($config, ., ("tei-div2", css:map-rend-to-class(.)))
365368
else
366369
html:block($config, ., ("tei-div3", css:map-rend-to-class(.)), .)
@@ -479,7 +482,10 @@ declare function model:apply($config as map(*), $input as node()*) {
479482
(: If it is inside a paragraph then it is inline, otherwise it is block level :)
480483
html:block($config, ., css:get-rendition(., ("tei-quote2", css:map-rend-to-class(.))), .)
481484
case element(gap) return
482-
html:omit($config, ., ("tei-gap", css:map-rend-to-class(.)), .)
485+
if (exists(@unit) and @quantity castable as xs:integer) then
486+
ext-html:gap($config, ., ("tei-gap1", css:map-rend-to-class(.)), ., @unit, @quantity cast as xs:integer)
487+
else
488+
html:omit($config, ., ("tei-gap2", css:map-rend-to-class(.)), .)
483489
case element(addrLine) return
484490
html:block($config, ., ("tei-addrLine", css:map-rend-to-class(.)), .)
485491
case element(row) return
@@ -495,7 +501,7 @@ declare function model:apply($config as map(*), $input as node()*) {
495501
html:block($config, ., ("tei-byline", css:map-rend-to-class(.)), .)
496502
case element(titleStmt) return
497503
(
498-
html:heading($config, ., ("tei-titleStmt1", css:map-rend-to-class(.)), title[@type="complete"], ()),
504+
html:heading($config, ., ("tei-titleStmt1", css:map-rend-to-class(.)), title[@type="complete"], 1),
499505
if (count(editor[@role = 'primary']) gt 1) then
500506
html:block($config, ., ("tei-titleStmt2", css:map-rend-to-class(.)), "Editors:")
501507
else

0 commit comments

Comments
 (0)