Skip to content

Commit 81d50a8

Browse files
committed
SF-3629 Add link support to the USX schema
1 parent f09838f commit 81d50a8

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

src/SIL.XForge.Scripture/usx-sf.rnc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Para =
134134
},
135135
attribute vid { xsd:string { pattern = "[A-Z1-4]{3} ?[a-z0-9\-,:]*" } }?,
136136
attribute status { text }?,
137-
(Reference | Note | Char | Milestone | Figure | Verse | Break | Unmatched | text)+
137+
(Reference | Note | Link | Char | Milestone | Figure | Verse | Break | Unmatched | text)+
138138
}
139139
Para.para.style.enum = (
140140
"restore" # Comment about when text was restored
@@ -430,7 +430,7 @@ ListChar.char.style.enum = (
430430

431431
char.link =
432432
attribute link-href { xsd:string
433-
{ pattern = "(.*///?(.*/?)+)|((prj:[A-Za-z\-0-9]{3,8} )?[A-Z1-4]{3} \d+:\d+(\-\d+)?)|(#[^\s]+)" } }?, # The resource being linked to as a URI
433+
{ pattern = "(.*///?(.*/?)+)|((prj:[A-Za-z\-0-9]{3,8} )?[A-Z1-4]{3} \d+:\d+(\-\d+)?[ ]*)|(#[^\s]+)" } }?, # The resource being linked to as a URI
434434
attribute link-title { xsd:string }?, # Plain text describing the remote resource such as might be shown in a tooltip
435435
attribute link-id { xsd:string { pattern = "[\w_\-\.:]+" } }? # Unique identifier for this location in the text
436436

@@ -483,15 +483,15 @@ Note =
483483
attribute style { "f" | "fe" | "ef" | "x" | "ex" },
484484
attribute caller { text },
485485
(attribute category { text })?,
486-
(NoteChar | Unmatched | text )+
486+
(NoteChar | Link | Unmatched | text )+
487487
}
488488

489489
NoteChar =
490490
element char {
491491
attribute style { FootnoteChar.char.style.enum | CrossReferenceChar.char.style.enum },
492492
char.link?,
493493
char.closed?,
494-
(Char | Reference | Unmatched | text)+
494+
(Char | Link | Reference | Unmatched | text)+
495495
}
496496
FootnoteChar.char.style.enum = (
497497
"fr" # The origin reference for the footnote
@@ -544,6 +544,13 @@ Reference =
544544
text?
545545
}
546546

547+
Link =
548+
element link {
549+
attribute style { CrossReferenceChar.char.style.enum },
550+
char.link?,
551+
text?
552+
}
553+
547554
Break =
548555
element optbreak { empty }
549556

src/SIL.XForge.Scripture/usx-sf.xsd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
<xs:choice minOccurs="0" maxOccurs="unbounded">
144144
<xs:element ref="ref"/>
145145
<xs:element ref="note"/>
146+
<xs:element ref="link"/>
146147
<xs:group ref="Char"/>
147148
<xs:element ref="ms"/>
148149
<xs:element ref="figure"/>
@@ -563,7 +564,7 @@
563564
<xs:attribute name="link-href">
564565
<xs:simpleType>
565566
<xs:restriction base="xs:string">
566-
<xs:pattern value="(.*///?(.*/?)+)|((prj:[A-Za-z\-0-9]{3,8} )?[A-Z1-4]{3} \d+:\d+(\-\d+)?)|(#[^\s]+)"/>
567+
<xs:pattern value="(.*///?(.*/?)+)|((prj:[A-Za-z\-0-9]{3,8} )?[A-Z1-4]{3} \d+:\d+(\-\d+)?[ ]*)|(#[^\s]+)"/>
567568
</xs:restriction>
568569
</xs:simpleType>
569570
</xs:attribute>
@@ -726,6 +727,7 @@
726727
<xs:complexType mixed="true">
727728
<xs:choice minOccurs="0" maxOccurs="unbounded">
728729
<xs:group ref="NoteChar"/>
730+
<xs:element ref="link"/>
729731
<xs:element ref="unmatched"/>
730732
</xs:choice>
731733
<xs:attribute name="style" use="required">
@@ -749,6 +751,7 @@
749751
<xs:complexType mixed="true">
750752
<xs:choice minOccurs="0" maxOccurs="unbounded">
751753
<xs:group ref="Char"/>
754+
<xs:element ref="link"/>
752755
<xs:element ref="ref"/>
753756
<xs:element ref="unmatched"/>
754757
</xs:choice>
@@ -820,6 +823,12 @@
820823
</xs:attribute>
821824
</xs:complexType>
822825
</xs:element>
826+
<xs:element name="link">
827+
<xs:complexType mixed="true">
828+
<xs:attribute name="style" use="required" type="CrossReferenceChar.char.style.enum"/>
829+
<xs:attributeGroup ref="char.link"/>
830+
</xs:complexType>
831+
</xs:element>
823832
<xs:element name="optbreak">
824833
<xs:complexType/>
825834
</xs:element>

tools/Roundtrip/usx-sf.xsd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
<xs:choice minOccurs="0" maxOccurs="unbounded">
144144
<xs:element ref="ref"/>
145145
<xs:element ref="note"/>
146+
<xs:element ref="link"/>
146147
<xs:group ref="Char"/>
147148
<xs:element ref="ms"/>
148149
<xs:element ref="figure"/>
@@ -563,7 +564,7 @@
563564
<xs:attribute name="link-href">
564565
<xs:simpleType>
565566
<xs:restriction base="xs:string">
566-
<xs:pattern value="(.*///?(.*/?)+)|((prj:[A-Za-z\-0-9]{3,8} )?[A-Z1-4]{3} \d+:\d+(\-\d+)?)|(#[^\s]+)"/>
567+
<xs:pattern value="(.*///?(.*/?)+)|((prj:[A-Za-z\-0-9]{3,8} )?[A-Z1-4]{3} \d+:\d+(\-\d+)?[ ]*)|(#[^\s]+)"/>
567568
</xs:restriction>
568569
</xs:simpleType>
569570
</xs:attribute>
@@ -726,6 +727,7 @@
726727
<xs:complexType mixed="true">
727728
<xs:choice minOccurs="0" maxOccurs="unbounded">
728729
<xs:group ref="NoteChar"/>
730+
<xs:element ref="link"/>
729731
<xs:element ref="unmatched"/>
730732
</xs:choice>
731733
<xs:attribute name="style" use="required">
@@ -749,6 +751,7 @@
749751
<xs:complexType mixed="true">
750752
<xs:choice minOccurs="0" maxOccurs="unbounded">
751753
<xs:group ref="Char"/>
754+
<xs:element ref="link"/>
752755
<xs:element ref="ref"/>
753756
<xs:element ref="unmatched"/>
754757
</xs:choice>
@@ -820,6 +823,12 @@
820823
</xs:attribute>
821824
</xs:complexType>
822825
</xs:element>
826+
<xs:element name="link">
827+
<xs:complexType mixed="true">
828+
<xs:attribute name="style" use="required" type="CrossReferenceChar.char.style.enum"/>
829+
<xs:attributeGroup ref="char.link"/>
830+
</xs:complexType>
831+
</xs:element>
823832
<xs:element name="optbreak">
824833
<xs:complexType/>
825834
</xs:element>

0 commit comments

Comments
 (0)