pro-editor-schema 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +32 -12
- package/dist/index.d.ts +32 -12
- package/dist/index.js +602 -109
- package/dist/index.mjs +590 -106
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// src/schema/utils/createSchema.ts
|
|
2
2
|
var createSchema = ({
|
|
3
|
+
code,
|
|
3
4
|
kind,
|
|
4
5
|
tag,
|
|
5
|
-
role,
|
|
6
6
|
requiredAttributes,
|
|
7
7
|
optionalAttributes,
|
|
8
8
|
allowedChildTagNames
|
|
9
9
|
}) => {
|
|
10
10
|
return {
|
|
11
|
+
code,
|
|
11
12
|
kind,
|
|
12
13
|
tag,
|
|
13
|
-
role,
|
|
14
14
|
requiredAttributes,
|
|
15
15
|
optionalAttributes,
|
|
16
16
|
allowedChildTagNames: new Set(allowedChildTagNames)
|
|
@@ -92,6 +92,7 @@ var ATOM_TAGS_ALLOWED_CHILDREN = [
|
|
|
92
92
|
|
|
93
93
|
// src/schema/elementSchemas/atoms/b.ts
|
|
94
94
|
var B_SCHEMA = createSchema({
|
|
95
|
+
code: "b",
|
|
95
96
|
kind: "atom",
|
|
96
97
|
tag: B_TAG,
|
|
97
98
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -99,21 +100,11 @@ var B_SCHEMA = createSchema({
|
|
|
99
100
|
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
100
101
|
});
|
|
101
102
|
|
|
102
|
-
// src/schema/schema.types.ts
|
|
103
|
-
var ELEMENT_ROLE = /* @__PURE__ */ ((ELEMENT_ROLE2) => {
|
|
104
|
-
ELEMENT_ROLE2["QUERYCOMMENTSWRAPPER"] = "QUERYCOMMENTSWRAPPER";
|
|
105
|
-
ELEMENT_ROLE2["HEADING"] = "HEADING";
|
|
106
|
-
ELEMENT_ROLE2["FOOTNOTE"] = "FOOTNOTE";
|
|
107
|
-
ELEMENT_ROLE2["INS"] = "INS";
|
|
108
|
-
ELEMENT_ROLE2["DEL"] = "DEL";
|
|
109
|
-
return ELEMENT_ROLE2;
|
|
110
|
-
})(ELEMENT_ROLE || {});
|
|
111
|
-
|
|
112
103
|
// src/schema/elementSchemas/atoms/commentQuerySection.ts
|
|
113
104
|
var COMMENT_QUERY_SECTION_SCHEMA = createSchema({
|
|
114
105
|
kind: "atom",
|
|
115
106
|
tag: SPAN_TAG,
|
|
116
|
-
|
|
107
|
+
code: "commentQuerySection",
|
|
117
108
|
requiredAttributes: [...ID_ATTRS, "id"],
|
|
118
109
|
optionalAttributes: [...TRACK_CHANGES_ATTRS, "title"],
|
|
119
110
|
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
@@ -133,9 +124,9 @@ var INLINE_ELEMENT_TAGS_ALLOWED_CHILDREN = [
|
|
|
133
124
|
|
|
134
125
|
// src/schema/elementSchemas/atoms/deletion.ts
|
|
135
126
|
var DELETION_SCHEMA = createSchema({
|
|
127
|
+
code: "deletion",
|
|
136
128
|
kind: "atom",
|
|
137
129
|
tag: SPAN_TAG,
|
|
138
|
-
role: "DEL" /* DEL */,
|
|
139
130
|
requiredAttributes: [...TRACK_CHANGES_ATTRS, ...ID_ATTRS],
|
|
140
131
|
optionalAttributes: [],
|
|
141
132
|
allowedChildTagNames: [
|
|
@@ -146,6 +137,7 @@ var DELETION_SCHEMA = createSchema({
|
|
|
146
137
|
|
|
147
138
|
// src/schema/elementSchemas/atoms/emphasis.ts
|
|
148
139
|
var EMPHASIS_SCHEMA = createSchema({
|
|
140
|
+
code: "emphasis",
|
|
149
141
|
kind: "atom",
|
|
150
142
|
tag: EMPHASIS_TAG,
|
|
151
143
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -162,6 +154,7 @@ var EMPHASIS_SCHEMA = createSchema({
|
|
|
162
154
|
|
|
163
155
|
// src/schema/elementSchemas/atoms/highlightmark.ts
|
|
164
156
|
var HIGHLIGHTMARK_SCHEMA = createSchema({
|
|
157
|
+
code: "highlightmark",
|
|
165
158
|
kind: "atom",
|
|
166
159
|
tag: HIGHLIGHTMARK_TAG,
|
|
167
160
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -171,6 +164,7 @@ var HIGHLIGHTMARK_SCHEMA = createSchema({
|
|
|
171
164
|
|
|
172
165
|
// src/schema/elementSchemas/atoms/i.ts
|
|
173
166
|
var I_SCHEMA = createSchema({
|
|
167
|
+
code: "i",
|
|
174
168
|
kind: "atom",
|
|
175
169
|
tag: I_TAG,
|
|
176
170
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -180,9 +174,9 @@ var I_SCHEMA = createSchema({
|
|
|
180
174
|
|
|
181
175
|
// src/schema/elementSchemas/atoms/insertion.ts
|
|
182
176
|
var INSERTION_SCHEMA = createSchema({
|
|
177
|
+
code: "insertion",
|
|
183
178
|
kind: "atom",
|
|
184
179
|
tag: SPAN_TAG,
|
|
185
|
-
role: "INS" /* INS */,
|
|
186
180
|
requiredAttributes: [...TRACK_CHANGES_ATTRS, ...ID_ATTRS],
|
|
187
181
|
optionalAttributes: [],
|
|
188
182
|
allowedChildTagNames: [
|
|
@@ -193,6 +187,7 @@ var INSERTION_SCHEMA = createSchema({
|
|
|
193
187
|
|
|
194
188
|
// src/schema/elementSchemas/atoms/sc.ts
|
|
195
189
|
var SC_SCHEMA = createSchema({
|
|
190
|
+
code: "sc",
|
|
196
191
|
kind: "atom",
|
|
197
192
|
tag: SC_TAG,
|
|
198
193
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -202,6 +197,7 @@ var SC_SCHEMA = createSchema({
|
|
|
202
197
|
|
|
203
198
|
// src/schema/elementSchemas/atoms/strike.ts
|
|
204
199
|
var STRIKE_SCHEMA = createSchema({
|
|
200
|
+
code: "strike",
|
|
205
201
|
kind: "atom",
|
|
206
202
|
tag: STRIKE_TAG,
|
|
207
203
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -211,6 +207,7 @@ var STRIKE_SCHEMA = createSchema({
|
|
|
211
207
|
|
|
212
208
|
// src/schema/elementSchemas/atoms/sub.ts
|
|
213
209
|
var SUB_SCHEMA = createSchema({
|
|
210
|
+
code: "sub",
|
|
214
211
|
kind: "atom",
|
|
215
212
|
tag: SUB_TAG,
|
|
216
213
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -220,6 +217,7 @@ var SUB_SCHEMA = createSchema({
|
|
|
220
217
|
|
|
221
218
|
// src/schema/elementSchemas/atoms/sup.ts
|
|
222
219
|
var SUP_SCHEMA = createSchema({
|
|
220
|
+
code: "sup",
|
|
223
221
|
kind: "atom",
|
|
224
222
|
tag: SUP_TAG,
|
|
225
223
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -229,6 +227,7 @@ var SUP_SCHEMA = createSchema({
|
|
|
229
227
|
|
|
230
228
|
// src/schema/elementSchemas/atoms/u.ts
|
|
231
229
|
var U_SCHEMA = createSchema({
|
|
230
|
+
code: "u",
|
|
232
231
|
kind: "atom",
|
|
233
232
|
tag: U_TAG,
|
|
234
233
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -238,6 +237,7 @@ var U_SCHEMA = createSchema({
|
|
|
238
237
|
|
|
239
238
|
// src/schema/elementSchemas/atoms/content.ts
|
|
240
239
|
var CONTENT_SCHEMA = createSchema({
|
|
240
|
+
code: "content",
|
|
241
241
|
kind: "inline",
|
|
242
242
|
tag: CONTENT_TAG,
|
|
243
243
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -256,6 +256,7 @@ var CONTENT_SCHEMA = createSchema({
|
|
|
256
256
|
|
|
257
257
|
// src/schema/elementSchemas/atoms/comment.ts
|
|
258
258
|
var COMMENT_SCHEMA = createSchema({
|
|
259
|
+
code: "comment",
|
|
259
260
|
kind: "inline",
|
|
260
261
|
tag: COMMENT_TAG,
|
|
261
262
|
requiredAttributes: [...ID_ATTRS, "id"],
|
|
@@ -278,6 +279,7 @@ var COMMENT_SCHEMA = createSchema({
|
|
|
278
279
|
|
|
279
280
|
// src/schema/elementSchemas/atoms/query.ts
|
|
280
281
|
var QUERY_SCHEMA = createSchema({
|
|
282
|
+
code: "query",
|
|
281
283
|
kind: "inline",
|
|
282
284
|
tag: QUERY_TAG,
|
|
283
285
|
requiredAttributes: [...ID_ATTRS, "id"],
|
|
@@ -300,6 +302,7 @@ var QUERY_SCHEMA = createSchema({
|
|
|
300
302
|
|
|
301
303
|
// src/schema/elementSchemas/atoms/reply.ts
|
|
302
304
|
var REPLY_SCHEMA = createSchema({
|
|
305
|
+
code: "reply",
|
|
303
306
|
kind: "inline",
|
|
304
307
|
tag: REPLY_TAG,
|
|
305
308
|
requiredAttributes: [...ID_ATTRS, "id"],
|
|
@@ -471,6 +474,7 @@ var GROUP_ELEMENTS_TAGS = [
|
|
|
471
474
|
|
|
472
475
|
// src/schema/elementSchemas/elements/authors/authorgroup.ts
|
|
473
476
|
var AUTHORGROUP_SCHEMA = createSchema({
|
|
477
|
+
code: "authorgroup",
|
|
474
478
|
kind: "group",
|
|
475
479
|
tag: AUTHORGROUP_TAG,
|
|
476
480
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -483,6 +487,7 @@ var AUTHORGROUP_SCHEMA = createSchema({
|
|
|
483
487
|
|
|
484
488
|
// src/schema/elementSchemas/elements/authors/author.ts
|
|
485
489
|
var AUTHOR_SCHEMA = createSchema({
|
|
490
|
+
code: "author",
|
|
486
491
|
kind: "group",
|
|
487
492
|
tag: AUTHOR_TAG,
|
|
488
493
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -499,6 +504,7 @@ var AUTHOR_SCHEMA = createSchema({
|
|
|
499
504
|
|
|
500
505
|
// src/schema/elementSchemas/elements/authors/olink.ts
|
|
501
506
|
var OLINK_SCHEMA = createSchema({
|
|
507
|
+
code: "olink",
|
|
502
508
|
kind: "element",
|
|
503
509
|
tag: OLINK_TAG,
|
|
504
510
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -508,6 +514,7 @@ var OLINK_SCHEMA = createSchema({
|
|
|
508
514
|
|
|
509
515
|
// src/schema/elementSchemas/elements/authors/personname.ts
|
|
510
516
|
var PERSONNAME_SCHEMA = createSchema({
|
|
517
|
+
code: "personname",
|
|
511
518
|
kind: "group",
|
|
512
519
|
tag: PERSONNAME_TAG,
|
|
513
520
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -521,6 +528,7 @@ var PERSONNAME_SCHEMA = createSchema({
|
|
|
521
528
|
|
|
522
529
|
// src/schema/elementSchemas/elements/authors/firstname.ts
|
|
523
530
|
var FIRSTNAME_SCHEMA = createSchema({
|
|
531
|
+
code: "firstname",
|
|
524
532
|
kind: "element",
|
|
525
533
|
tag: FIRSTNAME_TAG,
|
|
526
534
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -530,6 +538,7 @@ var FIRSTNAME_SCHEMA = createSchema({
|
|
|
530
538
|
|
|
531
539
|
// src/schema/elementSchemas/elements/authors/surname.ts
|
|
532
540
|
var SURNAME_SCHEMA = createSchema({
|
|
541
|
+
code: "surname",
|
|
533
542
|
kind: "element",
|
|
534
543
|
tag: SURNAME_TAG,
|
|
535
544
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -539,6 +548,7 @@ var SURNAME_SCHEMA = createSchema({
|
|
|
539
548
|
|
|
540
549
|
// src/schema/elementSchemas/elements/authors/honorific.ts
|
|
541
550
|
var HONORIFIC_SCHEMA = createSchema({
|
|
551
|
+
code: "honorific",
|
|
542
552
|
kind: "element",
|
|
543
553
|
tag: HONORIFIC_TAG,
|
|
544
554
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -548,6 +558,7 @@ var HONORIFIC_SCHEMA = createSchema({
|
|
|
548
558
|
|
|
549
559
|
// src/schema/elementSchemas/elements/authors/orgname.ts
|
|
550
560
|
var ORGNAME_SCHEMA = createSchema({
|
|
561
|
+
code: "orgname",
|
|
551
562
|
kind: "element",
|
|
552
563
|
tag: ORGNAME_TAG,
|
|
553
564
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -557,6 +568,7 @@ var ORGNAME_SCHEMA = createSchema({
|
|
|
557
568
|
|
|
558
569
|
// src/schema/elementSchemas/elements/authors/email.ts
|
|
559
570
|
var EMAIL_SCHEMA = createSchema({
|
|
571
|
+
code: "email",
|
|
560
572
|
kind: "element",
|
|
561
573
|
tag: EMAIL_TAG,
|
|
562
574
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -566,6 +578,7 @@ var EMAIL_SCHEMA = createSchema({
|
|
|
566
578
|
|
|
567
579
|
// src/schema/elementSchemas/elements/authors/org.ts
|
|
568
580
|
var ORG_SCHEMA = createSchema({
|
|
581
|
+
code: "org",
|
|
569
582
|
kind: "element",
|
|
570
583
|
tag: ORG_TAG,
|
|
571
584
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -575,6 +588,7 @@ var ORG_SCHEMA = createSchema({
|
|
|
575
588
|
|
|
576
589
|
// src/schema/elementSchemas/elements/authors/affiliation.ts
|
|
577
590
|
var AFFILIATION_SCHEMA = createSchema({
|
|
591
|
+
code: "affiliation",
|
|
578
592
|
kind: "group",
|
|
579
593
|
tag: AFFILIATION_TAG,
|
|
580
594
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -584,6 +598,7 @@ var AFFILIATION_SCHEMA = createSchema({
|
|
|
584
598
|
|
|
585
599
|
// src/schema/elementSchemas/elements/degrees.ts
|
|
586
600
|
var DEGREES_SCHEMA = createSchema({
|
|
601
|
+
code: "degrees",
|
|
587
602
|
kind: "element",
|
|
588
603
|
tag: DEGREES_TAG,
|
|
589
604
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -593,6 +608,7 @@ var DEGREES_SCHEMA = createSchema({
|
|
|
593
608
|
|
|
594
609
|
// src/schema/elementSchemas/elements/dialogue/line.ts
|
|
595
610
|
var LINE_SCHEMA = createSchema({
|
|
611
|
+
code: "line",
|
|
596
612
|
kind: "element",
|
|
597
613
|
tag: LINE_TAG,
|
|
598
614
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -608,6 +624,7 @@ var LINE_SCHEMA = createSchema({
|
|
|
608
624
|
|
|
609
625
|
// src/schema/elementSchemas/elements/dialogue/speaker.ts
|
|
610
626
|
var SPEAKER_SCHEMA = createSchema({
|
|
627
|
+
code: "speaker",
|
|
611
628
|
kind: "element",
|
|
612
629
|
tag: SPEAKER_TAG,
|
|
613
630
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -623,6 +640,7 @@ var SPEAKER_SCHEMA = createSchema({
|
|
|
623
640
|
|
|
624
641
|
// src/schema/elementSchemas/elements/dialogue/dialogue.ts
|
|
625
642
|
var DIALOGUE_SCHEMA = createSchema({
|
|
643
|
+
code: "dialogue",
|
|
626
644
|
kind: "group",
|
|
627
645
|
tag: DIALOGUE_TAG,
|
|
628
646
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -642,6 +660,7 @@ var DIALOGUE_SCHEMA = createSchema({
|
|
|
642
660
|
|
|
643
661
|
// src/schema/elementSchemas/elements/equation.ts
|
|
644
662
|
var EQUATION_SCHEMA = createSchema({
|
|
663
|
+
code: "equation",
|
|
645
664
|
kind: "element",
|
|
646
665
|
tag: EQUATION_TAG,
|
|
647
666
|
requiredAttributes: [],
|
|
@@ -651,6 +670,7 @@ var EQUATION_SCHEMA = createSchema({
|
|
|
651
670
|
|
|
652
671
|
// src/schema/elementSchemas/elements/figure/img.ts
|
|
653
672
|
var IMG_SCHEMA = createSchema({
|
|
673
|
+
code: "img",
|
|
654
674
|
kind: "element",
|
|
655
675
|
tag: IMG_TAG,
|
|
656
676
|
requiredAttributes: [...ID_ATTRS, "src", "format"],
|
|
@@ -671,6 +691,7 @@ var IMG_SCHEMA = createSchema({
|
|
|
671
691
|
|
|
672
692
|
// src/schema/elementSchemas/elements/figure/alttext.ts
|
|
673
693
|
var ALTTEXT_SCHEMA = createSchema({
|
|
694
|
+
code: "alttext",
|
|
674
695
|
kind: "group",
|
|
675
696
|
tag: ALTTEXT_TAG,
|
|
676
697
|
requiredAttributes: [],
|
|
@@ -680,6 +701,7 @@ var ALTTEXT_SCHEMA = createSchema({
|
|
|
680
701
|
|
|
681
702
|
// src/schema/elementSchemas/elements/figure/imageobject.ts
|
|
682
703
|
var IMAGEOBJECT_SCHEMA = createSchema({
|
|
704
|
+
code: "imageobject",
|
|
683
705
|
kind: "group",
|
|
684
706
|
tag: IMAGEOBJECT_TAG,
|
|
685
707
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -692,6 +714,7 @@ var IMAGEOBJECT_SCHEMA = createSchema({
|
|
|
692
714
|
|
|
693
715
|
// src/schema/elementSchemas/elements/figure/mediaobject.ts
|
|
694
716
|
var MEDIAOBJECT_SCHEMA = createSchema({
|
|
717
|
+
code: "mediaobject",
|
|
695
718
|
kind: "group",
|
|
696
719
|
tag: MEDIAOBJECT_TAG,
|
|
697
720
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -701,6 +724,7 @@ var MEDIAOBJECT_SCHEMA = createSchema({
|
|
|
701
724
|
|
|
702
725
|
// src/schema/elementSchemas/elements/figure/caption1.ts
|
|
703
726
|
var CAPTION_SCHEMA = createSchema({
|
|
727
|
+
code: "caption1",
|
|
704
728
|
kind: "group",
|
|
705
729
|
tag: CAPTION_TAG,
|
|
706
730
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -710,6 +734,7 @@ var CAPTION_SCHEMA = createSchema({
|
|
|
710
734
|
|
|
711
735
|
// src/schema/elementSchemas/elements/figure/figsource.ts
|
|
712
736
|
var FIGSOURCE_SCHEMA = createSchema({
|
|
737
|
+
code: "figsource",
|
|
713
738
|
kind: "element",
|
|
714
739
|
tag: FIGSOURCE_TAG,
|
|
715
740
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -722,6 +747,7 @@ var FIGSOURCE_SCHEMA = createSchema({
|
|
|
722
747
|
|
|
723
748
|
// src/schema/elementSchemas/elements/figure/fignote.ts
|
|
724
749
|
var FIGNOTE_SCHEMA = createSchema({
|
|
750
|
+
code: "fignote",
|
|
725
751
|
kind: "element",
|
|
726
752
|
tag: FIGNOTE_TAG,
|
|
727
753
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -734,6 +760,7 @@ var FIGNOTE_SCHEMA = createSchema({
|
|
|
734
760
|
|
|
735
761
|
// src/schema/elementSchemas/elements/figure/figure.ts
|
|
736
762
|
var FIGURE_SCHEMA = createSchema({
|
|
763
|
+
code: "figure1",
|
|
737
764
|
kind: "group",
|
|
738
765
|
tag: FIGURE_TAG,
|
|
739
766
|
requiredAttributes: [...ID_ATTRS, "xmlid"],
|
|
@@ -754,6 +781,7 @@ var FIGURE_SCHEMA = createSchema({
|
|
|
754
781
|
|
|
755
782
|
// src/schema/elementSchemas/elements/footnote.ts
|
|
756
783
|
var FOOTNOTE_SCHEMA = createSchema({
|
|
784
|
+
code: "footnote",
|
|
757
785
|
kind: "element",
|
|
758
786
|
tag: FOOTNOTE_TAG,
|
|
759
787
|
requiredAttributes: [
|
|
@@ -775,6 +803,7 @@ var FOOTNOTE_SCHEMA = createSchema({
|
|
|
775
803
|
|
|
776
804
|
// src/schema/elementSchemas/elements/footnoteNumber.ts
|
|
777
805
|
var FOOTNOTE_NUMBER_SCHEMA = createSchema({
|
|
806
|
+
code: "footnoteno",
|
|
778
807
|
kind: "element",
|
|
779
808
|
tag: FOOTNOTE_NUMBER_TAG,
|
|
780
809
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -784,6 +813,7 @@ var FOOTNOTE_NUMBER_SCHEMA = createSchema({
|
|
|
784
813
|
|
|
785
814
|
// src/schema/elementSchemas/elements/informalfigure.ts
|
|
786
815
|
var INFORMALFIGURE_SCHEMA = createSchema({
|
|
816
|
+
code: "informalfigure",
|
|
787
817
|
kind: "element",
|
|
788
818
|
tag: INFORMALFIGURE_TAG,
|
|
789
819
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -796,6 +826,7 @@ var INFORMALFIGURE_SCHEMA = createSchema({
|
|
|
796
826
|
|
|
797
827
|
// src/schema/elementSchemas/elements/keywords/keywordset.ts
|
|
798
828
|
var KEYWORDSET_SCHEMA = createSchema({
|
|
829
|
+
code: "keywordset",
|
|
799
830
|
kind: "group",
|
|
800
831
|
tag: KEYWORDSET_TAG,
|
|
801
832
|
requiredAttributes: [
|
|
@@ -816,6 +847,7 @@ var KEYWORDSET_SCHEMA = createSchema({
|
|
|
816
847
|
|
|
817
848
|
// src/schema/elementSchemas/elements/keywords/keyword.ts
|
|
818
849
|
var KEYWORD_SCHEMA = createSchema({
|
|
850
|
+
code: "keyword",
|
|
819
851
|
kind: "element",
|
|
820
852
|
tag: KEYWORD_TAG,
|
|
821
853
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -825,6 +857,7 @@ var KEYWORD_SCHEMA = createSchema({
|
|
|
825
857
|
|
|
826
858
|
// src/schema/elementSchemas/elements/keywords/punc.ts
|
|
827
859
|
var PUNC_SCHEMA = createSchema({
|
|
860
|
+
code: "punc",
|
|
828
861
|
kind: "element",
|
|
829
862
|
tag: PUNC_TAG,
|
|
830
863
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -832,8 +865,66 @@ var PUNC_SCHEMA = createSchema({
|
|
|
832
865
|
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
833
866
|
});
|
|
834
867
|
|
|
868
|
+
// src/schema/elementSchemas/inlineElements/footnoteLink.ts
|
|
869
|
+
var FOOTNOTE_LINK_SCHEMA = createSchema({
|
|
870
|
+
code: "footnote1",
|
|
871
|
+
kind: "inline",
|
|
872
|
+
tag: FOOTNOTE_LINK_TAG,
|
|
873
|
+
requiredAttributes: [...ID_ATTRS],
|
|
874
|
+
optionalAttributes: ["linkend"],
|
|
875
|
+
allowedChildTagNames: [{ tagName: SUP_TAG, required: true }]
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
// src/schema/elementSchemas/inlineElements/inlineequation.ts
|
|
879
|
+
var INLINEEQUATION_SCHEMA = createSchema({
|
|
880
|
+
code: "inlineequation",
|
|
881
|
+
kind: "inline",
|
|
882
|
+
tag: INLINEEQUATION_TAG,
|
|
883
|
+
requiredAttributes: [...ID_ATTRS],
|
|
884
|
+
optionalAttributes: ["linkend"],
|
|
885
|
+
allowedChildTagNames: []
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// src/schema/elementSchemas/inlineElements/link.ts
|
|
889
|
+
var LINK_SCHEMA = createSchema({
|
|
890
|
+
code: "link",
|
|
891
|
+
kind: "inline",
|
|
892
|
+
tag: LINK_TAG,
|
|
893
|
+
requiredAttributes: [
|
|
894
|
+
...ID_ATTRS,
|
|
895
|
+
"linkend",
|
|
896
|
+
"data-target-id",
|
|
897
|
+
{
|
|
898
|
+
name: "role",
|
|
899
|
+
values: ["table", "figure", "equation", "footnote", "bibr"],
|
|
900
|
+
defaultValue: ""
|
|
901
|
+
}
|
|
902
|
+
],
|
|
903
|
+
optionalAttributes: [],
|
|
904
|
+
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// src/schema/elementSchemas/inlineElements/uri.ts
|
|
908
|
+
var URI_SCHEMA = createSchema({
|
|
909
|
+
code: "uri",
|
|
910
|
+
kind: "inline",
|
|
911
|
+
tag: URI_TAG,
|
|
912
|
+
requiredAttributes: [...ID_ATTRS],
|
|
913
|
+
optionalAttributes: ["linkend"],
|
|
914
|
+
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
// src/schema/elementSchemas/inlineElements/index.ts
|
|
918
|
+
var INLINE_ELEMENT_SCHEMAS = [
|
|
919
|
+
URI_SCHEMA,
|
|
920
|
+
FOOTNOTE_LINK_SCHEMA,
|
|
921
|
+
LINK_SCHEMA,
|
|
922
|
+
INLINEEQUATION_SCHEMA
|
|
923
|
+
];
|
|
924
|
+
|
|
835
925
|
// src/schema/elementSchemas/elements/label.ts
|
|
836
926
|
var LABEL_SCHEMA = createSchema({
|
|
927
|
+
code: "label1",
|
|
837
928
|
kind: "element",
|
|
838
929
|
tag: LABEL_TAG,
|
|
839
930
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -845,11 +936,18 @@ var LABEL_SCHEMA = createSchema({
|
|
|
845
936
|
defaultValue: "false"
|
|
846
937
|
}
|
|
847
938
|
],
|
|
848
|
-
allowedChildTagNames: [
|
|
939
|
+
allowedChildTagNames: [
|
|
940
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
941
|
+
{
|
|
942
|
+
tagName: LINK_TAG,
|
|
943
|
+
required: false
|
|
944
|
+
}
|
|
945
|
+
]
|
|
849
946
|
});
|
|
850
947
|
|
|
851
948
|
// src/schema/elementSchemas/elements/list/token.ts
|
|
852
949
|
var TOKEN_SCHEMA = createSchema({
|
|
950
|
+
code: "token",
|
|
853
951
|
kind: "element",
|
|
854
952
|
tag: TOKEN_TAG,
|
|
855
953
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -859,6 +957,7 @@ var TOKEN_SCHEMA = createSchema({
|
|
|
859
957
|
|
|
860
958
|
// src/schema/elementSchemas/elements/list/li.ts
|
|
861
959
|
var LI_SCHEMA = createSchema({
|
|
960
|
+
code: "li",
|
|
862
961
|
kind: "element",
|
|
863
962
|
tag: LI_TAG,
|
|
864
963
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -887,6 +986,7 @@ var LI_SCHEMA = createSchema({
|
|
|
887
986
|
|
|
888
987
|
// src/schema/elementSchemas/elements/list/ol.ts
|
|
889
988
|
var OL_SCHEMA = createSchema({
|
|
989
|
+
code: "ol",
|
|
890
990
|
kind: "group",
|
|
891
991
|
tag: OL_TAG,
|
|
892
992
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -923,6 +1023,7 @@ var OL_SCHEMA = createSchema({
|
|
|
923
1023
|
|
|
924
1024
|
// src/schema/elementSchemas/elements/list/ul.ts
|
|
925
1025
|
var UL_SCHEMA = createSchema({
|
|
1026
|
+
code: "ul",
|
|
926
1027
|
kind: "group",
|
|
927
1028
|
tag: UL_TAG,
|
|
928
1029
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -963,6 +1064,7 @@ var UL_SCHEMA = createSchema({
|
|
|
963
1064
|
|
|
964
1065
|
// src/schema/elementSchemas/elements/para.ts
|
|
965
1066
|
var PARA_SCHEMA = createSchema({
|
|
1067
|
+
code: "para",
|
|
966
1068
|
kind: "element",
|
|
967
1069
|
tag: PARA_TAG,
|
|
968
1070
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -988,6 +1090,7 @@ var PARA_SCHEMA = createSchema({
|
|
|
988
1090
|
|
|
989
1091
|
// src/schema/elementSchemas/elements/paragraphNumberTag.ts
|
|
990
1092
|
var TAG_SCHEMA = createSchema({
|
|
1093
|
+
code: "tag",
|
|
991
1094
|
kind: "element",
|
|
992
1095
|
tag: TAG_TAG,
|
|
993
1096
|
requiredAttributes: [...ID_ATTRS, "data-id"],
|
|
@@ -997,6 +1100,7 @@ var TAG_SCHEMA = createSchema({
|
|
|
997
1100
|
|
|
998
1101
|
// src/schema/elementSchemas/elements/runningHeads/lrh.ts
|
|
999
1102
|
var LRH_SCHEMA = createSchema({
|
|
1103
|
+
code: "lrh",
|
|
1000
1104
|
kind: "element",
|
|
1001
1105
|
tag: LRH_TAG,
|
|
1002
1106
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1006,6 +1110,7 @@ var LRH_SCHEMA = createSchema({
|
|
|
1006
1110
|
|
|
1007
1111
|
// src/schema/elementSchemas/elements/runningHeads/rrh.ts
|
|
1008
1112
|
var RRH_SCHEMA = createSchema({
|
|
1113
|
+
code: "rrh",
|
|
1009
1114
|
kind: "element",
|
|
1010
1115
|
tag: RRH_TAG,
|
|
1011
1116
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1015,6 +1120,7 @@ var RRH_SCHEMA = createSchema({
|
|
|
1015
1120
|
|
|
1016
1121
|
// src/schema/elementSchemas/elements/source.ts
|
|
1017
1122
|
var SOURCE_SCHEMA = createSchema({
|
|
1123
|
+
code: "source1",
|
|
1018
1124
|
kind: "element",
|
|
1019
1125
|
tag: SOURCE_TAG,
|
|
1020
1126
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1031,6 +1137,7 @@ var SOURCE_SCHEMA = createSchema({
|
|
|
1031
1137
|
|
|
1032
1138
|
// src/schema/elementSchemas/elements/subtitle.ts
|
|
1033
1139
|
var SUBTITLE_SCHEMA = createSchema({
|
|
1140
|
+
code: "subtitle1",
|
|
1034
1141
|
kind: "element",
|
|
1035
1142
|
tag: SUBTITLE_TAG,
|
|
1036
1143
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1046,6 +1153,7 @@ var SUBTITLE_SCHEMA = createSchema({
|
|
|
1046
1153
|
|
|
1047
1154
|
// src/schema/elementSchemas/elements/table/tp.ts
|
|
1048
1155
|
var TP_SCHEMA = createSchema({
|
|
1156
|
+
code: "tp",
|
|
1049
1157
|
kind: "element",
|
|
1050
1158
|
tag: TP_TAG,
|
|
1051
1159
|
requiredAttributes: [],
|
|
@@ -1058,6 +1166,7 @@ var TP_SCHEMA = createSchema({
|
|
|
1058
1166
|
|
|
1059
1167
|
// src/schema/elementSchemas/elements/table/td.ts
|
|
1060
1168
|
var TD_SCHEMA = createSchema({
|
|
1169
|
+
code: "td",
|
|
1061
1170
|
kind: "group",
|
|
1062
1171
|
tag: TD_TAG,
|
|
1063
1172
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1071,6 +1180,7 @@ var TD_SCHEMA = createSchema({
|
|
|
1071
1180
|
|
|
1072
1181
|
// src/schema/elementSchemas/elements/table/tr.ts
|
|
1073
1182
|
var TR_SCHEMA = createSchema({
|
|
1183
|
+
code: "tr",
|
|
1074
1184
|
kind: "group",
|
|
1075
1185
|
tag: TR_TAG,
|
|
1076
1186
|
requiredAttributes: [],
|
|
@@ -1080,6 +1190,7 @@ var TR_SCHEMA = createSchema({
|
|
|
1080
1190
|
|
|
1081
1191
|
// src/schema/elementSchemas/elements/table/thead.ts
|
|
1082
1192
|
var THEAD_SCHEMA = createSchema({
|
|
1193
|
+
code: "thead",
|
|
1083
1194
|
kind: "element",
|
|
1084
1195
|
tag: THEAD_TAG,
|
|
1085
1196
|
requiredAttributes: [],
|
|
@@ -1089,6 +1200,7 @@ var THEAD_SCHEMA = createSchema({
|
|
|
1089
1200
|
|
|
1090
1201
|
// src/schema/elementSchemas/elements/table/tbody.ts
|
|
1091
1202
|
var TBODY_SCHEMA = createSchema({
|
|
1203
|
+
code: "tbody",
|
|
1092
1204
|
kind: "group",
|
|
1093
1205
|
tag: TBODY_TAG,
|
|
1094
1206
|
requiredAttributes: [],
|
|
@@ -1098,6 +1210,7 @@ var TBODY_SCHEMA = createSchema({
|
|
|
1098
1210
|
|
|
1099
1211
|
// src/schema/elementSchemas/elements/table/htmlTable.ts
|
|
1100
1212
|
var HTML_TABLE_SCHEMA = createSchema({
|
|
1213
|
+
code: "table",
|
|
1101
1214
|
kind: "group",
|
|
1102
1215
|
tag: HTML_TABLE_TAG,
|
|
1103
1216
|
requiredAttributes: [],
|
|
@@ -1110,6 +1223,7 @@ var HTML_TABLE_SCHEMA = createSchema({
|
|
|
1110
1223
|
|
|
1111
1224
|
// src/schema/elementSchemas/elements/table/tgroup.ts
|
|
1112
1225
|
var TGROUP_SCHEMA = createSchema({
|
|
1226
|
+
code: "tgroup",
|
|
1113
1227
|
kind: "group",
|
|
1114
1228
|
tag: TGROUP_TAG,
|
|
1115
1229
|
requiredAttributes: [...ID_ATTRS, "cols"],
|
|
@@ -1119,6 +1233,7 @@ var TGROUP_SCHEMA = createSchema({
|
|
|
1119
1233
|
|
|
1120
1234
|
// src/schema/elementSchemas/elements/table/tblfn.ts
|
|
1121
1235
|
var TBLFN_SCHEMA = createSchema({
|
|
1236
|
+
code: "tblfn",
|
|
1122
1237
|
kind: "element",
|
|
1123
1238
|
tag: TBLFN_TAG,
|
|
1124
1239
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1131,6 +1246,7 @@ var TBLFN_SCHEMA = createSchema({
|
|
|
1131
1246
|
|
|
1132
1247
|
// src/schema/elementSchemas/elements/table/tblsource.ts
|
|
1133
1248
|
var TBLSOURCE_SCHEMA = createSchema({
|
|
1249
|
+
code: "tblsource",
|
|
1134
1250
|
kind: "element",
|
|
1135
1251
|
tag: TBLSOURCE_TAG,
|
|
1136
1252
|
requiredAttributes: [],
|
|
@@ -1140,6 +1256,7 @@ var TBLSOURCE_SCHEMA = createSchema({
|
|
|
1140
1256
|
|
|
1141
1257
|
// src/schema/elementSchemas/elements/table/table1.ts
|
|
1142
1258
|
var TABLE_SCHEMA = createSchema({
|
|
1259
|
+
code: "table1",
|
|
1143
1260
|
kind: "group",
|
|
1144
1261
|
tag: TABLE_TAG,
|
|
1145
1262
|
requiredAttributes: [...ID_ATTRS, "xmlid", "role"],
|
|
@@ -1162,6 +1279,7 @@ var TABLE_SCHEMA = createSchema({
|
|
|
1162
1279
|
|
|
1163
1280
|
// src/schema/elementSchemas/elements/title.ts
|
|
1164
1281
|
var TITLE_SCHEMA = createSchema({
|
|
1282
|
+
code: "title1",
|
|
1165
1283
|
kind: "element",
|
|
1166
1284
|
tag: TITLE_TAG,
|
|
1167
1285
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1237,6 +1355,7 @@ var ELEMENT_SCHEMAS = [
|
|
|
1237
1355
|
|
|
1238
1356
|
// src/schema/elementSchemas/groupElements/abstract.ts
|
|
1239
1357
|
var ABSTRACT_SCHEMA = createSchema({
|
|
1358
|
+
code: "abstract1",
|
|
1240
1359
|
kind: "group",
|
|
1241
1360
|
tag: ABSTRACT_TAG,
|
|
1242
1361
|
requiredAttributes: [
|
|
@@ -1265,6 +1384,7 @@ var ABSTRACT_SCHEMA = createSchema({
|
|
|
1265
1384
|
|
|
1266
1385
|
// src/schema/elementSchemas/groupElements/appendix.ts
|
|
1267
1386
|
var APPENDIX_SCHEMA = createSchema({
|
|
1387
|
+
code: "appendix",
|
|
1268
1388
|
kind: "group",
|
|
1269
1389
|
tag: APPENDIX_TAG,
|
|
1270
1390
|
requiredAttributes: [...ID_ATTRS, "id", "xmlid"],
|
|
@@ -1278,6 +1398,7 @@ var APPENDIX_SCHEMA = createSchema({
|
|
|
1278
1398
|
|
|
1279
1399
|
// src/schema/elementSchemas/groupElements/blockquote.ts
|
|
1280
1400
|
var BLOCKQUOTE_SCHEMA = createSchema({
|
|
1401
|
+
code: "blockquote",
|
|
1281
1402
|
kind: "group",
|
|
1282
1403
|
tag: BLOCKQUOTE_TAG,
|
|
1283
1404
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1303,6 +1424,7 @@ var BLOCKQUOTE_SCHEMA = createSchema({
|
|
|
1303
1424
|
|
|
1304
1425
|
// src/schema/elementSchemas/groupElements/box.ts
|
|
1305
1426
|
var BOX_SCHEMA = createSchema({
|
|
1427
|
+
code: "sidebar",
|
|
1306
1428
|
kind: "group",
|
|
1307
1429
|
tag: SIDEBAR_TAG,
|
|
1308
1430
|
requiredAttributes: [
|
|
@@ -1330,6 +1452,7 @@ var BOX_SCHEMA = createSchema({
|
|
|
1330
1452
|
|
|
1331
1453
|
// src/schema/elementSchemas/groupElements/chapter.ts
|
|
1332
1454
|
var CHAPTER_SCHEMA = createSchema({
|
|
1455
|
+
code: "chapter",
|
|
1333
1456
|
kind: "group",
|
|
1334
1457
|
tag: CHAPTER_TAG,
|
|
1335
1458
|
requiredAttributes: [...ID_ATTRS, "xmlid"],
|
|
@@ -1363,6 +1486,7 @@ var CHAPTER_SCHEMA = createSchema({
|
|
|
1363
1486
|
|
|
1364
1487
|
// src/schema/elementSchemas/groupElements/epigraph.ts
|
|
1365
1488
|
var EPIGRAPH_SCHEMA = createSchema({
|
|
1489
|
+
code: "epigraph",
|
|
1366
1490
|
kind: "group",
|
|
1367
1491
|
tag: EPIGRAPH_TAG,
|
|
1368
1492
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1380,9 +1504,9 @@ var EPIGRAPH_SCHEMA = createSchema({
|
|
|
1380
1504
|
|
|
1381
1505
|
// src/schema/elementSchemas/groupElements/footnoteSection.ts
|
|
1382
1506
|
var FOOTNOTE_SECTION_SCHEMA = createSchema({
|
|
1507
|
+
code: "footnoteSection",
|
|
1383
1508
|
kind: "group",
|
|
1384
1509
|
tag: SECTION_TAG,
|
|
1385
|
-
role: "FOOTNOTE" /* FOOTNOTE */,
|
|
1386
1510
|
requiredAttributes: [
|
|
1387
1511
|
...ID_ATTRS,
|
|
1388
1512
|
{
|
|
@@ -1400,9 +1524,9 @@ var FOOTNOTE_SECTION_SCHEMA = createSchema({
|
|
|
1400
1524
|
|
|
1401
1525
|
// src/schema/elementSchemas/groupElements/heading.ts
|
|
1402
1526
|
var HEADING_SCHEMA = createSchema({
|
|
1527
|
+
code: "heading",
|
|
1403
1528
|
kind: "group",
|
|
1404
1529
|
tag: SECTION_TAG,
|
|
1405
|
-
role: "HEADING" /* HEADING */,
|
|
1406
1530
|
requiredAttributes: [
|
|
1407
1531
|
...ID_ATTRS,
|
|
1408
1532
|
"xmlid",
|
|
@@ -1435,6 +1559,7 @@ var HEADING_SCHEMA = createSchema({
|
|
|
1435
1559
|
|
|
1436
1560
|
// src/schema/elementSchemas/groupElements/info.ts
|
|
1437
1561
|
var INFO_SCHEMA = createSchema({
|
|
1562
|
+
code: "info1",
|
|
1438
1563
|
kind: "group",
|
|
1439
1564
|
tag: INFO_TAG,
|
|
1440
1565
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1451,6 +1576,7 @@ var INFO_SCHEMA = createSchema({
|
|
|
1451
1576
|
|
|
1452
1577
|
// src/schema/elementSchemas/groupElements/poem.ts
|
|
1453
1578
|
var POEM_SCHEMA = createSchema({
|
|
1579
|
+
code: "poem",
|
|
1454
1580
|
kind: "group",
|
|
1455
1581
|
tag: POEM_TAG,
|
|
1456
1582
|
requiredAttributes: [...ID_ATTRS],
|
|
@@ -1479,59 +1605,6 @@ var GROUP_ELEMENT_SCHEMAS = [
|
|
|
1479
1605
|
AFFILIATION_SCHEMA
|
|
1480
1606
|
];
|
|
1481
1607
|
|
|
1482
|
-
// src/schema/elementSchemas/inlineElements/footnoteLink.ts
|
|
1483
|
-
var FOOTNOTE_LINK_SCHEMA = createSchema({
|
|
1484
|
-
kind: "inline",
|
|
1485
|
-
tag: FOOTNOTE_LINK_TAG,
|
|
1486
|
-
requiredAttributes: [...ID_ATTRS],
|
|
1487
|
-
optionalAttributes: ["linkend"],
|
|
1488
|
-
allowedChildTagNames: [{ tagName: SUP_TAG, required: true }]
|
|
1489
|
-
});
|
|
1490
|
-
|
|
1491
|
-
// src/schema/elementSchemas/inlineElements/inlineequation.ts
|
|
1492
|
-
var INLINEEQUATION_SCHEMA = createSchema({
|
|
1493
|
-
kind: "inline",
|
|
1494
|
-
tag: INLINEEQUATION_TAG,
|
|
1495
|
-
requiredAttributes: [...ID_ATTRS],
|
|
1496
|
-
optionalAttributes: ["linkend"],
|
|
1497
|
-
allowedChildTagNames: []
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
// src/schema/elementSchemas/inlineElements/link.ts
|
|
1501
|
-
var LINK_SCHEMA = createSchema({
|
|
1502
|
-
kind: "inline",
|
|
1503
|
-
tag: LINK_TAG,
|
|
1504
|
-
requiredAttributes: [
|
|
1505
|
-
...ID_ATTRS,
|
|
1506
|
-
"linkend",
|
|
1507
|
-
"data-target-id",
|
|
1508
|
-
{
|
|
1509
|
-
name: "role",
|
|
1510
|
-
values: ["table", "figure", "equation", "footnote"],
|
|
1511
|
-
defaultValue: ""
|
|
1512
|
-
}
|
|
1513
|
-
],
|
|
1514
|
-
optionalAttributes: [],
|
|
1515
|
-
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
1516
|
-
});
|
|
1517
|
-
|
|
1518
|
-
// src/schema/elementSchemas/inlineElements/uri.ts
|
|
1519
|
-
var URI_SCHEMA = createSchema({
|
|
1520
|
-
kind: "inline",
|
|
1521
|
-
tag: URI_TAG,
|
|
1522
|
-
requiredAttributes: [...ID_ATTRS],
|
|
1523
|
-
optionalAttributes: ["linkend"],
|
|
1524
|
-
allowedChildTagNames: [...ATOM_TAGS_ALLOWED_CHILDREN]
|
|
1525
|
-
});
|
|
1526
|
-
|
|
1527
|
-
// src/schema/elementSchemas/inlineElements/index.ts
|
|
1528
|
-
var INLINE_ELEMENT_SCHEMAS = [
|
|
1529
|
-
URI_SCHEMA,
|
|
1530
|
-
FOOTNOTE_LINK_SCHEMA,
|
|
1531
|
-
LINK_SCHEMA,
|
|
1532
|
-
INLINEEQUATION_SCHEMA
|
|
1533
|
-
];
|
|
1534
|
-
|
|
1535
1608
|
// src/schema/schemas.ts
|
|
1536
1609
|
var SCHEMAS = [
|
|
1537
1610
|
...ATOM_SCHEMAS,
|
|
@@ -1540,10 +1613,7 @@ var SCHEMAS = [
|
|
|
1540
1613
|
...INLINE_ELEMENT_SCHEMAS
|
|
1541
1614
|
];
|
|
1542
1615
|
var SCHEMA_MAP = new Map(
|
|
1543
|
-
SCHEMAS.map((schema) => [
|
|
1544
|
-
schema.tag.toUpperCase() + (schema.role?.toUpperCase() ?? ""),
|
|
1545
|
-
schema
|
|
1546
|
-
])
|
|
1616
|
+
SCHEMAS.map((schema) => [schema.code, schema])
|
|
1547
1617
|
);
|
|
1548
1618
|
|
|
1549
1619
|
// src/schema/shared/ignoredElements.ts
|
|
@@ -1552,11 +1622,7 @@ var IGNORED_ELEMENT_SELECTORS = [
|
|
|
1552
1622
|
"span.printlabel",
|
|
1553
1623
|
"span.refIcon",
|
|
1554
1624
|
"span.missLink",
|
|
1555
|
-
"span.ref-drag"
|
|
1556
|
-
"inlineequation",
|
|
1557
|
-
// TODO: remove this once we have a proper inlineequation schema
|
|
1558
|
-
"equation"
|
|
1559
|
-
// TODO: remove this once we have a proper equation schema
|
|
1625
|
+
"span.ref-drag"
|
|
1560
1626
|
];
|
|
1561
1627
|
|
|
1562
1628
|
// src/schema/shared/ignoredAttributes.ts
|
|
@@ -1582,41 +1648,36 @@ var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute) |
|
|
|
1582
1648
|
(startsWith) => attribute.startsWith(startsWith)
|
|
1583
1649
|
);
|
|
1584
1650
|
var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
|
|
1585
|
-
var
|
|
1586
|
-
if (role) {
|
|
1587
|
-
return SCHEMA_MAP.get(tagName.toUpperCase() + role);
|
|
1588
|
-
}
|
|
1589
|
-
return SCHEMA_MAP.get(tagName.toUpperCase());
|
|
1590
|
-
};
|
|
1651
|
+
var findSchemaByCode = (code) => SCHEMA_MAP.get(code);
|
|
1591
1652
|
var findSchemaByElement = (element) => {
|
|
1592
1653
|
const isInsertion = element.classList.contains("ins");
|
|
1593
1654
|
const isDeletion = element.classList.contains("del");
|
|
1594
1655
|
const isQueryComment = element.classList.contains("cmtQurySection");
|
|
1595
1656
|
const role = element.getAttribute("role");
|
|
1657
|
+
if (isQueryComment) {
|
|
1658
|
+
return findSchemaByCode("commentQuerySection");
|
|
1659
|
+
}
|
|
1660
|
+
if (isInsertion) {
|
|
1661
|
+
return findSchemaByCode("insertion");
|
|
1662
|
+
}
|
|
1663
|
+
if (isDeletion) {
|
|
1664
|
+
return findSchemaByCode("deletion");
|
|
1665
|
+
}
|
|
1596
1666
|
if (role) {
|
|
1597
1667
|
if (role.startsWith("H")) {
|
|
1598
|
-
return
|
|
1599
|
-
element.tagName.toUpperCase() + "HEADING" /* HEADING */
|
|
1600
|
-
);
|
|
1668
|
+
return findSchemaByCode("heading");
|
|
1601
1669
|
}
|
|
1602
1670
|
if (role === "ch" || role === "bk") {
|
|
1603
|
-
return
|
|
1604
|
-
element.tagName.toUpperCase() + "FOOTNOTE" /* FOOTNOTE */
|
|
1605
|
-
);
|
|
1671
|
+
return findSchemaByCode("footnoteSection");
|
|
1606
1672
|
}
|
|
1607
1673
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
if (
|
|
1612
|
-
return
|
|
1674
|
+
const candidates = [...SCHEMA_MAP.values()].filter(
|
|
1675
|
+
(schema) => schema.tag === element.tagName.toUpperCase()
|
|
1676
|
+
);
|
|
1677
|
+
if (candidates.length > 0) {
|
|
1678
|
+
return candidates[0];
|
|
1613
1679
|
}
|
|
1614
|
-
|
|
1615
|
-
return SCHEMA_MAP.get(
|
|
1616
|
-
element.tagName.toUpperCase() + "QUERYCOMMENTSWRAPPER" /* QUERYCOMMENTSWRAPPER */
|
|
1617
|
-
);
|
|
1618
|
-
}
|
|
1619
|
-
return SCHEMA_MAP.get(element.tagName.toUpperCase());
|
|
1680
|
+
return void 0;
|
|
1620
1681
|
};
|
|
1621
1682
|
var isAttributeRestricted = (attr) => typeof attr !== "string";
|
|
1622
1683
|
var getAttributeName = (attribute) => typeof attribute === "string" ? attribute : attribute.name;
|
|
@@ -1643,6 +1704,420 @@ var createElement = ({
|
|
|
1643
1704
|
}
|
|
1644
1705
|
return element;
|
|
1645
1706
|
};
|
|
1707
|
+
|
|
1708
|
+
// src/validation/utils/retrieveTextIgnoringNodesWithSelector.ts
|
|
1709
|
+
var retrieveTextIgnoringNodesWithSelector = (element, selector = ".del") => {
|
|
1710
|
+
const clonedElement = element.cloneNode(true);
|
|
1711
|
+
for (const delElement of clonedElement.querySelectorAll(selector)) {
|
|
1712
|
+
delElement.remove();
|
|
1713
|
+
}
|
|
1714
|
+
return clonedElement.textContent || "";
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
// src/validation/validateFootnotes.ts
|
|
1718
|
+
var extractFootnoteNumber = (footnote) => {
|
|
1719
|
+
if (!footnote) return "no label";
|
|
1720
|
+
const footnoteNumberText = retrieveTextIgnoringNodesWithSelector(footnote);
|
|
1721
|
+
const footnoteNumber = Number(footnoteNumberText);
|
|
1722
|
+
if (!Number.isInteger(footnoteNumber) || footnoteNumber <= 0) {
|
|
1723
|
+
return "no label";
|
|
1724
|
+
}
|
|
1725
|
+
return footnoteNumber;
|
|
1726
|
+
};
|
|
1727
|
+
var validateFootnoteCue = (footnoteElement, root) => {
|
|
1728
|
+
const errors = [];
|
|
1729
|
+
const store = footnoteElement.getAttribute("store");
|
|
1730
|
+
if (!store) {
|
|
1731
|
+
return errors;
|
|
1732
|
+
}
|
|
1733
|
+
const linkend = footnoteElement.getAttribute("xmlid") || "";
|
|
1734
|
+
const footnoteNumber = footnoteElement.querySelector(
|
|
1735
|
+
FOOTNOTE_NUMBER_SCHEMA.tag
|
|
1736
|
+
);
|
|
1737
|
+
const footnoteLink = root.querySelector(
|
|
1738
|
+
`${FOOTNOTE_LINK_SCHEMA.tag}[linkend='${CSS.escape(linkend)}']`
|
|
1739
|
+
);
|
|
1740
|
+
if (footnoteLink) {
|
|
1741
|
+
return errors;
|
|
1742
|
+
}
|
|
1743
|
+
if (!footnoteNumber) {
|
|
1744
|
+
errors.push({
|
|
1745
|
+
id: `footnote-number-missing-${store}`,
|
|
1746
|
+
store,
|
|
1747
|
+
title: "Footnote number missing",
|
|
1748
|
+
kind: "missing",
|
|
1749
|
+
description: "The footnote number is missing. Please add it to the footnote.",
|
|
1750
|
+
level: "blocker"
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
const label = extractFootnoteNumber(footnoteNumber);
|
|
1754
|
+
errors.push({
|
|
1755
|
+
id: `unreferenced-footnote-${store}`,
|
|
1756
|
+
store,
|
|
1757
|
+
title: "Unreferenced footnote",
|
|
1758
|
+
kind: "unlinked",
|
|
1759
|
+
description: `The footnote ${label} is not referenced to any footnote cue in this chapter. Please reference it in the chapter.`,
|
|
1760
|
+
level: "blocker"
|
|
1761
|
+
});
|
|
1762
|
+
return errors;
|
|
1763
|
+
};
|
|
1764
|
+
var validateConsecutiveFootnotes = (root) => {
|
|
1765
|
+
const footnotes = Array.from(root.querySelectorAll(FOOTNOTE_SCHEMA.tag));
|
|
1766
|
+
if (footnotes.length === 0) {
|
|
1767
|
+
return [];
|
|
1768
|
+
}
|
|
1769
|
+
for (const [index, footnote] of footnotes.entries()) {
|
|
1770
|
+
const store = footnote.getAttribute("store") || "";
|
|
1771
|
+
const expectedNumber = index + 1;
|
|
1772
|
+
const footnoteNumberElement = footnote.querySelector(
|
|
1773
|
+
FOOTNOTE_NUMBER_SCHEMA.tag
|
|
1774
|
+
);
|
|
1775
|
+
if (!footnoteNumberElement) {
|
|
1776
|
+
continue;
|
|
1777
|
+
}
|
|
1778
|
+
const label = extractFootnoteNumber(footnoteNumberElement);
|
|
1779
|
+
if (label === expectedNumber) {
|
|
1780
|
+
continue;
|
|
1781
|
+
}
|
|
1782
|
+
return [
|
|
1783
|
+
{
|
|
1784
|
+
id: `non-consecutive-footnote-numbers-${store}`,
|
|
1785
|
+
store,
|
|
1786
|
+
title: "Non-consecutive footnote numbers",
|
|
1787
|
+
kind: "missing",
|
|
1788
|
+
description: "Footnote numbers must be consecutive. Please reorder the footnotes.",
|
|
1789
|
+
level: "warning"
|
|
1790
|
+
}
|
|
1791
|
+
];
|
|
1792
|
+
}
|
|
1793
|
+
return [];
|
|
1794
|
+
};
|
|
1795
|
+
var validateConsecutiveFootnoteCues = (root) => {
|
|
1796
|
+
const footnoteLinks = Array.from(
|
|
1797
|
+
root.querySelectorAll(FOOTNOTE_LINK_SCHEMA.tag)
|
|
1798
|
+
);
|
|
1799
|
+
if (footnoteLinks.length === 0) {
|
|
1800
|
+
return [];
|
|
1801
|
+
}
|
|
1802
|
+
for (const [index, footnoteLink] of footnoteLinks.entries()) {
|
|
1803
|
+
const store = footnoteLink.getAttribute("store") || "";
|
|
1804
|
+
const expectedNumber = index + 1;
|
|
1805
|
+
const label = extractFootnoteNumber(footnoteLink);
|
|
1806
|
+
if (label === expectedNumber) {
|
|
1807
|
+
continue;
|
|
1808
|
+
}
|
|
1809
|
+
return [
|
|
1810
|
+
{
|
|
1811
|
+
id: `non-consecutive-footnote-cues-${store}`,
|
|
1812
|
+
store,
|
|
1813
|
+
title: "Non-consecutive footnote cues",
|
|
1814
|
+
kind: "missing",
|
|
1815
|
+
description: "Footnote cues must be consecutive. Please reorder the footnote cues.",
|
|
1816
|
+
level: "warning"
|
|
1817
|
+
}
|
|
1818
|
+
];
|
|
1819
|
+
}
|
|
1820
|
+
return [];
|
|
1821
|
+
};
|
|
1822
|
+
var validateFootnotes = (root) => {
|
|
1823
|
+
const errors = [];
|
|
1824
|
+
for (const footnote of root.querySelectorAll(FOOTNOTE_SCHEMA.tag)) {
|
|
1825
|
+
errors.push(...validateFootnoteCue(footnote, root));
|
|
1826
|
+
}
|
|
1827
|
+
errors.push(...validateConsecutiveFootnotes(root));
|
|
1828
|
+
errors.push(...validateConsecutiveFootnoteCues(root));
|
|
1829
|
+
return errors;
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
// src/validation/validateLinkend.ts
|
|
1833
|
+
var findElementInCurrentChapter = (root, linkend) => {
|
|
1834
|
+
return !!root.querySelector(`[xmlid='${CSS.escape(linkend)}']`);
|
|
1835
|
+
};
|
|
1836
|
+
var findElementInReferenceChapters = (linkend, referenceChapterLinkends) => {
|
|
1837
|
+
return referenceChapterLinkends.includes(linkend);
|
|
1838
|
+
};
|
|
1839
|
+
var validateLinkend = (linkElement, root, referenceChapterLinkends = []) => {
|
|
1840
|
+
const store = linkElement.getAttribute("store");
|
|
1841
|
+
if (!store) {
|
|
1842
|
+
return [];
|
|
1843
|
+
}
|
|
1844
|
+
const linkend = linkElement.getAttribute("linkend");
|
|
1845
|
+
if (!linkend) {
|
|
1846
|
+
return [];
|
|
1847
|
+
}
|
|
1848
|
+
const isLinkFootnoteCue = linkElement.tagName.toUpperCase() === FOOTNOTE_LINK_SCHEMA.tag;
|
|
1849
|
+
if (isLinkFootnoteCue) {
|
|
1850
|
+
if (findElementInCurrentChapter(root, linkend)) {
|
|
1851
|
+
return [];
|
|
1852
|
+
}
|
|
1853
|
+
return [
|
|
1854
|
+
{
|
|
1855
|
+
id: `unlinked-footnote-cue-${store}`,
|
|
1856
|
+
store,
|
|
1857
|
+
title: "Unlinked footnote cue",
|
|
1858
|
+
kind: "unlinked",
|
|
1859
|
+
description: "This footnote cue is not referenced to any footnote in this chapter. Please link it again manually.",
|
|
1860
|
+
level: "blocker"
|
|
1861
|
+
}
|
|
1862
|
+
];
|
|
1863
|
+
}
|
|
1864
|
+
if (findElementInCurrentChapter(root, linkend) || findElementInReferenceChapters(linkend, referenceChapterLinkends)) {
|
|
1865
|
+
return [];
|
|
1866
|
+
}
|
|
1867
|
+
return [
|
|
1868
|
+
{
|
|
1869
|
+
id: `unlinked-element-${store}`,
|
|
1870
|
+
store,
|
|
1871
|
+
title: "Unlinked element",
|
|
1872
|
+
kind: "unlinked",
|
|
1873
|
+
description: "This link is not referenced to any element in the current chapter or reference chapters. Please link it again manually.",
|
|
1874
|
+
level: "blocker"
|
|
1875
|
+
}
|
|
1876
|
+
];
|
|
1877
|
+
};
|
|
1878
|
+
var validateLinkends = (root, referenceChapterLinkends = []) => {
|
|
1879
|
+
const errors = [];
|
|
1880
|
+
for (const linkElement of root.querySelectorAll("[linkend]")) {
|
|
1881
|
+
errors.push(
|
|
1882
|
+
...validateLinkend(linkElement, root, referenceChapterLinkends)
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1885
|
+
return errors;
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
// src/validation/validateAttributes.ts
|
|
1889
|
+
var validateAttributes = (element, schema) => {
|
|
1890
|
+
const errors = [];
|
|
1891
|
+
const definitions = [
|
|
1892
|
+
...schema.requiredAttributes,
|
|
1893
|
+
...schema.optionalAttributes
|
|
1894
|
+
];
|
|
1895
|
+
for (const attribute of schema.requiredAttributes) {
|
|
1896
|
+
const name = getAttributeName(attribute);
|
|
1897
|
+
if (!element.hasAttribute(name)) {
|
|
1898
|
+
errors.push({
|
|
1899
|
+
id: `missing-required-attribute-${name}`,
|
|
1900
|
+
store: element.id,
|
|
1901
|
+
title: `Missing required attribute "${name}"`,
|
|
1902
|
+
level: "warning",
|
|
1903
|
+
kind: "missing",
|
|
1904
|
+
description: `The attribute "${name}" is required but not present in the element.`
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
for (const name of element.getAttributeNames()) {
|
|
1909
|
+
if (isIgnoredAttribute(name)) {
|
|
1910
|
+
continue;
|
|
1911
|
+
}
|
|
1912
|
+
const definition = findAttributeDefinitionByName(definitions, name);
|
|
1913
|
+
if (!definition) {
|
|
1914
|
+
errors.push({
|
|
1915
|
+
id: `unexpected-attribute-${name}`,
|
|
1916
|
+
store: element.id,
|
|
1917
|
+
title: `Unexpected attribute "${name}"`,
|
|
1918
|
+
level: "warning",
|
|
1919
|
+
kind: "forbidden",
|
|
1920
|
+
description: `The attribute "${name}" is not allowed in this element.`
|
|
1921
|
+
});
|
|
1922
|
+
continue;
|
|
1923
|
+
}
|
|
1924
|
+
if (!isAttributeRestricted(definition)) {
|
|
1925
|
+
continue;
|
|
1926
|
+
}
|
|
1927
|
+
const value = element.getAttribute(name);
|
|
1928
|
+
if (value === null) {
|
|
1929
|
+
continue;
|
|
1930
|
+
}
|
|
1931
|
+
if (!definition.values.includes(value)) {
|
|
1932
|
+
errors.push({
|
|
1933
|
+
id: `forbidden-attribute-value-${name}-${value}`,
|
|
1934
|
+
store: element.id,
|
|
1935
|
+
title: `Invalid attribute value "${value}"`,
|
|
1936
|
+
level: "warning",
|
|
1937
|
+
kind: "forbidden",
|
|
1938
|
+
description: `The attribute "${name}" has an invalid value "${value}".`
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
return errors;
|
|
1943
|
+
};
|
|
1944
|
+
|
|
1945
|
+
// src/validation/validateChildren.ts
|
|
1946
|
+
var validateElementAgainstSchema = (element, schema) => {
|
|
1947
|
+
const errors = [];
|
|
1948
|
+
if (element.tagName.toUpperCase() !== schema.tag) {
|
|
1949
|
+
errors.push({
|
|
1950
|
+
id: `expected-element-${schema.tag}`,
|
|
1951
|
+
store: element.id,
|
|
1952
|
+
title: `Expected ${schema.tag}, got ${element.tagName}`,
|
|
1953
|
+
level: "warning",
|
|
1954
|
+
kind: "forbidden",
|
|
1955
|
+
description: `The element is not allowed in this context.`
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
if (schema.code === "insertion" && !element.classList.contains("ins")) {
|
|
1959
|
+
errors.push({
|
|
1960
|
+
id: `missing-class-ins-${element.id}`,
|
|
1961
|
+
store: element.id,
|
|
1962
|
+
title: 'Missing class "ins" for insertion element',
|
|
1963
|
+
level: "warning",
|
|
1964
|
+
kind: "missing",
|
|
1965
|
+
description: `The element is missing the class "ins".`
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
if (schema.code === "deletion" && !element.classList.contains("del")) {
|
|
1969
|
+
errors.push({
|
|
1970
|
+
id: `missing-class-del-${element.id}`,
|
|
1971
|
+
store: element.id,
|
|
1972
|
+
title: 'Missing class "del" for deletion element',
|
|
1973
|
+
level: "warning",
|
|
1974
|
+
kind: "missing",
|
|
1975
|
+
description: `The element is missing the class "del".`
|
|
1976
|
+
});
|
|
1977
|
+
}
|
|
1978
|
+
if (schema.code === "commentQuerySection" && !element.classList.contains("cmtQurySection")) {
|
|
1979
|
+
errors.push({
|
|
1980
|
+
id: `missing-class-cmtQurySection-${element.id}`,
|
|
1981
|
+
store: element.id,
|
|
1982
|
+
title: 'Missing class "cmtQurySection" for comment query section',
|
|
1983
|
+
level: "warning",
|
|
1984
|
+
kind: "missing",
|
|
1985
|
+
description: `The element is missing the class "cmtQurySection".`
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
errors.push(...validateAttributes(element, schema));
|
|
1989
|
+
errors.push(...validateChildren(element, schema));
|
|
1990
|
+
return errors;
|
|
1991
|
+
};
|
|
1992
|
+
var validateChildren = (element, schema) => {
|
|
1993
|
+
const errors = [];
|
|
1994
|
+
const childElements = [...element.children].filter(
|
|
1995
|
+
(child) => !isIgnoredElement(child)
|
|
1996
|
+
);
|
|
1997
|
+
const allowedChildren = [...schema.allowedChildTagNames];
|
|
1998
|
+
for (const child of childElements) {
|
|
1999
|
+
const childTag = child.tagName.toUpperCase();
|
|
2000
|
+
const allowedChild = allowedChildren.find(
|
|
2001
|
+
(candidate) => candidate.tagName === childTag
|
|
2002
|
+
);
|
|
2003
|
+
if (!allowedChild) {
|
|
2004
|
+
errors.push({
|
|
2005
|
+
id: `forbidden-child-element-${child.tagName}`,
|
|
2006
|
+
store: child.id,
|
|
2007
|
+
title: `Forbidden child element ${child.tagName}`,
|
|
2008
|
+
level: "warning",
|
|
2009
|
+
kind: "forbidden",
|
|
2010
|
+
description: `The child element ${child.tagName} is not allowed in this context.`
|
|
2011
|
+
});
|
|
2012
|
+
continue;
|
|
2013
|
+
}
|
|
2014
|
+
const childSchema = findSchemaByElement(child);
|
|
2015
|
+
if (!childSchema) {
|
|
2016
|
+
errors.push({
|
|
2017
|
+
id: `no-schema-found-for-child-element-${child.tagName}`,
|
|
2018
|
+
store: child.id,
|
|
2019
|
+
title: `No schema found for child element ${child.tagName}`,
|
|
2020
|
+
level: "warning",
|
|
2021
|
+
kind: "missing",
|
|
2022
|
+
description: `No schema found for child element ${child.tagName}.`
|
|
2023
|
+
});
|
|
2024
|
+
continue;
|
|
2025
|
+
}
|
|
2026
|
+
errors.push(...validateElementAgainstSchema(child, childSchema));
|
|
2027
|
+
}
|
|
2028
|
+
for (const allowedChild of allowedChildren) {
|
|
2029
|
+
if (!allowedChild.required) {
|
|
2030
|
+
continue;
|
|
2031
|
+
}
|
|
2032
|
+
const hasChild = childElements.some(
|
|
2033
|
+
(child) => child.tagName.toUpperCase() === allowedChild.tagName
|
|
2034
|
+
);
|
|
2035
|
+
if (!hasChild) {
|
|
2036
|
+
errors.push({
|
|
2037
|
+
id: `missing-required-child-element-${allowedChild.tagName}`,
|
|
2038
|
+
store: element.id,
|
|
2039
|
+
title: `Missing required child element ${allowedChild.tagName}`,
|
|
2040
|
+
level: "warning",
|
|
2041
|
+
kind: "missing",
|
|
2042
|
+
description: `The child element ${allowedChild.tagName} is required but not present.`
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
if (schema.allowedChildTagNames.size === 0 && childElements.length > 0) {
|
|
2047
|
+
errors.push({
|
|
2048
|
+
id: `leaf-element-cannot-contain-child-elements-${element.id}`,
|
|
2049
|
+
store: element.id,
|
|
2050
|
+
title: "Leaf element cannot contain child elements",
|
|
2051
|
+
level: "warning",
|
|
2052
|
+
kind: "forbidden",
|
|
2053
|
+
description: `The element is a leaf element and cannot contain child elements.`
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
return errors;
|
|
2057
|
+
};
|
|
2058
|
+
|
|
2059
|
+
// src/validation/utils/parseXML.ts
|
|
2060
|
+
var parseXml = (xml) => {
|
|
2061
|
+
const doc = new DOMParser().parseFromString(xml.trim(), "application/xml");
|
|
2062
|
+
const parserError = doc.querySelector("parsererror");
|
|
2063
|
+
if (parserError) {
|
|
2064
|
+
throw new Error(
|
|
2065
|
+
`Unable to parse XML: ${parserError.textContent ?? "unknown error"}`
|
|
2066
|
+
);
|
|
2067
|
+
}
|
|
2068
|
+
const element = doc.documentElement;
|
|
2069
|
+
if (!element) {
|
|
2070
|
+
throw new Error("XML string did not produce an element");
|
|
2071
|
+
}
|
|
2072
|
+
return element;
|
|
2073
|
+
};
|
|
2074
|
+
|
|
2075
|
+
// src/validation/validateXml.ts
|
|
2076
|
+
var getLinkableRoles = () => {
|
|
2077
|
+
const linkRoleDefinition = findAttributeDefinitionByName(
|
|
2078
|
+
LINK_SCHEMA.requiredAttributes,
|
|
2079
|
+
"role"
|
|
2080
|
+
);
|
|
2081
|
+
if (!linkRoleDefinition) {
|
|
2082
|
+
return [];
|
|
2083
|
+
}
|
|
2084
|
+
if (isAttributeRestricted(linkRoleDefinition)) {
|
|
2085
|
+
return linkRoleDefinition.values;
|
|
2086
|
+
}
|
|
2087
|
+
return [];
|
|
2088
|
+
};
|
|
2089
|
+
var validateElement = (element, root, referenceChapterLinkends) => {
|
|
2090
|
+
if (isIgnoredElement(element)) {
|
|
2091
|
+
return [];
|
|
2092
|
+
}
|
|
2093
|
+
const errors = [];
|
|
2094
|
+
const schema = findSchemaByElement(element);
|
|
2095
|
+
if (schema) {
|
|
2096
|
+
errors.push(...validateElementAgainstSchema(element, schema));
|
|
2097
|
+
const role = element.getAttribute("role") || "";
|
|
2098
|
+
const linkableRoles = getLinkableRoles();
|
|
2099
|
+
if (schema.tag === LINK_SCHEMA.tag && linkableRoles.includes(role) || schema.tag === FOOTNOTE_LINK_SCHEMA.tag) {
|
|
2100
|
+
errors.push(...validateLinkend(element, root, referenceChapterLinkends));
|
|
2101
|
+
}
|
|
2102
|
+
if (schema.tag === FOOTNOTE_SCHEMA.tag) {
|
|
2103
|
+
errors.push(...validateFootnoteCue(element, root));
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
for (const child of Array.from(element.children)) {
|
|
2107
|
+
errors.push(...validateElement(child, root, referenceChapterLinkends));
|
|
2108
|
+
}
|
|
2109
|
+
return errors;
|
|
2110
|
+
};
|
|
2111
|
+
var validateXml = (xml, referenceChapterLinkends) => {
|
|
2112
|
+
const root = parseXml(xml);
|
|
2113
|
+
const errors = [];
|
|
2114
|
+
errors.push(...validateConsecutiveFootnotes(root));
|
|
2115
|
+
errors.push(...validateConsecutiveFootnoteCues(root));
|
|
2116
|
+
for (const child of Array.from(root.children)) {
|
|
2117
|
+
errors.push(...validateElement(child, root, referenceChapterLinkends));
|
|
2118
|
+
}
|
|
2119
|
+
return errors;
|
|
2120
|
+
};
|
|
1646
2121
|
export {
|
|
1647
2122
|
ABSTRACT_SCHEMA,
|
|
1648
2123
|
ABSTRACT_TAG,
|
|
@@ -1674,7 +2149,6 @@ export {
|
|
|
1674
2149
|
DELETION_SCHEMA,
|
|
1675
2150
|
DIALOGUE_SCHEMA,
|
|
1676
2151
|
DIALOGUE_TAG,
|
|
1677
|
-
ELEMENT_ROLE,
|
|
1678
2152
|
ELEMENT_SCHEMAS,
|
|
1679
2153
|
ELEMENT_TAGS,
|
|
1680
2154
|
ELE_ID_ATTRIBUTE,
|
|
@@ -1829,10 +2303,20 @@ export {
|
|
|
1829
2303
|
U_SCHEMA,
|
|
1830
2304
|
createElement,
|
|
1831
2305
|
findAttributeDefinitionByName,
|
|
2306
|
+
findSchemaByCode,
|
|
1832
2307
|
findSchemaByElement,
|
|
1833
|
-
findSchemaByTag,
|
|
1834
2308
|
getAttributeName,
|
|
1835
2309
|
isAttributeRestricted,
|
|
1836
2310
|
isIgnoredAttribute,
|
|
1837
|
-
isIgnoredElement
|
|
2311
|
+
isIgnoredElement,
|
|
2312
|
+
validateAttributes,
|
|
2313
|
+
validateConsecutiveFootnoteCues,
|
|
2314
|
+
validateConsecutiveFootnotes,
|
|
2315
|
+
validateElement,
|
|
2316
|
+
validateElementAgainstSchema,
|
|
2317
|
+
validateFootnoteCue,
|
|
2318
|
+
validateFootnotes,
|
|
2319
|
+
validateLinkend,
|
|
2320
|
+
validateLinkends,
|
|
2321
|
+
validateXml
|
|
1838
2322
|
};
|