Skip to content

Commit

Permalink
Merge pull request #336 from HistoryAtState/add-pending
Browse files Browse the repository at this point in the history
Add “pending-” div types for docs, chs, sections
  • Loading branch information
joewiz authored Dec 5, 2024
2 parents 942c2c6 + 76d723c commit 5b83552
Show file tree
Hide file tree
Showing 6 changed files with 590 additions and 527 deletions.
6 changes: 3 additions & 3 deletions modules/lib/frus-toc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<xsl:mode name="html" on-no-match="text-only-copy"/>

<xsl:accumulator name="document-nos" initial-value="()" as="xs:string*">
<xsl:accumulator-rule match="tei:div[@type eq 'document']" select="($value, @n)" phase="end"/>
<xsl:accumulator-rule match="tei:div[@type = ('document', 'document-pending')]" select="($value, @n)" phase="end"/>
</xsl:accumulator>

<xsl:accumulator name="document-ids" initial-value="()" as="xs:string*">
Expand All @@ -29,10 +29,10 @@
</div>
</xsl:template>

<xsl:template match="tei:div[@xml:id][not(@type = ('document'))]">
<xsl:template match="tei:div[@xml:id][not(@type = ('document', 'document-pending'))]">
<xsl:variable name="accDocs" as="xs:string*" select="accumulator-after('document-nos')"/>
<xsl:variable name="prevDocs" as="xs:string*" select="accumulator-before('document-nos')"/>
<xsl:variable name="docs" as="xs:string*" select="if (tei:div[@type eq 'document']) then $accDocs[not(. = $prevDocs)] else ()"/>
<xsl:variable name="docs" as="xs:string*" select="if (tei:div[@type = ('document', 'document-pending')]) then $accDocs[not(. = $prevDocs)] else ()"/>
<xsl:variable name="prevDocIDs" as="xs:string*" select="accumulator-before('document-ids')"/>
<xsl:variable name="docIDs" as="xs:string*" select="accumulator-after('document-ids')[not(. = $prevDocIDs)]"/>
<xsl:variable name="child_list" as="element(ul)?">
Expand Down
1,017 changes: 533 additions & 484 deletions schema/frus-tei-guidelines.html

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions schema/frus.odd
Original file line number Diff line number Diff line change
Expand Up @@ -1326,15 +1326,24 @@
<valItem ident="document">
<gloss>Document</gloss>
</valItem>
<valItem ident="document-pending">
<gloss>Document (withheld pending clearance)</gloss>
</valItem>
<valItem ident="section">
<gloss>Section</gloss>
</valItem>
<valItem ident="section-pending">
<gloss>Section (withheld pending clearance)</gloss>
</valItem>
<valItem ident="compilation">
<gloss>Compilation</gloss>
</valItem>
<valItem ident="chapter">
<gloss>Chapter</gloss>
</valItem>
<valItem ident="chapter-pending">
<gloss>Chapter (withheld pending clearance)</gloss>
</valItem>
<valItem ident="subchapter">
<gloss>Sub-chapter</gloss>
</valItem>
Expand Down
13 changes: 11 additions & 2 deletions schema/frus.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace teix = "http://www.tei-c.org/ns/Examples"
namespace xi = "http://www.w3.org/2001/XInclude"
namespace xlink = "http://www.w3.org/1999/xlink"

# Schema generated from ODD source 2024-08-27T20:41:23Z. .
# Schema generated from ODD source 2024-12-04T15:25:33Z. .
# TEI Edition: Version 4.5.0. Last updated on 25th October 2022, revision 3e98e619e
# TEI Edition Location: https://www.tei-c.org/Vault/P5/4.5.0/
# FRUS TEI Schema Spec
Expand Down Expand Up @@ -2875,7 +2875,7 @@ body =
element div {
((model.divTop | model.global)*,
((((model.divLike | model.divGenLike), model.global*)+
| (((model.common), model.global*)+,
| ((model.common, model.global*)+,
((model.divLike | model.divGenLike), model.global*)*)),
(model.divBottom, model.global*)*)?)
>> sch:pattern [
Expand Down Expand Up @@ -2931,15 +2931,24 @@ body =

## (Document)
"document"
|
## (Document (withheld pending clearance))
"document-pending"
|
## (Section)
"section"
|
## (Section (withheld pending clearance))
"section-pending"
|
## (Compilation)
"compilation"
|
## (Chapter)
"chapter"
|
## (Chapter (withheld pending clearance))
"chapter-pending"
|
## (Sub-chapter)
"subchapter"
Expand Down
20 changes: 10 additions & 10 deletions schema/frus.sch
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<extends href="frus-characters.sch"/>

<!-- Define variables used by other patterns -->
<let name="documents" value="//tei:div[@type = 'document']"/>
<let name="documents" value="//tei:div[@type = ('document', 'document-pending')]"/>

<pattern id="processing-instruction-check">
<rule context="/processing-instruction()">
Expand Down Expand Up @@ -161,29 +161,29 @@
<pattern id="div-child-checks">
<title>Compilation/Chapter/Subchapter Nesting Checks</title>
<rule
context="tei:div[@type = ('compilation', 'chapter', 'subchapter')][not(@subtype = ('index', 'referral', 'editorial-note'))]">
context="tei:div[@type = ('compilation', 'chapter', 'chapter-pending', 'subchapter')][not(@subtype = ('index', 'referral', 'editorial-note'))]">
<assert role="warn"
test=".//tei:div[@type = 'document'] or .//tei:div[@subtype = ('index', 'referral', 'editorial-note')]"
test=".//tei:div[@type = ('document', 'document-pending')] or .//tei:div[@subtype = ('index', 'referral', 'editorial-note')]"
>This <value-of select="@type"/> does not contain a div/@type='document'. Please
verify that the structure is correct.</assert>
</rule>
<rule context="tei:div[@type = 'document']">
<rule context="tei:div[@type = ('document', 'document-pending')]">
<assert role="warn"
test="not(preceding-sibling::tei:div[1][@type = ('compilation', 'chapter', 'subchapter')] or following-sibling::tei:div[1][@type = ('compilation', 'chapter', 'subchapter')])"
test="not(preceding-sibling::tei:div[1][@type = ('compilation', 'chapter', 'chapter-pending', 'subchapter')] or following-sibling::tei:div[1][@type = ('compilation', 'chapter', 'chapter-pending', 'subchapter')])"
>This document is preceded or followed by a <value-of select="@type"/>. Please
verify that the structure is correct.</assert>
</rule>
</pattern>

<pattern id="div-numbering-checks">
<title>Document Div Numbering Checks</title>
<rule context="tei:div[@type = 'document'][@n castable as xs:integer]">
<rule context="tei:div[@type = ('document', 'document-pending')][@n castable as xs:integer]">
<assert
test="not(./preceding::tei:div[@type = 'document']) or ./@n = (./preceding::tei:div[@n castable as xs:integer][1]/@n + 1)"
test="not(./preceding::tei:div[@type = ('document', 'document-pending')]) or ./@n = (./preceding::tei:div[@n castable as xs:integer][1]/@n + 1)"
>Document numbering mismatch. Document div/@n numbering must be
consecutive.</assert>
</rule>
<rule context="tei:div[@type = 'document']">
<rule context="tei:div[@type = ('document', 'document-pending')]">
<assert role="warn" test="not(matches(./@n, '^\[.+?\]$'))">Document's @n is encased in
square brackets: "[]". Only use in the rare circumstance that the volume has a block
of unnumbered documents outside the normal stream of numbered documents. Please
Expand Down Expand Up @@ -271,7 +271,7 @@

<pattern id="footnote-id-checks">
<title>Footnote ID Checks</title>
<rule context="tei:note[@xml:id and ancestor::tei:div/@type = 'document']">
<rule context="tei:note[@xml:id and ancestor::tei:div/@type = ('document', 'document-pending')]">
<assert test="substring-before(./@xml:id, 'fn') = ./ancestor::tei:div[1]/@xml:id"
>Footnote ID mismatch. Document ID portion of footnote @xml:id '<value-of
select="./@xml:id"/>' must match its document's @xml:id '<value-of
Expand Down Expand Up @@ -355,7 +355,7 @@
<title>Source Note checks</title>
<!-- limit this rule to volumes covering post-1950 or published after 1995, when source note conventions begin to conform to these rules -->
<rule
context="tei:div[@subtype eq 'historical-document'][root(.)/tei:TEI/tei:teiHeader[.//tei:date[@type eq 'content-date']/@notBefore ge '1950' or .//tei:date[@type eq 'publication-date'] gt '1995']]">
context="tei:div[@subtype eq 'historical-document' and not(@type eq 'document-pending')][root(.)/tei:TEI/tei:teiHeader[.//tei:date[@type eq 'content-date']/@notBefore ge '1950' or .//tei:date[@type eq 'publication-date'] gt '1995']]">
<let name="source-note"
value="(tei:note[@type eq 'source' and @rend eq 'inline'], tei:head/tei:note[@type eq 'source'], tei:head/tei:note//tei:seg[@type eq 'source'])[1]"/>
<let name="source-note-content" value="
Expand Down
52 changes: 24 additions & 28 deletions schema/refresh-static-files.xq
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,29 @@ let $vol := doc($path)/tei:TEI
let $vol-id := $vol/@xml:id
let $fileDesc := $vol/tei:teiHeader/tei:fileDesc
let $notesStmt := $fileDesc/tei:notesStmt
let $static-files := doc("http://doa-exist.hsg:8080/exist/apps/hsg-publish/static-files.xq?vol-id=" || $vol-id)/files/file
let $static-files := doc("http://hsg-prod-publish.hsg:8080/exist/apps/hsg-publish/s3/static-files?vol-id=" || $vol-id)/files/file
let $relatedItems :=
for $file in $static-files
let $basename := $file/basename
let $resource := $vol/id($basename)
where $resource instance of element(tei:TEI) or $resource instance of element(tei:div) or $resource instance of element(tei:figure)
return
<relatedItem xmlns="http://www.tei-c.org/ns/1.0" corresp="#{$basename}" type="{$file/Q{}extension}">
<bibl>
<ref target="{$file/Q{}url}"/>
<extent>
<measure quantity="{$file/Q{}size}" unit="bytes"/>
</extent>
<date type="publication-date" when="{$file/Q{}last-modified}"/>
</bibl>
</relatedItem>
let $new-notesStmt :=
<notesStmt xmlns="http://www.tei-c.org/ns/1.0">
<note>This publication contains {count($relatedItems) } associated files. For page images, see the facsimile element.</note>
{ $relatedItems }
</notesStmt>
return
if (exists($static-files)) then
let $relatedItems :=
for $file in $static-files
let $basename := $file/basename
let $resource := $vol/id($basename)
where $resource instance of element(tei:TEI) or $resource instance of element(tei:div)
return
<relatedItem xmlns="http://www.tei-c.org/ns/1.0" corresp="#{$basename}" type="{$file/Q{}extension}">
<bibl>
<ref target="{$file/Q{}url}"/>
<extent>
<measure quantity="{$file/Q{}size}" unit="bytes"/>
</extent>
<date type="publication-date" when="{$file/Q{}last-modified}"/>
</bibl>
</relatedItem>
let $new-notesStmt :=
<notesStmt xmlns="http://www.tei-c.org/ns/1.0">
<note>This publication contains {count($relatedItems) } associated files. For page images, see the facsimile element.</note>
{ $relatedItems }
</notesStmt>
return
if (exists($notesStmt)) then
replace node $notesStmt with $new-notesStmt
else
insert node $new-notesStmt after $fileDesc/tei:publicationStmt
if (exists($notesStmt)) then
replace node $notesStmt with $new-notesStmt
else
()
insert node $new-notesStmt after $fileDesc/tei:publicationStmt

0 comments on commit 5b83552

Please sign in to comment.