pro-editor-schema 1.6.13-dev.2 → 1.6.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/README.md +0 -1
- package/dist/index.d.mts +150 -159
- package/dist/index.d.ts +150 -159
- package/dist/index.js +271 -261
- package/dist/index.mjs +270 -257
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -129,7 +129,7 @@ var INLINE_ELEMENT_CODES_ALLOWED_CHILDREN = [
|
|
|
129
129
|
// src/schema/elementSchemas/atoms/deletion.ts
|
|
130
130
|
var DELETION_SCHEMA = createSchema({
|
|
131
131
|
code: "deletion",
|
|
132
|
-
kind: "
|
|
132
|
+
kind: "atom",
|
|
133
133
|
tag: SPAN_TAG,
|
|
134
134
|
matchesElement: (element) => element.classList.contains("del"),
|
|
135
135
|
requiredAttributes: [...TRACK_CHANGES_ATTRS, ...ID_ATTRS],
|
|
@@ -161,7 +161,7 @@ var EMPHASIS_SCHEMA = createSchema({
|
|
|
161
161
|
var PREV_FORMAT_ATTRIBUTE = "prev-format";
|
|
162
162
|
var FORMAT_REMOVAL_SCHEMA = createSchema({
|
|
163
163
|
code: "formatRemoval",
|
|
164
|
-
kind: "
|
|
164
|
+
kind: "atom",
|
|
165
165
|
tag: SPAN_TAG,
|
|
166
166
|
matchesElement: (element) => element.hasAttribute(PREV_FORMAT_ATTRIBUTE),
|
|
167
167
|
requiredAttributes: [PREV_FORMAT_ATTRIBUTE],
|
|
@@ -195,7 +195,7 @@ var I_SCHEMA = createSchema({
|
|
|
195
195
|
// src/schema/elementSchemas/atoms/insertion.ts
|
|
196
196
|
var INSERTION_SCHEMA = createSchema({
|
|
197
197
|
code: "insertion",
|
|
198
|
-
kind: "
|
|
198
|
+
kind: "atom",
|
|
199
199
|
tag: SPAN_TAG,
|
|
200
200
|
matchesElement: (element) => element.classList.contains("ins"),
|
|
201
201
|
requiredAttributes: [...TRACK_CHANGES_ATTRS, ...ID_ATTRS],
|
|
@@ -215,7 +215,7 @@ var INSERTION_SCHEMA = createSchema({
|
|
|
215
215
|
// src/schema/elementSchemas/atoms/lineGroupRemoval.ts
|
|
216
216
|
var LINE_GROUP_REMOVAL_SCHEMA = createSchema({
|
|
217
217
|
code: "lineGroupRemoval",
|
|
218
|
-
kind: "
|
|
218
|
+
kind: "atom",
|
|
219
219
|
tag: SPAN_TAG,
|
|
220
220
|
matchesElement: (element) => element.getAttribute("data-line-group-action") === "removed" && element.getAttribute("data-track-change-wrapper") === "unwrap",
|
|
221
221
|
requiredAttributes: [
|
|
@@ -694,7 +694,6 @@ var BLOCKQUOTE_TAG = "BLOCKQUOTE";
|
|
|
694
694
|
var SIDEBAR_TAG = "SIDEBAR";
|
|
695
695
|
var CHAPTER_TAG = "CHAPTER";
|
|
696
696
|
var EPIGRAPH_TAG = "EPIGRAPH";
|
|
697
|
-
var EXAMPLE_TAG = "EXAMPLE";
|
|
698
697
|
var INFO_TAG = "INFO1";
|
|
699
698
|
var POEM_TAG = "POEM";
|
|
700
699
|
var REFERENCE_BIBLIOGRAPHY_TAG = "BIBLIOGRAPHY";
|
|
@@ -745,7 +744,7 @@ var MUNDEROVER_TAG = "MUNDEROVER";
|
|
|
745
744
|
// src/schema/elementSchemas/elements/authors/authorgroup.ts
|
|
746
745
|
var AUTHORGROUP_SCHEMA = createSchema({
|
|
747
746
|
code: "authorgroup",
|
|
748
|
-
kind: "
|
|
747
|
+
kind: "element",
|
|
749
748
|
tag: AUTHORGROUP_TAG,
|
|
750
749
|
requiredAttributes: [...ID_ATTRS],
|
|
751
750
|
optionalAttributes: [],
|
|
@@ -758,7 +757,7 @@ var AUTHORGROUP_SCHEMA = createSchema({
|
|
|
758
757
|
// src/schema/elementSchemas/elements/authors/author.ts
|
|
759
758
|
var AUTHOR_SCHEMA = createSchema({
|
|
760
759
|
code: "author",
|
|
761
|
-
kind: "
|
|
760
|
+
kind: "element",
|
|
762
761
|
tag: AUTHOR_TAG,
|
|
763
762
|
requiredAttributes: [...ID_ATTRS],
|
|
764
763
|
optionalAttributes: [],
|
|
@@ -785,7 +784,7 @@ var OLINK_SCHEMA = createSchema({
|
|
|
785
784
|
// src/schema/elementSchemas/elements/authors/personname.ts
|
|
786
785
|
var PERSONNAME_SCHEMA = createSchema({
|
|
787
786
|
code: "personname",
|
|
788
|
-
kind: "
|
|
787
|
+
kind: "element",
|
|
789
788
|
tag: PERSONNAME_TAG,
|
|
790
789
|
requiredAttributes: [...ID_ATTRS],
|
|
791
790
|
optionalAttributes: [],
|
|
@@ -849,7 +848,7 @@ var EMAIL_SCHEMA = createSchema({
|
|
|
849
848
|
// src/schema/elementSchemas/elements/authors/org.ts
|
|
850
849
|
var ORG_SCHEMA = createSchema({
|
|
851
850
|
code: "org",
|
|
852
|
-
kind: "
|
|
851
|
+
kind: "element",
|
|
853
852
|
tag: ORG_TAG,
|
|
854
853
|
requiredAttributes: [...ID_ATTRS],
|
|
855
854
|
optionalAttributes: [],
|
|
@@ -859,7 +858,7 @@ var ORG_SCHEMA = createSchema({
|
|
|
859
858
|
// src/schema/elementSchemas/elements/authors/affiliation.ts
|
|
860
859
|
var AFFILIATION_SCHEMA = createSchema({
|
|
861
860
|
code: "affiliation",
|
|
862
|
-
kind: "
|
|
861
|
+
kind: "element",
|
|
863
862
|
tag: AFFILIATION_TAG,
|
|
864
863
|
requiredAttributes: [...ID_ATTRS],
|
|
865
864
|
optionalAttributes: [],
|
|
@@ -902,7 +901,7 @@ var SPEAKER_SCHEMA = createSchema({
|
|
|
902
901
|
// src/schema/elementSchemas/elements/dialogue/dialogue.ts
|
|
903
902
|
var DIALOGUE_SCHEMA = createSchema({
|
|
904
903
|
code: "dialogue",
|
|
905
|
-
kind: "
|
|
904
|
+
kind: "element",
|
|
906
905
|
tag: DIALOGUE_TAG,
|
|
907
906
|
requiredAttributes: [...ID_ATTRS],
|
|
908
907
|
optionalAttributes: [...TRACK_CHANGES_ATTRS, "role", "trackmsg"],
|
|
@@ -916,7 +915,7 @@ var DIALOGUE_SCHEMA = createSchema({
|
|
|
916
915
|
// src/schema/elementSchemas/elements/equation/equation.ts
|
|
917
916
|
var EQUATION_SCHEMA = createSchema({
|
|
918
917
|
code: "equation",
|
|
919
|
-
kind: "
|
|
918
|
+
kind: "element",
|
|
920
919
|
tag: EQUATION_TAG,
|
|
921
920
|
requiredAttributes: [...ID_ATTRS],
|
|
922
921
|
optionalAttributes: [
|
|
@@ -1287,7 +1286,7 @@ var IMG_SCHEMA = createSchema({
|
|
|
1287
1286
|
// src/schema/elementSchemas/elements/figure/alttext.ts
|
|
1288
1287
|
var ALTTEXT_SCHEMA = createSchema({
|
|
1289
1288
|
code: "alttext",
|
|
1290
|
-
kind: "
|
|
1289
|
+
kind: "element",
|
|
1291
1290
|
tag: ALTTEXT_TAG,
|
|
1292
1291
|
requiredAttributes: [],
|
|
1293
1292
|
optionalAttributes: [],
|
|
@@ -1297,7 +1296,7 @@ var ALTTEXT_SCHEMA = createSchema({
|
|
|
1297
1296
|
// src/schema/elementSchemas/elements/figure/imageobject.ts
|
|
1298
1297
|
var IMAGEOBJECT_SCHEMA = createSchema({
|
|
1299
1298
|
code: "imageobject",
|
|
1300
|
-
kind: "
|
|
1299
|
+
kind: "element",
|
|
1301
1300
|
tag: IMAGEOBJECT_TAG,
|
|
1302
1301
|
requiredAttributes: [...ID_ATTRS],
|
|
1303
1302
|
optionalAttributes: [],
|
|
@@ -1310,7 +1309,7 @@ var IMAGEOBJECT_SCHEMA = createSchema({
|
|
|
1310
1309
|
// src/schema/elementSchemas/elements/figure/mediaobject.ts
|
|
1311
1310
|
var MEDIAOBJECT_SCHEMA = createSchema({
|
|
1312
1311
|
code: "mediaobject",
|
|
1313
|
-
kind: "
|
|
1312
|
+
kind: "element",
|
|
1314
1313
|
tag: MEDIAOBJECT_TAG,
|
|
1315
1314
|
requiredAttributes: [...ID_ATTRS],
|
|
1316
1315
|
optionalAttributes: [...TRACK_CHANGES_ATTRS],
|
|
@@ -1320,7 +1319,7 @@ var MEDIAOBJECT_SCHEMA = createSchema({
|
|
|
1320
1319
|
// src/schema/elementSchemas/elements/figure/caption1.ts
|
|
1321
1320
|
var CAPTION_SCHEMA = createSchema({
|
|
1322
1321
|
code: "caption1",
|
|
1323
|
-
kind: "
|
|
1322
|
+
kind: "element",
|
|
1324
1323
|
tag: CAPTION_TAG,
|
|
1325
1324
|
requiredAttributes: [...ID_ATTRS],
|
|
1326
1325
|
optionalAttributes: [],
|
|
@@ -1356,7 +1355,7 @@ var FIGNOTE_SCHEMA = createSchema({
|
|
|
1356
1355
|
// src/schema/elementSchemas/elements/figure/figure.ts
|
|
1357
1356
|
var FIGURE_SCHEMA = createSchema({
|
|
1358
1357
|
code: "figure1",
|
|
1359
|
-
kind: "
|
|
1358
|
+
kind: "element",
|
|
1360
1359
|
tag: FIGURE_TAG,
|
|
1361
1360
|
requiredAttributes: [...ID_ATTRS, "xmlid"],
|
|
1362
1361
|
optionalAttributes: [
|
|
@@ -1378,7 +1377,7 @@ var FIGURE_SCHEMA = createSchema({
|
|
|
1378
1377
|
// src/schema/elementSchemas/elements/footnote.ts
|
|
1379
1378
|
var FOOTNOTE_SCHEMA = createSchema({
|
|
1380
1379
|
code: "footnote",
|
|
1381
|
-
kind: "
|
|
1380
|
+
kind: "element",
|
|
1382
1381
|
tag: FOOTNOTE_TAG,
|
|
1383
1382
|
requiredAttributes: [
|
|
1384
1383
|
...ID_ATTRS,
|
|
@@ -1411,7 +1410,7 @@ var FOOTNOTE_NUMBER_SCHEMA = createSchema({
|
|
|
1411
1410
|
// src/schema/elementSchemas/elements/informalfigure.ts
|
|
1412
1411
|
var INFORMALFIGURE_SCHEMA = createSchema({
|
|
1413
1412
|
code: "informalfigure",
|
|
1414
|
-
kind: "
|
|
1413
|
+
kind: "element",
|
|
1415
1414
|
tag: INFORMALFIGURE_TAG,
|
|
1416
1415
|
requiredAttributes: [...ID_ATTRS],
|
|
1417
1416
|
optionalAttributes: [...TRACK_CHANGES_ATTRS, "data-anchor-id"],
|
|
@@ -1424,7 +1423,7 @@ var INFORMALFIGURE_SCHEMA = createSchema({
|
|
|
1424
1423
|
// src/schema/elementSchemas/elements/keywords/keywordset.ts
|
|
1425
1424
|
var KEYWORDSET_SCHEMA = createSchema({
|
|
1426
1425
|
code: "keywordset",
|
|
1427
|
-
kind: "
|
|
1426
|
+
kind: "element",
|
|
1428
1427
|
tag: KEYWORDSET_TAG,
|
|
1429
1428
|
requiredAttributes: [
|
|
1430
1429
|
...ID_ATTRS,
|
|
@@ -1488,7 +1487,7 @@ var LABEL_SCHEMA = createSchema({
|
|
|
1488
1487
|
// src/schema/elementSchemas/elements/lineGroup.ts
|
|
1489
1488
|
var LINE_GROUP_SCHEMA = createSchema({
|
|
1490
1489
|
code: "linegroup",
|
|
1491
|
-
kind: "
|
|
1490
|
+
kind: "element",
|
|
1492
1491
|
tag: LINE_GROUP_TAG,
|
|
1493
1492
|
requiredAttributes: [...ID_ATTRS],
|
|
1494
1493
|
optionalAttributes: [
|
|
@@ -1543,7 +1542,7 @@ var LI_SCHEMA = createSchema({
|
|
|
1543
1542
|
// src/schema/elementSchemas/elements/list/ol.ts
|
|
1544
1543
|
var OL_SCHEMA = createSchema({
|
|
1545
1544
|
code: "ol",
|
|
1546
|
-
kind: "
|
|
1545
|
+
kind: "element",
|
|
1547
1546
|
tag: OL_TAG,
|
|
1548
1547
|
requiredAttributes: [...ID_ATTRS],
|
|
1549
1548
|
optionalAttributes: [
|
|
@@ -1580,7 +1579,7 @@ var OL_SCHEMA = createSchema({
|
|
|
1580
1579
|
// src/schema/elementSchemas/elements/list/ul.ts
|
|
1581
1580
|
var UL_SCHEMA = createSchema({
|
|
1582
1581
|
code: "ul",
|
|
1583
|
-
kind: "
|
|
1582
|
+
kind: "element",
|
|
1584
1583
|
tag: UL_TAG,
|
|
1585
1584
|
requiredAttributes: [...ID_ATTRS],
|
|
1586
1585
|
optionalAttributes: [
|
|
@@ -1736,7 +1735,7 @@ var TP_SCHEMA = createSchema({
|
|
|
1736
1735
|
// src/schema/elementSchemas/elements/table/td.ts
|
|
1737
1736
|
var TD_SCHEMA = createSchema({
|
|
1738
1737
|
code: "td",
|
|
1739
|
-
kind: "
|
|
1738
|
+
kind: "element",
|
|
1740
1739
|
tag: TD_TAG,
|
|
1741
1740
|
requiredAttributes: [...ID_ATTRS],
|
|
1742
1741
|
optionalAttributes: [
|
|
@@ -1754,7 +1753,7 @@ var TD_SCHEMA = createSchema({
|
|
|
1754
1753
|
// src/schema/elementSchemas/elements/table/tr.ts
|
|
1755
1754
|
var TR_SCHEMA = createSchema({
|
|
1756
1755
|
code: "tr",
|
|
1757
|
-
kind: "
|
|
1756
|
+
kind: "element",
|
|
1758
1757
|
tag: TR_TAG,
|
|
1759
1758
|
requiredAttributes: [],
|
|
1760
1759
|
optionalAttributes: [...LAYOUT_ATTRIBUTES, ...ID_ATTRS, "width"],
|
|
@@ -1764,7 +1763,7 @@ var TR_SCHEMA = createSchema({
|
|
|
1764
1763
|
// src/schema/elementSchemas/elements/table/thead.ts
|
|
1765
1764
|
var THEAD_SCHEMA = createSchema({
|
|
1766
1765
|
code: "thead",
|
|
1767
|
-
kind: "
|
|
1766
|
+
kind: "element",
|
|
1768
1767
|
tag: THEAD_TAG,
|
|
1769
1768
|
requiredAttributes: [],
|
|
1770
1769
|
optionalAttributes: [...ID_ATTRS],
|
|
@@ -1774,7 +1773,7 @@ var THEAD_SCHEMA = createSchema({
|
|
|
1774
1773
|
// src/schema/elementSchemas/elements/table/tbody.ts
|
|
1775
1774
|
var TBODY_SCHEMA = createSchema({
|
|
1776
1775
|
code: "tbody",
|
|
1777
|
-
kind: "
|
|
1776
|
+
kind: "element",
|
|
1778
1777
|
tag: TBODY_TAG,
|
|
1779
1778
|
requiredAttributes: [],
|
|
1780
1779
|
optionalAttributes: [...ID_ATTRS],
|
|
@@ -1784,7 +1783,7 @@ var TBODY_SCHEMA = createSchema({
|
|
|
1784
1783
|
// src/schema/elementSchemas/elements/table/htmlTable.ts
|
|
1785
1784
|
var HTML_TABLE_SCHEMA = createSchema({
|
|
1786
1785
|
code: "table",
|
|
1787
|
-
kind: "
|
|
1786
|
+
kind: "element",
|
|
1788
1787
|
tag: HTML_TABLE_TAG,
|
|
1789
1788
|
requiredAttributes: [],
|
|
1790
1789
|
optionalAttributes: [...ID_ATTRS],
|
|
@@ -1797,7 +1796,7 @@ var HTML_TABLE_SCHEMA = createSchema({
|
|
|
1797
1796
|
// src/schema/elementSchemas/elements/table/tgroup.ts
|
|
1798
1797
|
var TGROUP_SCHEMA = createSchema({
|
|
1799
1798
|
code: "tgroup",
|
|
1800
|
-
kind: "
|
|
1799
|
+
kind: "element",
|
|
1801
1800
|
tag: TGROUP_TAG,
|
|
1802
1801
|
requiredAttributes: [...ID_ATTRS, "cols"],
|
|
1803
1802
|
optionalAttributes: [],
|
|
@@ -1830,7 +1829,7 @@ var TBLSOURCE_SCHEMA = createSchema({
|
|
|
1830
1829
|
// src/schema/elementSchemas/elements/table/table1.ts
|
|
1831
1830
|
var TABLE_SCHEMA = createSchema({
|
|
1832
1831
|
code: "table1",
|
|
1833
|
-
kind: "
|
|
1832
|
+
kind: "element",
|
|
1834
1833
|
tag: TABLE_TAG,
|
|
1835
1834
|
requiredAttributes: [
|
|
1836
1835
|
...ID_ATTRS,
|
|
@@ -1865,7 +1864,7 @@ var HEADING_LEVEL = ["H0", "H1", "H2", "H3", "H4", "H5", "H6"];
|
|
|
1865
1864
|
var HEADING_ROLES = [...HEADING_LEVEL, "vignette_group"];
|
|
1866
1865
|
var HEADING_SCHEMA = createSchema({
|
|
1867
1866
|
code: "heading",
|
|
1868
|
-
kind: "
|
|
1867
|
+
kind: "element",
|
|
1869
1868
|
tag: SECTION_TAG,
|
|
1870
1869
|
matchesElement: (element) => {
|
|
1871
1870
|
const role = element.getAttribute("role");
|
|
@@ -1891,7 +1890,6 @@ var HEADING_SCHEMA = createSchema({
|
|
|
1891
1890
|
{ code: "sidebar", required: false },
|
|
1892
1891
|
{ code: "epigraph", required: false },
|
|
1893
1892
|
{ code: "blockquote", required: false },
|
|
1894
|
-
{ code: "example", required: false },
|
|
1895
1893
|
{ code: "ul", required: false },
|
|
1896
1894
|
{ code: "ol", required: false },
|
|
1897
1895
|
{ code: "poem", required: false },
|
|
@@ -1910,7 +1908,7 @@ var HEADING_SCHEMA = createSchema({
|
|
|
1910
1908
|
var BOX_LEVEL = ["box1", "box2", "box3", "box4", "box5"];
|
|
1911
1909
|
var BOX_SCHEMA = createSchema({
|
|
1912
1910
|
code: "sidebar",
|
|
1913
|
-
kind: "
|
|
1911
|
+
kind: "element",
|
|
1914
1912
|
tag: SIDEBAR_TAG,
|
|
1915
1913
|
requiredAttributes: [
|
|
1916
1914
|
...ID_ATTRS,
|
|
@@ -1967,7 +1965,7 @@ var TITLE_SCHEMA = createSchema({
|
|
|
1967
1965
|
// src/schema/elementSchemas/elements/abstract.ts
|
|
1968
1966
|
var ABSTRACT_SCHEMA = createSchema({
|
|
1969
1967
|
code: "abstract1",
|
|
1970
|
-
kind: "
|
|
1968
|
+
kind: "element",
|
|
1971
1969
|
tag: ABSTRACT_TAG,
|
|
1972
1970
|
requiredAttributes: [
|
|
1973
1971
|
...ID_ATTRS,
|
|
@@ -1997,7 +1995,7 @@ var ABSTRACT_SCHEMA = createSchema({
|
|
|
1997
1995
|
// src/schema/elementSchemas/elements/appendix.ts
|
|
1998
1996
|
var APPENDIX_SCHEMA = createSchema({
|
|
1999
1997
|
code: "appendix",
|
|
2000
|
-
kind: "
|
|
1998
|
+
kind: "element",
|
|
2001
1999
|
tag: APPENDIX_TAG,
|
|
2002
2000
|
requiredAttributes: [...ID_ATTRS, "id", "xmlid"],
|
|
2003
2001
|
optionalAttributes: [...TRACK_CHANGES_ATTRS],
|
|
@@ -2012,7 +2010,7 @@ var APPENDIX_SCHEMA = createSchema({
|
|
|
2012
2010
|
// src/schema/elementSchemas/elements/blockquote.ts
|
|
2013
2011
|
var BLOCKQUOTE_SCHEMA = createSchema({
|
|
2014
2012
|
code: "blockquote",
|
|
2015
|
-
kind: "
|
|
2013
|
+
kind: "element",
|
|
2016
2014
|
tag: BLOCKQUOTE_TAG,
|
|
2017
2015
|
requiredAttributes: [...ID_ATTRS],
|
|
2018
2016
|
optionalAttributes: [
|
|
@@ -2062,7 +2060,6 @@ var CHAPTER_SCHEMA = createSchema({
|
|
|
2062
2060
|
{ code: "sidebar", required: false },
|
|
2063
2061
|
{ code: "epigraph", required: false },
|
|
2064
2062
|
{ code: "blockquote", required: false },
|
|
2065
|
-
{ code: "example", required: false },
|
|
2066
2063
|
{ code: "ul", required: false },
|
|
2067
2064
|
{ code: "ol", required: false },
|
|
2068
2065
|
{ code: "subtitle1", required: false },
|
|
@@ -2078,7 +2075,7 @@ var CHAPTER_SCHEMA = createSchema({
|
|
|
2078
2075
|
// src/schema/elementSchemas/elements/epigraph.ts
|
|
2079
2076
|
var EPIGRAPH_SCHEMA = createSchema({
|
|
2080
2077
|
code: "epigraph",
|
|
2081
|
-
kind: "
|
|
2078
|
+
kind: "element",
|
|
2082
2079
|
tag: EPIGRAPH_TAG,
|
|
2083
2080
|
requiredAttributes: [...ID_ATTRS],
|
|
2084
2081
|
optionalAttributes: [
|
|
@@ -2097,32 +2094,11 @@ var EPIGRAPH_SCHEMA = createSchema({
|
|
|
2097
2094
|
]
|
|
2098
2095
|
});
|
|
2099
2096
|
|
|
2100
|
-
// src/schema/elementSchemas/elements/example.ts
|
|
2101
|
-
var EXAMPLE_SCHEMA = createSchema({
|
|
2102
|
-
code: "example",
|
|
2103
|
-
kind: "element",
|
|
2104
|
-
tag: EXAMPLE_TAG,
|
|
2105
|
-
requiredAttributes: [...ID_ATTRS],
|
|
2106
|
-
optionalAttributes: [
|
|
2107
|
-
...TRACK_CHANGES_ATTRS,
|
|
2108
|
-
"xmlid",
|
|
2109
|
-
"track-code",
|
|
2110
|
-
"element-change-description"
|
|
2111
|
-
],
|
|
2112
|
-
defaultChildCode: "para",
|
|
2113
|
-
allowedChildrenCodes: [
|
|
2114
|
-
{ code: "para", required: false },
|
|
2115
|
-
{ code: "ul", required: false },
|
|
2116
|
-
{ code: "ol", required: false },
|
|
2117
|
-
{ code: "tag", required: false }
|
|
2118
|
-
]
|
|
2119
|
-
});
|
|
2120
|
-
|
|
2121
2097
|
// src/schema/elementSchemas/elements/footnoteSection.ts
|
|
2122
2098
|
var FOOTNOTE_SECTION_ROLES = ["ch", "bk"];
|
|
2123
2099
|
var FOOTNOTE_SECTION_SCHEMA = createSchema({
|
|
2124
2100
|
code: "footnoteSection",
|
|
2125
|
-
kind: "
|
|
2101
|
+
kind: "element",
|
|
2126
2102
|
tag: SECTION_TAG,
|
|
2127
2103
|
matchesElement: (element) => {
|
|
2128
2104
|
const role = element.getAttribute("role");
|
|
@@ -2148,7 +2124,7 @@ var FOOTNOTE_SECTION_SCHEMA = createSchema({
|
|
|
2148
2124
|
// src/schema/elementSchemas/elements/info.ts
|
|
2149
2125
|
var INFO_SCHEMA = createSchema({
|
|
2150
2126
|
code: "info1",
|
|
2151
|
-
kind: "
|
|
2127
|
+
kind: "element",
|
|
2152
2128
|
tag: INFO_TAG,
|
|
2153
2129
|
requiredAttributes: [...ID_ATTRS],
|
|
2154
2130
|
optionalAttributes: [],
|
|
@@ -2166,7 +2142,7 @@ var INFO_SCHEMA = createSchema({
|
|
|
2166
2142
|
// src/schema/elementSchemas/elements/poem.ts
|
|
2167
2143
|
var POEM_SCHEMA = createSchema({
|
|
2168
2144
|
code: "poem",
|
|
2169
|
-
kind: "
|
|
2145
|
+
kind: "element",
|
|
2170
2146
|
tag: POEM_TAG,
|
|
2171
2147
|
requiredAttributes: [...ID_ATTRS],
|
|
2172
2148
|
optionalAttributes: [...TRACK_CHANGES_ATTRS, "role", "trackmsg"],
|
|
@@ -2192,7 +2168,7 @@ var MATHPHRASE_SCHEMA = createSchema({
|
|
|
2192
2168
|
// src/schema/elementSchemas/elements/reference/bibliography.ts
|
|
2193
2169
|
var REFERENCE_BIBLIOGRAPHY_SCHEMA = createSchema({
|
|
2194
2170
|
code: "referenceBibliography",
|
|
2195
|
-
kind: "
|
|
2171
|
+
kind: "element",
|
|
2196
2172
|
tag: REFERENCE_BIBLIOGRAPHY_TAG,
|
|
2197
2173
|
requiredAttributes: [
|
|
2198
2174
|
...ID_ATTRS,
|
|
@@ -2220,7 +2196,7 @@ var REFERENCE_BIBLIOGRAPHY_SCHEMA = createSchema({
|
|
|
2220
2196
|
// src/schema/elementSchemas/elements/reference/bibliodiv.ts
|
|
2221
2197
|
var BIBLIODIV_SCHEMA = createSchema({
|
|
2222
2198
|
code: "bibliodiv",
|
|
2223
|
-
kind: "
|
|
2199
|
+
kind: "element",
|
|
2224
2200
|
tag: BIBLIODIV_TAG,
|
|
2225
2201
|
requiredAttributes: [
|
|
2226
2202
|
...ID_ATTRS,
|
|
@@ -2299,11 +2275,14 @@ var LEGAL_REFERENCE_BIBLIOMISC_ROLE = "legalRef";
|
|
|
2299
2275
|
|
|
2300
2276
|
// src/schema/elementSchemas/elements/index.ts
|
|
2301
2277
|
var ELEMENT_SCHEMAS = {
|
|
2278
|
+
bibliodiv: BIBLIODIV_SCHEMA,
|
|
2279
|
+
referenceBibliography: REFERENCE_BIBLIOGRAPHY_SCHEMA,
|
|
2302
2280
|
translator: TRANSLATOR_SCHEMA,
|
|
2303
2281
|
pagenum: PAGENUM_SCHEMA,
|
|
2304
2282
|
pubId: PUB_ID_SCHEMA,
|
|
2305
2283
|
para: PARA_SCHEMA,
|
|
2306
2284
|
title1: TITLE_SCHEMA,
|
|
2285
|
+
footnote: FOOTNOTE_SCHEMA,
|
|
2307
2286
|
footnoteno: FOOTNOTE_NUMBER_SCHEMA,
|
|
2308
2287
|
olink: OLINK_SCHEMA,
|
|
2309
2288
|
firstname: FIRSTNAME_SCHEMA,
|
|
@@ -2311,9 +2290,13 @@ var ELEMENT_SCHEMAS = {
|
|
|
2311
2290
|
honorific: HONORIFIC_SCHEMA,
|
|
2312
2291
|
orgname: ORGNAME_SCHEMA,
|
|
2313
2292
|
email: EMAIL_SCHEMA,
|
|
2293
|
+
org: ORG_SCHEMA,
|
|
2314
2294
|
degrees: DEGREES_SCHEMA,
|
|
2295
|
+
dialogue: DIALOGUE_SCHEMA,
|
|
2315
2296
|
line: LINE_SCHEMA,
|
|
2297
|
+
linegroup: LINE_GROUP_SCHEMA,
|
|
2316
2298
|
speaker: SPEAKER_SCHEMA,
|
|
2299
|
+
equation: EQUATION_SCHEMA,
|
|
2317
2300
|
math: MATH_SCHEMA,
|
|
2318
2301
|
mathphrase: MATHPHRASE_SCHEMA,
|
|
2319
2302
|
merror: MERROR_SCHEMA,
|
|
@@ -2342,40 +2325,27 @@ var ELEMENT_SCHEMAS = {
|
|
|
2342
2325
|
munder: MUNDER_SCHEMA,
|
|
2343
2326
|
munderover: MUNDEROVER_SCHEMA,
|
|
2344
2327
|
img: IMG_SCHEMA,
|
|
2328
|
+
alttext: ALTTEXT_SCHEMA,
|
|
2329
|
+
imageobject: IMAGEOBJECT_SCHEMA,
|
|
2330
|
+
mediaobject: MEDIAOBJECT_SCHEMA,
|
|
2331
|
+
caption1: CAPTION_SCHEMA,
|
|
2345
2332
|
figsource: FIGSOURCE_SCHEMA,
|
|
2346
2333
|
fignote: FIGNOTE_SCHEMA,
|
|
2334
|
+
figure1: FIGURE_SCHEMA,
|
|
2335
|
+
informalfigure: INFORMALFIGURE_SCHEMA,
|
|
2336
|
+
keywordset: KEYWORDSET_SCHEMA,
|
|
2347
2337
|
keyword: KEYWORD_SCHEMA,
|
|
2348
2338
|
punc: PUNC_SCHEMA,
|
|
2349
2339
|
label1: LABEL_SCHEMA,
|
|
2350
2340
|
li: LI_SCHEMA,
|
|
2341
|
+
ol: OL_SCHEMA,
|
|
2342
|
+
ul: UL_SCHEMA,
|
|
2351
2343
|
token: TOKEN_SCHEMA,
|
|
2352
2344
|
tag: TAG_SCHEMA,
|
|
2353
2345
|
lrh: LRH_SCHEMA,
|
|
2354
2346
|
rrh: RRH_SCHEMA,
|
|
2355
2347
|
source1: SOURCE_SCHEMA,
|
|
2356
2348
|
subtitle1: SUBTITLE_SCHEMA,
|
|
2357
|
-
tp: TP_SCHEMA,
|
|
2358
|
-
tblfn: TBLFN_SCHEMA,
|
|
2359
|
-
tblsource: TBLSOURCE_SCHEMA,
|
|
2360
|
-
chapter: CHAPTER_SCHEMA
|
|
2361
|
-
};
|
|
2362
|
-
var GROUP_SCHEMAS = {
|
|
2363
|
-
bibliodiv: BIBLIODIV_SCHEMA,
|
|
2364
|
-
referenceBibliography: REFERENCE_BIBLIOGRAPHY_SCHEMA,
|
|
2365
|
-
footnote: FOOTNOTE_SCHEMA,
|
|
2366
|
-
org: ORG_SCHEMA,
|
|
2367
|
-
dialogue: DIALOGUE_SCHEMA,
|
|
2368
|
-
linegroup: LINE_GROUP_SCHEMA,
|
|
2369
|
-
equation: EQUATION_SCHEMA,
|
|
2370
|
-
alttext: ALTTEXT_SCHEMA,
|
|
2371
|
-
imageobject: IMAGEOBJECT_SCHEMA,
|
|
2372
|
-
mediaobject: MEDIAOBJECT_SCHEMA,
|
|
2373
|
-
caption1: CAPTION_SCHEMA,
|
|
2374
|
-
figure1: FIGURE_SCHEMA,
|
|
2375
|
-
informalfigure: INFORMALFIGURE_SCHEMA,
|
|
2376
|
-
keywordset: KEYWORDSET_SCHEMA,
|
|
2377
|
-
ol: OL_SCHEMA,
|
|
2378
|
-
ul: UL_SCHEMA,
|
|
2379
2349
|
table1: TABLE_SCHEMA,
|
|
2380
2350
|
tgroup: TGROUP_SCHEMA,
|
|
2381
2351
|
table: HTML_TABLE_SCHEMA,
|
|
@@ -2383,12 +2353,15 @@ var GROUP_SCHEMAS = {
|
|
|
2383
2353
|
tbody: TBODY_SCHEMA,
|
|
2384
2354
|
tr: TR_SCHEMA,
|
|
2385
2355
|
td: TD_SCHEMA,
|
|
2356
|
+
tp: TP_SCHEMA,
|
|
2357
|
+
tblfn: TBLFN_SCHEMA,
|
|
2358
|
+
tblsource: TBLSOURCE_SCHEMA,
|
|
2386
2359
|
heading: HEADING_SCHEMA,
|
|
2387
2360
|
footnoteSection: FOOTNOTE_SECTION_SCHEMA,
|
|
2361
|
+
chapter: CHAPTER_SCHEMA,
|
|
2388
2362
|
info1: INFO_SCHEMA,
|
|
2389
2363
|
abstract1: ABSTRACT_SCHEMA,
|
|
2390
2364
|
epigraph: EPIGRAPH_SCHEMA,
|
|
2391
|
-
example: EXAMPLE_SCHEMA,
|
|
2392
2365
|
poem: POEM_SCHEMA,
|
|
2393
2366
|
blockquote: BLOCKQUOTE_SCHEMA,
|
|
2394
2367
|
sidebar: BOX_SCHEMA,
|
|
@@ -2501,13 +2474,7 @@ var PHRASE_SCHEMA = createSchema({
|
|
|
2501
2474
|
tag: PHRASE_TAG,
|
|
2502
2475
|
requiredAttributes: [...ID_ATTRS, "xml:lang"],
|
|
2503
2476
|
optionalAttributes: [],
|
|
2504
|
-
allowedChildrenCodes: [
|
|
2505
|
-
...ATOM_CODES_ALLOWED_CHILDREN,
|
|
2506
|
-
// DocBook lets a phrase hold footnotes and links, so a language phrase
|
|
2507
|
-
// can span a sentence that carries a footnote call-out or a citation.
|
|
2508
|
-
{ code: "footnote1", required: false },
|
|
2509
|
-
{ code: "link", required: false }
|
|
2510
|
-
]
|
|
2477
|
+
allowedChildrenCodes: [...ATOM_CODES_ALLOWED_CHILDREN]
|
|
2511
2478
|
});
|
|
2512
2479
|
|
|
2513
2480
|
// src/schema/elementSchemas/inlineElements/index.ts
|
|
@@ -2850,7 +2817,7 @@ var createDocbookSchema = (name) => {
|
|
|
2850
2817
|
);
|
|
2851
2818
|
return createSchema({
|
|
2852
2819
|
code: getDocbookSchemaCode(name),
|
|
2853
|
-
kind:
|
|
2820
|
+
kind: "element",
|
|
2854
2821
|
tag: EDITOR_TAGS[name] ?? name.toUpperCase(),
|
|
2855
2822
|
requiredAttributes: [],
|
|
2856
2823
|
optionalAttributes: [
|
|
@@ -2881,7 +2848,6 @@ var BIBLIOMIXED_SCHEMA = DOCBOOK_SCHEMAS.referenceBibliomixed;
|
|
|
2881
2848
|
var SCHEMAS = {
|
|
2882
2849
|
...ATOM_SCHEMAS,
|
|
2883
2850
|
...ELEMENT_SCHEMAS,
|
|
2884
|
-
...GROUP_SCHEMAS,
|
|
2885
2851
|
...INLINE_ELEMENT_SCHEMAS,
|
|
2886
2852
|
...DOCBOOK_SCHEMAS
|
|
2887
2853
|
};
|
|
@@ -2921,7 +2887,7 @@ var findSchemaByElement = (element) => getSchemasByTag().get(element.tagName.toU
|
|
|
2921
2887
|
var isAttributeRestricted = (attr) => typeof attr !== "string";
|
|
2922
2888
|
|
|
2923
2889
|
// src/schema/helpers/isTrackChangesSchema.ts
|
|
2924
|
-
var isTrackChangesSchema = (schema) => schema.
|
|
2890
|
+
var isTrackChangesSchema = (schema) => schema.code === "insertion" || schema.code === "deletion" || schema.code === "lineGroupRemoval" || schema.code === "formatRemoval";
|
|
2925
2891
|
|
|
2926
2892
|
// src/schema/referenceSchemas/referenceTypeSchemas.ts
|
|
2927
2893
|
var LINK_FIELDS = ["doi", "url"];
|
|
@@ -3312,10 +3278,7 @@ var ElementLabel = {
|
|
|
3312
3278
|
...DOCBOOK_ELEMENT_LABELS,
|
|
3313
3279
|
mark: "Mark",
|
|
3314
3280
|
referenceBibliomixed: "Reference Bibliomixed",
|
|
3315
|
-
referenceBibliography:
|
|
3316
|
-
default: "Reference Bibliography",
|
|
3317
|
-
chapterend: "Chapter-End Reference Bibliography"
|
|
3318
|
-
},
|
|
3281
|
+
referenceBibliography: "Reference Bibliography",
|
|
3319
3282
|
bibliodiv: "Bibliodiv",
|
|
3320
3283
|
bibliomset: "Reference Block",
|
|
3321
3284
|
editor: "Editor",
|
|
@@ -3343,11 +3306,7 @@ var ElementLabel = {
|
|
|
3343
3306
|
tertiary: "Tertiary",
|
|
3344
3307
|
quaternary: "Quaternary",
|
|
3345
3308
|
bookmark: "Bookmark",
|
|
3346
|
-
see:
|
|
3347
|
-
default: "Cross Reference",
|
|
3348
|
-
see: "See",
|
|
3349
|
-
"see-also": "See Also"
|
|
3350
|
-
},
|
|
3309
|
+
see: "Cross Reference",
|
|
3351
3310
|
commentQuerySection: "Comment/Query",
|
|
3352
3311
|
comment: "Comment",
|
|
3353
3312
|
content: "Content",
|
|
@@ -3356,13 +3315,7 @@ var ElementLabel = {
|
|
|
3356
3315
|
deletion: "Deletion",
|
|
3357
3316
|
lineGroupRemoval: "Line Group Removal",
|
|
3358
3317
|
formatRemoval: "Formatting Removal",
|
|
3359
|
-
emphasis:
|
|
3360
|
-
default: "Emphasis",
|
|
3361
|
-
lowercase: "Lowercase",
|
|
3362
|
-
uppercase: "Uppercase",
|
|
3363
|
-
initialcaps: "Initial Caps",
|
|
3364
|
-
"Non breaking space": "Non-Breaking Space"
|
|
3365
|
-
},
|
|
3318
|
+
emphasis: "Emphasis",
|
|
3366
3319
|
highlightmark: "Highlightmark",
|
|
3367
3320
|
i: "Italic",
|
|
3368
3321
|
insertion: "Insertion",
|
|
@@ -3379,15 +3332,11 @@ var ElementLabel = {
|
|
|
3379
3332
|
fignote: "Fignote",
|
|
3380
3333
|
figsource: "Figsource",
|
|
3381
3334
|
firstname: "Firstname",
|
|
3382
|
-
footnote:
|
|
3383
|
-
default: "Footnote Marker",
|
|
3384
|
-
"end-ch-note": "Chapter Footnote Marker",
|
|
3385
|
-
"end-bk-note": "Book Footnote Marker"
|
|
3386
|
-
},
|
|
3335
|
+
footnote: "Footnote Marker",
|
|
3387
3336
|
footnoteno: "Footnote Number",
|
|
3388
3337
|
honorific: "Honorific",
|
|
3389
3338
|
img: "Image",
|
|
3390
|
-
informalfigure: "
|
|
3339
|
+
informalfigure: "Floating Figure",
|
|
3391
3340
|
keyword: "Keyword",
|
|
3392
3341
|
label1: "Label",
|
|
3393
3342
|
li: "List Item",
|
|
@@ -3449,24 +3398,9 @@ var ElementLabel = {
|
|
|
3449
3398
|
chapter: "Chapter",
|
|
3450
3399
|
dialogue: "Dialogue",
|
|
3451
3400
|
epigraph: "Epigraph",
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
default: "Footnote Section",
|
|
3456
|
-
ch: "Chapter Footnote Section",
|
|
3457
|
-
bk: "Book Footnote Section"
|
|
3458
|
-
},
|
|
3459
|
-
heading: {
|
|
3460
|
-
default: "Heading",
|
|
3461
|
-
H0: "Heading +1",
|
|
3462
|
-
H1: "Heading 1",
|
|
3463
|
-
H2: "Heading 2",
|
|
3464
|
-
H3: "Heading 3",
|
|
3465
|
-
H4: "Heading 4",
|
|
3466
|
-
H5: "Heading 5",
|
|
3467
|
-
H6: "Heading 6",
|
|
3468
|
-
vignette_group: "Vignette Group"
|
|
3469
|
-
},
|
|
3401
|
+
figure1: "Figure",
|
|
3402
|
+
footnoteSection: "Footnote Section",
|
|
3403
|
+
heading: "Heading",
|
|
3470
3404
|
imageobject: "Image Object",
|
|
3471
3405
|
info1: "Info",
|
|
3472
3406
|
keywordset: "Keyword FGroup",
|
|
@@ -3474,40 +3408,17 @@ var ElementLabel = {
|
|
|
3474
3408
|
ol: "Ordered List",
|
|
3475
3409
|
personname: "Person Name",
|
|
3476
3410
|
poem: "Poem",
|
|
3477
|
-
sidebar:
|
|
3478
|
-
default: "Box",
|
|
3479
|
-
box1: "Box 1",
|
|
3480
|
-
box2: "Box 2",
|
|
3481
|
-
box3: "Box 3",
|
|
3482
|
-
box4: "Box 4",
|
|
3483
|
-
box5: "Box 5"
|
|
3484
|
-
},
|
|
3411
|
+
sidebar: "Box",
|
|
3485
3412
|
table: "Table",
|
|
3486
|
-
table1:
|
|
3487
|
-
default: "Table",
|
|
3488
|
-
inline: "Inline Table",
|
|
3489
|
-
float: "Floating Table"
|
|
3490
|
-
},
|
|
3413
|
+
table1: "Table",
|
|
3491
3414
|
tbody: "Table Body",
|
|
3492
3415
|
td: "Table Data",
|
|
3493
3416
|
tgroup: "Table Group",
|
|
3494
3417
|
tr: "Table Row",
|
|
3495
3418
|
ul: "Unordered List",
|
|
3496
|
-
footnote1:
|
|
3497
|
-
default: "Footnote",
|
|
3498
|
-
"end-ch-note": "Chapter Footnote",
|
|
3499
|
-
"end-bk-note": "Book Footnote"
|
|
3500
|
-
},
|
|
3419
|
+
footnote1: "Footnote",
|
|
3501
3420
|
inlineequation: "Inline Equation",
|
|
3502
|
-
link:
|
|
3503
|
-
default: "Link",
|
|
3504
|
-
bibr: "Bibliography Link",
|
|
3505
|
-
table: "Table Link",
|
|
3506
|
-
figure: "Figure Link",
|
|
3507
|
-
equation: "Equation Link",
|
|
3508
|
-
footnote: "Footnote Link",
|
|
3509
|
-
chapter: "Chapter Link"
|
|
3510
|
-
},
|
|
3421
|
+
link: "Link",
|
|
3511
3422
|
uri: "URI",
|
|
3512
3423
|
phrase: "Phrase",
|
|
3513
3424
|
abbreviation: "Abbreviation",
|
|
@@ -3515,13 +3426,6 @@ var ElementLabel = {
|
|
|
3515
3426
|
em: "Emphasis",
|
|
3516
3427
|
strong: "Strong"
|
|
3517
3428
|
};
|
|
3518
|
-
var getElementLabel = (code, role) => {
|
|
3519
|
-
const label = ElementLabel[code];
|
|
3520
|
-
if (typeof label === "string") {
|
|
3521
|
-
return label;
|
|
3522
|
-
}
|
|
3523
|
-
return role && Object.prototype.hasOwnProperty.call(label, role) ? label[role] : label.default;
|
|
3524
|
-
};
|
|
3525
3429
|
|
|
3526
3430
|
// src/schema/shared/dependentsForbiddenElements.ts
|
|
3527
3431
|
var DEPENDENT_FORBIDDEN_ELEMENTS = [
|
|
@@ -3532,7 +3436,6 @@ var DEPENDENT_FORBIDDEN_ELEMENTS = [
|
|
|
3532
3436
|
];
|
|
3533
3437
|
|
|
3534
3438
|
// src/helpers/isIgnoredElement.ts
|
|
3535
|
-
var DUMMY_SPAN_SELECTOR = "span#dummySpan";
|
|
3536
3439
|
var IGNORED_ELEMENT_SELECTORS = [
|
|
3537
3440
|
"span.rhlabel",
|
|
3538
3441
|
"span.printlabel",
|
|
@@ -3541,7 +3444,7 @@ var IGNORED_ELEMENT_SELECTORS = [
|
|
|
3541
3444
|
"span.ref-drag",
|
|
3542
3445
|
"span.reference-type-label",
|
|
3543
3446
|
"span.reference-validation-no-match",
|
|
3544
|
-
|
|
3447
|
+
"span#dummySpan"
|
|
3545
3448
|
];
|
|
3546
3449
|
var IGNORED_ELEMENT_SELECTOR = IGNORED_ELEMENT_SELECTORS.join(", ");
|
|
3547
3450
|
var isIgnoredElement = (element) => element.tagName.toUpperCase() === "SPAN" && element.matches(IGNORED_ELEMENT_SELECTOR);
|
|
@@ -3869,14 +3772,8 @@ var validateRequiredChildren = (element, schema, childElements) => {
|
|
|
3869
3772
|
);
|
|
3870
3773
|
if (!hasChild) {
|
|
3871
3774
|
const requiredChild = findSchemaByCode(allowedChild.code);
|
|
3872
|
-
const elementLabel =
|
|
3873
|
-
|
|
3874
|
-
element.getAttribute("role")
|
|
3875
|
-
);
|
|
3876
|
-
const parentLabel = getElementLabel(
|
|
3877
|
-
schema.code,
|
|
3878
|
-
element.getAttribute("role")
|
|
3879
|
-
);
|
|
3775
|
+
const elementLabel = ElementLabel[requiredChild.code];
|
|
3776
|
+
const parentLabel = ElementLabel[schema.code];
|
|
3880
3777
|
const extraInstruction = getExtraInstruction(schema, requiredChild);
|
|
3881
3778
|
const description = [
|
|
3882
3779
|
`Please provide at least one ${elementLabel} in this ${parentLabel}.`,
|
|
@@ -3916,16 +3813,15 @@ var validateChildren = (element, schema) => {
|
|
|
3916
3813
|
const childElements = getEffectiveChildElements(element, {
|
|
3917
3814
|
includeDeleted: false
|
|
3918
3815
|
});
|
|
3919
|
-
if (schema.kind === "atom"
|
|
3816
|
+
if (schema.kind === "atom") {
|
|
3920
3817
|
return errors;
|
|
3921
3818
|
}
|
|
3922
3819
|
if (schema.allowsText === false && hasVisibleText(element)) {
|
|
3923
|
-
const label = getElementLabel(schema.code, element.getAttribute("role"));
|
|
3924
3820
|
addValidationIssue(errors, element, {
|
|
3925
|
-
title: `Text not allowed in ${
|
|
3821
|
+
title: `Text not allowed in ${ElementLabel[schema.code]}`,
|
|
3926
3822
|
level: "warning",
|
|
3927
3823
|
kind: "forbidden",
|
|
3928
|
-
description: `A ${
|
|
3824
|
+
description: `A ${ElementLabel[schema.code]} holds only elements. Please tag or remove the text inside it.`,
|
|
3929
3825
|
elements: [element]
|
|
3930
3826
|
});
|
|
3931
3827
|
}
|
|
@@ -4432,10 +4328,7 @@ var isInWrongBibliomset = (field) => {
|
|
|
4432
4328
|
const relation = field.closest(BIBLIOMSET)?.getAttribute("relation");
|
|
4433
4329
|
return relation !== void 0 && !FIELD_BIBLIOMSETS[field.localName]?.some((owner) => owner === relation);
|
|
4434
4330
|
};
|
|
4435
|
-
var isEditorWrapper = (element) =>
|
|
4436
|
-
const kind = findSchemaByElement(element)?.kind;
|
|
4437
|
-
return element.tagName.toUpperCase() === "SPAN" || kind === "atom" || kind === "trackChanges";
|
|
4438
|
-
};
|
|
4331
|
+
var isEditorWrapper = (element) => element.tagName.toUpperCase() === "SPAN" || findSchemaByElement(element)?.kind === "atom";
|
|
4439
4332
|
var getLiveChildren = (element) => Array.from(element.children).flatMap((child) => {
|
|
4440
4333
|
if (!isLiveReferenceContent(child)) return [];
|
|
4441
4334
|
return child.matches(INSERTION) || child.tagName.toUpperCase() === "SPAN" && !findSchemaByElement(child) ? getLiveChildren(child) : [child];
|
|
@@ -4572,6 +4465,182 @@ var validateReferenceMarkup = (reference, typeSchema) => {
|
|
|
4572
4465
|
);
|
|
4573
4466
|
};
|
|
4574
4467
|
|
|
4468
|
+
// src/validation/referenceBlockCopy.ts
|
|
4469
|
+
var BLOCK = "bibliomset";
|
|
4470
|
+
var BLOCK_TITLE_FIELDS = ["title", "containerTitle"];
|
|
4471
|
+
var BLOCK_NAMES = {
|
|
4472
|
+
part: "chapter",
|
|
4473
|
+
book: "book",
|
|
4474
|
+
article: "article",
|
|
4475
|
+
journal: "journal"
|
|
4476
|
+
};
|
|
4477
|
+
var capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
4478
|
+
var joinWords = (words, conjunction = "and") => words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} ${conjunction} ${words[words.length - 1]}`;
|
|
4479
|
+
var isBlockRelation = (value) => !!value && Object.prototype.hasOwnProperty.call(BLOCK_NAMES, value);
|
|
4480
|
+
var getRelation = (element) => {
|
|
4481
|
+
const relation = element?.getAttribute("relation");
|
|
4482
|
+
return isBlockRelation(relation) ? relation : void 0;
|
|
4483
|
+
};
|
|
4484
|
+
var getRelations = (blocks) => [
|
|
4485
|
+
...new Set(
|
|
4486
|
+
blocks.map(getRelation).filter((relation) => !!relation)
|
|
4487
|
+
)
|
|
4488
|
+
];
|
|
4489
|
+
var nameBlocks = (relations) => relations.length > 0 ? `${joinWords(relations.map((relation) => BLOCK_NAMES[relation]))} details` : "details";
|
|
4490
|
+
var getTitleLabel = ({ relation, typeSchema }) => {
|
|
4491
|
+
const index = typeSchema.bibliomsetRelations?.indexOf(relation) ?? -1;
|
|
4492
|
+
const field = BLOCK_TITLE_FIELDS[index];
|
|
4493
|
+
if (!field) return `${capitalize(BLOCK_NAMES[relation])} title`;
|
|
4494
|
+
return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
|
|
4495
|
+
};
|
|
4496
|
+
var isWorkBlock = ({ relation, typeSchema }) => typeSchema.bibliomsetRelations?.indexOf(relation) === 0;
|
|
4497
|
+
var getUntitledBlockCopy = ({
|
|
4498
|
+
elements,
|
|
4499
|
+
typeSchema
|
|
4500
|
+
}) => {
|
|
4501
|
+
const relations = getRelations(elements);
|
|
4502
|
+
const [relation] = relations;
|
|
4503
|
+
const allKnown = elements.every((element) => getRelation(element));
|
|
4504
|
+
if (relations.length !== 1 || !relation || !allKnown) {
|
|
4505
|
+
return {
|
|
4506
|
+
title: "Titles missing from the details",
|
|
4507
|
+
description: `The ${allKnown ? nameBlocks(relations) : "details"} have no titles. Tag each title inside its details.`
|
|
4508
|
+
};
|
|
4509
|
+
}
|
|
4510
|
+
const name = BLOCK_NAMES[relation];
|
|
4511
|
+
const title = getTitleLabel({ relation, typeSchema }).toLowerCase();
|
|
4512
|
+
return {
|
|
4513
|
+
title: `${capitalize(title)} missing from the ${name} details`,
|
|
4514
|
+
description: `The ${name} details have no ${title}. Tag the ${title} inside them.`
|
|
4515
|
+
};
|
|
4516
|
+
};
|
|
4517
|
+
var getMissingBlockCopy = ({
|
|
4518
|
+
elements,
|
|
4519
|
+
typeSchema
|
|
4520
|
+
}) => {
|
|
4521
|
+
const relations = typeSchema.bibliomsetRelations ?? [];
|
|
4522
|
+
const present = new Set(
|
|
4523
|
+
getRelations(
|
|
4524
|
+
elements.flatMap(
|
|
4525
|
+
(reference) => Array.from(reference.querySelectorAll(BLOCK)).filter(
|
|
4526
|
+
isLiveReferenceContent
|
|
4527
|
+
)
|
|
4528
|
+
)
|
|
4529
|
+
)
|
|
4530
|
+
);
|
|
4531
|
+
const missing = relations.filter((relation) => !present.has(relation));
|
|
4532
|
+
const shown = missing.length > 0 ? missing : relations;
|
|
4533
|
+
const groups = shown.map((relation) => {
|
|
4534
|
+
const name = BLOCK_NAMES[relation];
|
|
4535
|
+
const contents = isWorkBlock({ relation, typeSchema }) ? `the ${name}'s title and authors` : `the ${name}'s title`;
|
|
4536
|
+
return `${contents} in the ${name} details`;
|
|
4537
|
+
});
|
|
4538
|
+
const titles = shown.map(
|
|
4539
|
+
(relation) => `the ${getTitleLabel({ relation, typeSchema }).toLowerCase()}`
|
|
4540
|
+
);
|
|
4541
|
+
return {
|
|
4542
|
+
title: `${capitalize(nameBlocks(shown))} missing`,
|
|
4543
|
+
description: `${typeSchema.label} references group ${groups.join(", and ")}. Tag ${joinWords(titles)} to create them.`
|
|
4544
|
+
};
|
|
4545
|
+
};
|
|
4546
|
+
var getRepeatedBlockCopy = ({
|
|
4547
|
+
elements
|
|
4548
|
+
}) => {
|
|
4549
|
+
const relations = getRelations(elements);
|
|
4550
|
+
const blocks = nameBlocks(relations);
|
|
4551
|
+
const repeatsPerRelation = elements.map(getRelation);
|
|
4552
|
+
const eachAppearsTwice = relations.every(
|
|
4553
|
+
(relation) => repeatsPerRelation.filter((repeat) => repeat === relation).length === 1
|
|
4554
|
+
);
|
|
4555
|
+
return {
|
|
4556
|
+
title: `${capitalize(blocks)} repeated`,
|
|
4557
|
+
description: eachAppearsTwice && repeatsPerRelation.every(Boolean) ? `The ${blocks} appear twice. Move what is in the second into the first.` : `The ${blocks} appear more than once. Move what is in each repeat into the first.`
|
|
4558
|
+
};
|
|
4559
|
+
};
|
|
4560
|
+
var getNestedBlockCopy = ({
|
|
4561
|
+
elements
|
|
4562
|
+
}) => {
|
|
4563
|
+
const pairs = [
|
|
4564
|
+
...new Set(
|
|
4565
|
+
elements.map(
|
|
4566
|
+
(block) => `${getRelation(block)}|${getRelation(block.parentElement?.closest(BLOCK))}`
|
|
4567
|
+
)
|
|
4568
|
+
)
|
|
4569
|
+
];
|
|
4570
|
+
const [inner, outer] = pairs.length === 1 ? pairs[0].split("|") : [];
|
|
4571
|
+
if (!isBlockRelation(inner) || !isBlockRelation(outer)) {
|
|
4572
|
+
return {
|
|
4573
|
+
title: "Details inside other details",
|
|
4574
|
+
description: "Move each one out so they sit side by side."
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4577
|
+
return {
|
|
4578
|
+
title: `${capitalize(BLOCK_NAMES[inner])} details inside the ${BLOCK_NAMES[outer]} details`,
|
|
4579
|
+
description: `Move the ${BLOCK_NAMES[inner]} details out so the two sit side by side.`
|
|
4580
|
+
};
|
|
4581
|
+
};
|
|
4582
|
+
var getUnusedBlockCopy = ({
|
|
4583
|
+
elements,
|
|
4584
|
+
typeSchema
|
|
4585
|
+
}) => {
|
|
4586
|
+
const relations = typeSchema.bibliomsetRelations ?? [];
|
|
4587
|
+
const title = `${capitalize(nameBlocks(getRelations(elements)))} not used by ${typeSchema.label.toLowerCase()} references`;
|
|
4588
|
+
if (relations.length === 0) {
|
|
4589
|
+
return { title, description: "Remove the grouping and keep its contents." };
|
|
4590
|
+
}
|
|
4591
|
+
const used = relations.map(
|
|
4592
|
+
(relation) => `the ${BLOCK_NAMES[relation]} details`
|
|
4593
|
+
);
|
|
4594
|
+
return {
|
|
4595
|
+
title,
|
|
4596
|
+
description: `${typeSchema.label} references use ${joinWords(used)}. Change the grouping to one of them.`
|
|
4597
|
+
};
|
|
4598
|
+
};
|
|
4599
|
+
var getMisplacedFieldCopy = ({
|
|
4600
|
+
elements,
|
|
4601
|
+
typeSchema
|
|
4602
|
+
}) => {
|
|
4603
|
+
const typeRelations = typeSchema.bibliomsetRelations ?? [];
|
|
4604
|
+
const moves = [
|
|
4605
|
+
...new Map(
|
|
4606
|
+
elements.flatMap((element) => {
|
|
4607
|
+
const field = findReferenceFieldByElement(element);
|
|
4608
|
+
const relation = getRelation(element.closest(BLOCK));
|
|
4609
|
+
const allowed = FIELD_BIBLIOMSETS[element.localName] ?? [];
|
|
4610
|
+
const usedByType = allowed.filter(
|
|
4611
|
+
(home) => typeRelations.includes(home)
|
|
4612
|
+
);
|
|
4613
|
+
const homes = usedByType.length > 0 ? usedByType : allowed;
|
|
4614
|
+
if (!field) return [];
|
|
4615
|
+
const label = REFERENCE_FIELD_SCHEMAS[field].label;
|
|
4616
|
+
const source = relation ? `the ${BLOCK_NAMES[relation]}` : "the wrong";
|
|
4617
|
+
return [
|
|
4618
|
+
[
|
|
4619
|
+
`${field}|${relation}`,
|
|
4620
|
+
{
|
|
4621
|
+
title: `${label} in ${source} details`,
|
|
4622
|
+
description: `Move the ${label.toLowerCase()} to the ${joinWords(
|
|
4623
|
+
homes.map((home) => BLOCK_NAMES[home]),
|
|
4624
|
+
"or"
|
|
4625
|
+
)} details.`
|
|
4626
|
+
}
|
|
4627
|
+
]
|
|
4628
|
+
];
|
|
4629
|
+
})
|
|
4630
|
+
).values()
|
|
4631
|
+
];
|
|
4632
|
+
const [move] = moves;
|
|
4633
|
+
if (moves.length === 1 && move) return move;
|
|
4634
|
+
return {
|
|
4635
|
+
title: "Fields in the wrong details",
|
|
4636
|
+
description: moves.map(({ description }) => description).join(" ") || "Move each field to the details it belongs in."
|
|
4637
|
+
};
|
|
4638
|
+
};
|
|
4639
|
+
var PART_EDITOR_COPY = {
|
|
4640
|
+
title: "Editor tagged in the chapter details",
|
|
4641
|
+
description: "The chapter details hold the chapter and its authors. Tag the name as an author, or move the editor to the book details."
|
|
4642
|
+
};
|
|
4643
|
+
|
|
4575
4644
|
// src/validation/validateReferenceStructure.ts
|
|
4576
4645
|
var getLiveReferenceFieldElements = (reference) => getReferenceFieldElements(reference).filter(
|
|
4577
4646
|
({ element }) => isLiveReferenceContent(element)
|
|
@@ -4649,11 +4718,7 @@ var getFieldLabel = (field, typeSchema) => {
|
|
|
4649
4718
|
}
|
|
4650
4719
|
return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
|
|
4651
4720
|
};
|
|
4652
|
-
var
|
|
4653
|
-
const relations = typeSchema.bibliomsetRelations ?? [];
|
|
4654
|
-
return relations.length > 0 ? `${typeSchema.label} references use bibliomset with the relation ${relations.join(" and ")}. Please correct the relation.` : `${typeSchema.label} references do not use bibliomset. Please remove it and keep its contents.`;
|
|
4655
|
-
};
|
|
4656
|
-
var getMarkupCopy = (rule, typeSchema) => {
|
|
4721
|
+
var getMarkupCopy = (rule, blockCopyParams) => {
|
|
4657
4722
|
switch (rule) {
|
|
4658
4723
|
case "missing_id":
|
|
4659
4724
|
return {
|
|
@@ -4662,41 +4727,17 @@ var getMarkupCopy = (rule, typeSchema) => {
|
|
|
4662
4727
|
description: "Every reference needs an xml:id. Please add one."
|
|
4663
4728
|
};
|
|
4664
4729
|
case "bibliomset_relation":
|
|
4665
|
-
return {
|
|
4666
|
-
title: "Wrong bibliomset for this reference type",
|
|
4667
|
-
kind: "forbidden",
|
|
4668
|
-
description: getBibliomsetRelationCopy(typeSchema)
|
|
4669
|
-
};
|
|
4730
|
+
return { kind: "forbidden", ...getUnusedBlockCopy(blockCopyParams) };
|
|
4670
4731
|
case "bibliomset_missing":
|
|
4671
|
-
return {
|
|
4672
|
-
title: "Bibliomset missing",
|
|
4673
|
-
kind: "missing",
|
|
4674
|
-
description: `${typeSchema.label} references need one bibliomset with the relation ${(typeSchema.bibliomsetRelations ?? []).join(" and one with ")}. Please wrap the details in them.`
|
|
4675
|
-
};
|
|
4732
|
+
return { kind: "missing", ...getMissingBlockCopy(blockCopyParams) };
|
|
4676
4733
|
case "bibliomset_repeated":
|
|
4677
|
-
return {
|
|
4678
|
-
title: "Bibliomset repeated",
|
|
4679
|
-
kind: "forbidden",
|
|
4680
|
-
description: "A reference holds one bibliomset of each relation. Please move the details of the repeated bibliomset into the first one."
|
|
4681
|
-
};
|
|
4734
|
+
return { kind: "forbidden", ...getRepeatedBlockCopy(blockCopyParams) };
|
|
4682
4735
|
case "bibliomset_title":
|
|
4683
|
-
return {
|
|
4684
|
-
title: "Bibliomset without a title",
|
|
4685
|
-
kind: "missing",
|
|
4686
|
-
description: "Every bibliomset must contain a title. Please move its title into it or remove the bibliomset."
|
|
4687
|
-
};
|
|
4736
|
+
return { kind: "missing", ...getUntitledBlockCopy(blockCopyParams) };
|
|
4688
4737
|
case "bibliomset_nested":
|
|
4689
|
-
return {
|
|
4690
|
-
title: "Bibliomset inside another bibliomset",
|
|
4691
|
-
kind: "forbidden",
|
|
4692
|
-
description: "A bibliomset cannot sit inside another bibliomset. Please move it out so the two sit side by side."
|
|
4693
|
-
};
|
|
4738
|
+
return { kind: "forbidden", ...getNestedBlockCopy(blockCopyParams) };
|
|
4694
4739
|
case "part_editor":
|
|
4695
|
-
return {
|
|
4696
|
-
title: "Editor tagged in the chapter part",
|
|
4697
|
-
kind: "forbidden",
|
|
4698
|
-
description: "The part bibliomset holds the chapter and its author. Please tag the name as an author or move the editor to the book bibliomset."
|
|
4699
|
-
};
|
|
4740
|
+
return { kind: "forbidden", ...PART_EDITOR_COPY };
|
|
4700
4741
|
case "personname_role":
|
|
4701
4742
|
return {
|
|
4702
4743
|
title: "Name order not set",
|
|
@@ -4716,11 +4757,7 @@ var getMarkupCopy = (rule, typeSchema) => {
|
|
|
4716
4757
|
description: "An author, editor or credit holds one personname or orgname. Please tag each name as its own creator."
|
|
4717
4758
|
};
|
|
4718
4759
|
case "bibliomset_field":
|
|
4719
|
-
return {
|
|
4720
|
-
title: "Field in the wrong bibliomset",
|
|
4721
|
-
kind: "forbidden",
|
|
4722
|
-
description: "Volume and issue belong in the journal bibliomset, and pages in the book or journal bibliomset or after the bibliomsets. Please move the field."
|
|
4723
|
-
};
|
|
4760
|
+
return { kind: "forbidden", ...getMisplacedFieldCopy(blockCopyParams) };
|
|
4724
4761
|
case "bibliomisc_role":
|
|
4725
4762
|
return {
|
|
4726
4763
|
title: "Description type not set",
|
|
@@ -4784,7 +4821,9 @@ var getIssueCopy = (issue, typeSchema) => {
|
|
|
4784
4821
|
};
|
|
4785
4822
|
}
|
|
4786
4823
|
const typeLabel = typeSchema.label.toLowerCase();
|
|
4787
|
-
if (issue.code === "markup")
|
|
4824
|
+
if (issue.code === "markup") {
|
|
4825
|
+
return getMarkupCopy(issue.rule, { elements: issue.elements, typeSchema });
|
|
4826
|
+
}
|
|
4788
4827
|
if (issue.code === "wrong_element") {
|
|
4789
4828
|
return {
|
|
4790
4829
|
title: `${issue.tag} not allowed`,
|
|
@@ -4827,28 +4866,6 @@ var validateReference = (reference) => {
|
|
|
4827
4866
|
);
|
|
4828
4867
|
};
|
|
4829
4868
|
|
|
4830
|
-
// src/validation/validateDummySpan.ts
|
|
4831
|
-
var validateDummySpan = (root) => {
|
|
4832
|
-
const placeholders = [];
|
|
4833
|
-
for (const dummySpan of root.querySelectorAll(DUMMY_SPAN_SELECTOR)) {
|
|
4834
|
-
const parentElement = dummySpan.parentElement;
|
|
4835
|
-
if (parentElement) {
|
|
4836
|
-
placeholders.push(parentElement);
|
|
4837
|
-
continue;
|
|
4838
|
-
}
|
|
4839
|
-
placeholders.push(root);
|
|
4840
|
-
}
|
|
4841
|
-
return placeholders.map(
|
|
4842
|
-
(holder) => createValidationIssue(holder, {
|
|
4843
|
-
title: "Placeholder element found",
|
|
4844
|
-
kind: "placeholder",
|
|
4845
|
-
description: "This element contains an empty placeholder. Type text into the placeholder or delete it.",
|
|
4846
|
-
level: "blocker",
|
|
4847
|
-
elements: [holder]
|
|
4848
|
-
})
|
|
4849
|
-
);
|
|
4850
|
-
};
|
|
4851
|
-
|
|
4852
4869
|
// src/validation/validateXml.ts
|
|
4853
4870
|
var ELEMENTS_PER_STEP = 64;
|
|
4854
4871
|
var DEFAULT_TIME_BUDGET_MS = 8;
|
|
@@ -4906,7 +4923,6 @@ function* validateXmlSteps(xml, elementsToLink, linkElements, schemasToValidateA
|
|
|
4906
4923
|
const errors = [];
|
|
4907
4924
|
errors.push(...validateConsecutiveFootnotes(xml));
|
|
4908
4925
|
errors.push(...validateConsecutiveFootnoteCues(xml));
|
|
4909
|
-
errors.push(...validateDummySpan(xml));
|
|
4910
4926
|
yield;
|
|
4911
4927
|
errors.push(...yield* validatePossibleWeblinksSteps(xml));
|
|
4912
4928
|
yield* validateElements(xml, {
|
|
@@ -5039,11 +5055,10 @@ export {
|
|
|
5039
5055
|
DOCBOOK_ELEMENT_LABELS,
|
|
5040
5056
|
DOCBOOK_ELEMENT_NAMES,
|
|
5041
5057
|
DOCBOOK_SCHEMAS,
|
|
5042
|
-
DUMMY_SPAN_SELECTOR,
|
|
5043
5058
|
ELEMENT_SCHEMAS,
|
|
5044
5059
|
ELE_ID_ATTRIBUTE,
|
|
5060
|
+
ElementLabel,
|
|
5045
5061
|
FIGURE_PLACEMENT_ATTRIBUTE,
|
|
5046
|
-
GROUP_SCHEMAS,
|
|
5047
5062
|
ID_ATTRS,
|
|
5048
5063
|
IGNORED_ATTRIBUTES,
|
|
5049
5064
|
IGNORED_ATTRIBUTES_STARTS_WITH,
|
|
@@ -5092,7 +5107,6 @@ export {
|
|
|
5092
5107
|
getAttributeName,
|
|
5093
5108
|
getDocbookSchemaCode,
|
|
5094
5109
|
getEffectiveChildElements,
|
|
5095
|
-
getElementLabel,
|
|
5096
5110
|
getElementLinks,
|
|
5097
5111
|
getPossibleWeblinks,
|
|
5098
5112
|
getReferenceFieldElements,
|
|
@@ -5110,7 +5124,6 @@ export {
|
|
|
5110
5124
|
validateAttributes,
|
|
5111
5125
|
validateConsecutiveFootnoteCues,
|
|
5112
5126
|
validateConsecutiveFootnotes,
|
|
5113
|
-
validateDummySpan,
|
|
5114
5127
|
validateElementAgainstSchema,
|
|
5115
5128
|
validateElementToLinkTo,
|
|
5116
5129
|
validateFootnoteNumber,
|