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/dist/index.js CHANGED
@@ -38,11 +38,10 @@ __export(index_exports, {
38
38
  DOCBOOK_ELEMENT_LABELS: () => DOCBOOK_ELEMENT_LABELS,
39
39
  DOCBOOK_ELEMENT_NAMES: () => DOCBOOK_ELEMENT_NAMES,
40
40
  DOCBOOK_SCHEMAS: () => DOCBOOK_SCHEMAS,
41
- DUMMY_SPAN_SELECTOR: () => DUMMY_SPAN_SELECTOR,
42
41
  ELEMENT_SCHEMAS: () => ELEMENT_SCHEMAS,
43
42
  ELE_ID_ATTRIBUTE: () => ELE_ID_ATTRIBUTE,
43
+ ElementLabel: () => ElementLabel,
44
44
  FIGURE_PLACEMENT_ATTRIBUTE: () => FIGURE_PLACEMENT_ATTRIBUTE,
45
- GROUP_SCHEMAS: () => GROUP_SCHEMAS,
46
45
  ID_ATTRS: () => ID_ATTRS,
47
46
  IGNORED_ATTRIBUTES: () => IGNORED_ATTRIBUTES,
48
47
  IGNORED_ATTRIBUTES_STARTS_WITH: () => IGNORED_ATTRIBUTES_STARTS_WITH,
@@ -91,7 +90,6 @@ __export(index_exports, {
91
90
  getAttributeName: () => getAttributeName,
92
91
  getDocbookSchemaCode: () => getDocbookSchemaCode,
93
92
  getEffectiveChildElements: () => getEffectiveChildElements,
94
- getElementLabel: () => getElementLabel,
95
93
  getElementLinks: () => getElementLinks,
96
94
  getPossibleWeblinks: () => getPossibleWeblinks,
97
95
  getReferenceFieldElements: () => getReferenceFieldElements,
@@ -109,7 +107,6 @@ __export(index_exports, {
109
107
  validateAttributes: () => validateAttributes,
110
108
  validateConsecutiveFootnoteCues: () => validateConsecutiveFootnoteCues,
111
109
  validateConsecutiveFootnotes: () => validateConsecutiveFootnotes,
112
- validateDummySpan: () => validateDummySpan,
113
110
  validateElementAgainstSchema: () => validateElementAgainstSchema,
114
111
  validateElementToLinkTo: () => validateElementToLinkTo,
115
112
  validateFootnoteNumber: () => validateFootnoteNumber,
@@ -255,7 +252,7 @@ var INLINE_ELEMENT_CODES_ALLOWED_CHILDREN = [
255
252
  // src/schema/elementSchemas/atoms/deletion.ts
256
253
  var DELETION_SCHEMA = createSchema({
257
254
  code: "deletion",
258
- kind: "trackChanges",
255
+ kind: "atom",
259
256
  tag: SPAN_TAG,
260
257
  matchesElement: (element) => element.classList.contains("del"),
261
258
  requiredAttributes: [...TRACK_CHANGES_ATTRS, ...ID_ATTRS],
@@ -287,7 +284,7 @@ var EMPHASIS_SCHEMA = createSchema({
287
284
  var PREV_FORMAT_ATTRIBUTE = "prev-format";
288
285
  var FORMAT_REMOVAL_SCHEMA = createSchema({
289
286
  code: "formatRemoval",
290
- kind: "trackChanges",
287
+ kind: "atom",
291
288
  tag: SPAN_TAG,
292
289
  matchesElement: (element) => element.hasAttribute(PREV_FORMAT_ATTRIBUTE),
293
290
  requiredAttributes: [PREV_FORMAT_ATTRIBUTE],
@@ -321,7 +318,7 @@ var I_SCHEMA = createSchema({
321
318
  // src/schema/elementSchemas/atoms/insertion.ts
322
319
  var INSERTION_SCHEMA = createSchema({
323
320
  code: "insertion",
324
- kind: "trackChanges",
321
+ kind: "atom",
325
322
  tag: SPAN_TAG,
326
323
  matchesElement: (element) => element.classList.contains("ins"),
327
324
  requiredAttributes: [...TRACK_CHANGES_ATTRS, ...ID_ATTRS],
@@ -341,7 +338,7 @@ var INSERTION_SCHEMA = createSchema({
341
338
  // src/schema/elementSchemas/atoms/lineGroupRemoval.ts
342
339
  var LINE_GROUP_REMOVAL_SCHEMA = createSchema({
343
340
  code: "lineGroupRemoval",
344
- kind: "trackChanges",
341
+ kind: "atom",
345
342
  tag: SPAN_TAG,
346
343
  matchesElement: (element) => element.getAttribute("data-line-group-action") === "removed" && element.getAttribute("data-track-change-wrapper") === "unwrap",
347
344
  requiredAttributes: [
@@ -820,7 +817,6 @@ var BLOCKQUOTE_TAG = "BLOCKQUOTE";
820
817
  var SIDEBAR_TAG = "SIDEBAR";
821
818
  var CHAPTER_TAG = "CHAPTER";
822
819
  var EPIGRAPH_TAG = "EPIGRAPH";
823
- var EXAMPLE_TAG = "EXAMPLE";
824
820
  var INFO_TAG = "INFO1";
825
821
  var POEM_TAG = "POEM";
826
822
  var REFERENCE_BIBLIOGRAPHY_TAG = "BIBLIOGRAPHY";
@@ -871,7 +867,7 @@ var MUNDEROVER_TAG = "MUNDEROVER";
871
867
  // src/schema/elementSchemas/elements/authors/authorgroup.ts
872
868
  var AUTHORGROUP_SCHEMA = createSchema({
873
869
  code: "authorgroup",
874
- kind: "group",
870
+ kind: "element",
875
871
  tag: AUTHORGROUP_TAG,
876
872
  requiredAttributes: [...ID_ATTRS],
877
873
  optionalAttributes: [],
@@ -884,7 +880,7 @@ var AUTHORGROUP_SCHEMA = createSchema({
884
880
  // src/schema/elementSchemas/elements/authors/author.ts
885
881
  var AUTHOR_SCHEMA = createSchema({
886
882
  code: "author",
887
- kind: "group",
883
+ kind: "element",
888
884
  tag: AUTHOR_TAG,
889
885
  requiredAttributes: [...ID_ATTRS],
890
886
  optionalAttributes: [],
@@ -911,7 +907,7 @@ var OLINK_SCHEMA = createSchema({
911
907
  // src/schema/elementSchemas/elements/authors/personname.ts
912
908
  var PERSONNAME_SCHEMA = createSchema({
913
909
  code: "personname",
914
- kind: "group",
910
+ kind: "element",
915
911
  tag: PERSONNAME_TAG,
916
912
  requiredAttributes: [...ID_ATTRS],
917
913
  optionalAttributes: [],
@@ -975,7 +971,7 @@ var EMAIL_SCHEMA = createSchema({
975
971
  // src/schema/elementSchemas/elements/authors/org.ts
976
972
  var ORG_SCHEMA = createSchema({
977
973
  code: "org",
978
- kind: "group",
974
+ kind: "element",
979
975
  tag: ORG_TAG,
980
976
  requiredAttributes: [...ID_ATTRS],
981
977
  optionalAttributes: [],
@@ -985,7 +981,7 @@ var ORG_SCHEMA = createSchema({
985
981
  // src/schema/elementSchemas/elements/authors/affiliation.ts
986
982
  var AFFILIATION_SCHEMA = createSchema({
987
983
  code: "affiliation",
988
- kind: "group",
984
+ kind: "element",
989
985
  tag: AFFILIATION_TAG,
990
986
  requiredAttributes: [...ID_ATTRS],
991
987
  optionalAttributes: [],
@@ -1028,7 +1024,7 @@ var SPEAKER_SCHEMA = createSchema({
1028
1024
  // src/schema/elementSchemas/elements/dialogue/dialogue.ts
1029
1025
  var DIALOGUE_SCHEMA = createSchema({
1030
1026
  code: "dialogue",
1031
- kind: "group",
1027
+ kind: "element",
1032
1028
  tag: DIALOGUE_TAG,
1033
1029
  requiredAttributes: [...ID_ATTRS],
1034
1030
  optionalAttributes: [...TRACK_CHANGES_ATTRS, "role", "trackmsg"],
@@ -1042,7 +1038,7 @@ var DIALOGUE_SCHEMA = createSchema({
1042
1038
  // src/schema/elementSchemas/elements/equation/equation.ts
1043
1039
  var EQUATION_SCHEMA = createSchema({
1044
1040
  code: "equation",
1045
- kind: "group",
1041
+ kind: "element",
1046
1042
  tag: EQUATION_TAG,
1047
1043
  requiredAttributes: [...ID_ATTRS],
1048
1044
  optionalAttributes: [
@@ -1413,7 +1409,7 @@ var IMG_SCHEMA = createSchema({
1413
1409
  // src/schema/elementSchemas/elements/figure/alttext.ts
1414
1410
  var ALTTEXT_SCHEMA = createSchema({
1415
1411
  code: "alttext",
1416
- kind: "group",
1412
+ kind: "element",
1417
1413
  tag: ALTTEXT_TAG,
1418
1414
  requiredAttributes: [],
1419
1415
  optionalAttributes: [],
@@ -1423,7 +1419,7 @@ var ALTTEXT_SCHEMA = createSchema({
1423
1419
  // src/schema/elementSchemas/elements/figure/imageobject.ts
1424
1420
  var IMAGEOBJECT_SCHEMA = createSchema({
1425
1421
  code: "imageobject",
1426
- kind: "group",
1422
+ kind: "element",
1427
1423
  tag: IMAGEOBJECT_TAG,
1428
1424
  requiredAttributes: [...ID_ATTRS],
1429
1425
  optionalAttributes: [],
@@ -1436,7 +1432,7 @@ var IMAGEOBJECT_SCHEMA = createSchema({
1436
1432
  // src/schema/elementSchemas/elements/figure/mediaobject.ts
1437
1433
  var MEDIAOBJECT_SCHEMA = createSchema({
1438
1434
  code: "mediaobject",
1439
- kind: "group",
1435
+ kind: "element",
1440
1436
  tag: MEDIAOBJECT_TAG,
1441
1437
  requiredAttributes: [...ID_ATTRS],
1442
1438
  optionalAttributes: [...TRACK_CHANGES_ATTRS],
@@ -1446,7 +1442,7 @@ var MEDIAOBJECT_SCHEMA = createSchema({
1446
1442
  // src/schema/elementSchemas/elements/figure/caption1.ts
1447
1443
  var CAPTION_SCHEMA = createSchema({
1448
1444
  code: "caption1",
1449
- kind: "group",
1445
+ kind: "element",
1450
1446
  tag: CAPTION_TAG,
1451
1447
  requiredAttributes: [...ID_ATTRS],
1452
1448
  optionalAttributes: [],
@@ -1482,7 +1478,7 @@ var FIGNOTE_SCHEMA = createSchema({
1482
1478
  // src/schema/elementSchemas/elements/figure/figure.ts
1483
1479
  var FIGURE_SCHEMA = createSchema({
1484
1480
  code: "figure1",
1485
- kind: "group",
1481
+ kind: "element",
1486
1482
  tag: FIGURE_TAG,
1487
1483
  requiredAttributes: [...ID_ATTRS, "xmlid"],
1488
1484
  optionalAttributes: [
@@ -1504,7 +1500,7 @@ var FIGURE_SCHEMA = createSchema({
1504
1500
  // src/schema/elementSchemas/elements/footnote.ts
1505
1501
  var FOOTNOTE_SCHEMA = createSchema({
1506
1502
  code: "footnote",
1507
- kind: "group",
1503
+ kind: "element",
1508
1504
  tag: FOOTNOTE_TAG,
1509
1505
  requiredAttributes: [
1510
1506
  ...ID_ATTRS,
@@ -1537,7 +1533,7 @@ var FOOTNOTE_NUMBER_SCHEMA = createSchema({
1537
1533
  // src/schema/elementSchemas/elements/informalfigure.ts
1538
1534
  var INFORMALFIGURE_SCHEMA = createSchema({
1539
1535
  code: "informalfigure",
1540
- kind: "group",
1536
+ kind: "element",
1541
1537
  tag: INFORMALFIGURE_TAG,
1542
1538
  requiredAttributes: [...ID_ATTRS],
1543
1539
  optionalAttributes: [...TRACK_CHANGES_ATTRS, "data-anchor-id"],
@@ -1550,7 +1546,7 @@ var INFORMALFIGURE_SCHEMA = createSchema({
1550
1546
  // src/schema/elementSchemas/elements/keywords/keywordset.ts
1551
1547
  var KEYWORDSET_SCHEMA = createSchema({
1552
1548
  code: "keywordset",
1553
- kind: "group",
1549
+ kind: "element",
1554
1550
  tag: KEYWORDSET_TAG,
1555
1551
  requiredAttributes: [
1556
1552
  ...ID_ATTRS,
@@ -1614,7 +1610,7 @@ var LABEL_SCHEMA = createSchema({
1614
1610
  // src/schema/elementSchemas/elements/lineGroup.ts
1615
1611
  var LINE_GROUP_SCHEMA = createSchema({
1616
1612
  code: "linegroup",
1617
- kind: "group",
1613
+ kind: "element",
1618
1614
  tag: LINE_GROUP_TAG,
1619
1615
  requiredAttributes: [...ID_ATTRS],
1620
1616
  optionalAttributes: [
@@ -1669,7 +1665,7 @@ var LI_SCHEMA = createSchema({
1669
1665
  // src/schema/elementSchemas/elements/list/ol.ts
1670
1666
  var OL_SCHEMA = createSchema({
1671
1667
  code: "ol",
1672
- kind: "group",
1668
+ kind: "element",
1673
1669
  tag: OL_TAG,
1674
1670
  requiredAttributes: [...ID_ATTRS],
1675
1671
  optionalAttributes: [
@@ -1706,7 +1702,7 @@ var OL_SCHEMA = createSchema({
1706
1702
  // src/schema/elementSchemas/elements/list/ul.ts
1707
1703
  var UL_SCHEMA = createSchema({
1708
1704
  code: "ul",
1709
- kind: "group",
1705
+ kind: "element",
1710
1706
  tag: UL_TAG,
1711
1707
  requiredAttributes: [...ID_ATTRS],
1712
1708
  optionalAttributes: [
@@ -1862,7 +1858,7 @@ var TP_SCHEMA = createSchema({
1862
1858
  // src/schema/elementSchemas/elements/table/td.ts
1863
1859
  var TD_SCHEMA = createSchema({
1864
1860
  code: "td",
1865
- kind: "group",
1861
+ kind: "element",
1866
1862
  tag: TD_TAG,
1867
1863
  requiredAttributes: [...ID_ATTRS],
1868
1864
  optionalAttributes: [
@@ -1880,7 +1876,7 @@ var TD_SCHEMA = createSchema({
1880
1876
  // src/schema/elementSchemas/elements/table/tr.ts
1881
1877
  var TR_SCHEMA = createSchema({
1882
1878
  code: "tr",
1883
- kind: "group",
1879
+ kind: "element",
1884
1880
  tag: TR_TAG,
1885
1881
  requiredAttributes: [],
1886
1882
  optionalAttributes: [...LAYOUT_ATTRIBUTES, ...ID_ATTRS, "width"],
@@ -1890,7 +1886,7 @@ var TR_SCHEMA = createSchema({
1890
1886
  // src/schema/elementSchemas/elements/table/thead.ts
1891
1887
  var THEAD_SCHEMA = createSchema({
1892
1888
  code: "thead",
1893
- kind: "group",
1889
+ kind: "element",
1894
1890
  tag: THEAD_TAG,
1895
1891
  requiredAttributes: [],
1896
1892
  optionalAttributes: [...ID_ATTRS],
@@ -1900,7 +1896,7 @@ var THEAD_SCHEMA = createSchema({
1900
1896
  // src/schema/elementSchemas/elements/table/tbody.ts
1901
1897
  var TBODY_SCHEMA = createSchema({
1902
1898
  code: "tbody",
1903
- kind: "group",
1899
+ kind: "element",
1904
1900
  tag: TBODY_TAG,
1905
1901
  requiredAttributes: [],
1906
1902
  optionalAttributes: [...ID_ATTRS],
@@ -1910,7 +1906,7 @@ var TBODY_SCHEMA = createSchema({
1910
1906
  // src/schema/elementSchemas/elements/table/htmlTable.ts
1911
1907
  var HTML_TABLE_SCHEMA = createSchema({
1912
1908
  code: "table",
1913
- kind: "group",
1909
+ kind: "element",
1914
1910
  tag: HTML_TABLE_TAG,
1915
1911
  requiredAttributes: [],
1916
1912
  optionalAttributes: [...ID_ATTRS],
@@ -1923,7 +1919,7 @@ var HTML_TABLE_SCHEMA = createSchema({
1923
1919
  // src/schema/elementSchemas/elements/table/tgroup.ts
1924
1920
  var TGROUP_SCHEMA = createSchema({
1925
1921
  code: "tgroup",
1926
- kind: "group",
1922
+ kind: "element",
1927
1923
  tag: TGROUP_TAG,
1928
1924
  requiredAttributes: [...ID_ATTRS, "cols"],
1929
1925
  optionalAttributes: [],
@@ -1956,7 +1952,7 @@ var TBLSOURCE_SCHEMA = createSchema({
1956
1952
  // src/schema/elementSchemas/elements/table/table1.ts
1957
1953
  var TABLE_SCHEMA = createSchema({
1958
1954
  code: "table1",
1959
- kind: "group",
1955
+ kind: "element",
1960
1956
  tag: TABLE_TAG,
1961
1957
  requiredAttributes: [
1962
1958
  ...ID_ATTRS,
@@ -1991,7 +1987,7 @@ var HEADING_LEVEL = ["H0", "H1", "H2", "H3", "H4", "H5", "H6"];
1991
1987
  var HEADING_ROLES = [...HEADING_LEVEL, "vignette_group"];
1992
1988
  var HEADING_SCHEMA = createSchema({
1993
1989
  code: "heading",
1994
- kind: "group",
1990
+ kind: "element",
1995
1991
  tag: SECTION_TAG,
1996
1992
  matchesElement: (element) => {
1997
1993
  const role = element.getAttribute("role");
@@ -2017,7 +2013,6 @@ var HEADING_SCHEMA = createSchema({
2017
2013
  { code: "sidebar", required: false },
2018
2014
  { code: "epigraph", required: false },
2019
2015
  { code: "blockquote", required: false },
2020
- { code: "example", required: false },
2021
2016
  { code: "ul", required: false },
2022
2017
  { code: "ol", required: false },
2023
2018
  { code: "poem", required: false },
@@ -2036,7 +2031,7 @@ var HEADING_SCHEMA = createSchema({
2036
2031
  var BOX_LEVEL = ["box1", "box2", "box3", "box4", "box5"];
2037
2032
  var BOX_SCHEMA = createSchema({
2038
2033
  code: "sidebar",
2039
- kind: "group",
2034
+ kind: "element",
2040
2035
  tag: SIDEBAR_TAG,
2041
2036
  requiredAttributes: [
2042
2037
  ...ID_ATTRS,
@@ -2093,7 +2088,7 @@ var TITLE_SCHEMA = createSchema({
2093
2088
  // src/schema/elementSchemas/elements/abstract.ts
2094
2089
  var ABSTRACT_SCHEMA = createSchema({
2095
2090
  code: "abstract1",
2096
- kind: "group",
2091
+ kind: "element",
2097
2092
  tag: ABSTRACT_TAG,
2098
2093
  requiredAttributes: [
2099
2094
  ...ID_ATTRS,
@@ -2123,7 +2118,7 @@ var ABSTRACT_SCHEMA = createSchema({
2123
2118
  // src/schema/elementSchemas/elements/appendix.ts
2124
2119
  var APPENDIX_SCHEMA = createSchema({
2125
2120
  code: "appendix",
2126
- kind: "group",
2121
+ kind: "element",
2127
2122
  tag: APPENDIX_TAG,
2128
2123
  requiredAttributes: [...ID_ATTRS, "id", "xmlid"],
2129
2124
  optionalAttributes: [...TRACK_CHANGES_ATTRS],
@@ -2138,7 +2133,7 @@ var APPENDIX_SCHEMA = createSchema({
2138
2133
  // src/schema/elementSchemas/elements/blockquote.ts
2139
2134
  var BLOCKQUOTE_SCHEMA = createSchema({
2140
2135
  code: "blockquote",
2141
- kind: "group",
2136
+ kind: "element",
2142
2137
  tag: BLOCKQUOTE_TAG,
2143
2138
  requiredAttributes: [...ID_ATTRS],
2144
2139
  optionalAttributes: [
@@ -2188,7 +2183,6 @@ var CHAPTER_SCHEMA = createSchema({
2188
2183
  { code: "sidebar", required: false },
2189
2184
  { code: "epigraph", required: false },
2190
2185
  { code: "blockquote", required: false },
2191
- { code: "example", required: false },
2192
2186
  { code: "ul", required: false },
2193
2187
  { code: "ol", required: false },
2194
2188
  { code: "subtitle1", required: false },
@@ -2204,7 +2198,7 @@ var CHAPTER_SCHEMA = createSchema({
2204
2198
  // src/schema/elementSchemas/elements/epigraph.ts
2205
2199
  var EPIGRAPH_SCHEMA = createSchema({
2206
2200
  code: "epigraph",
2207
- kind: "group",
2201
+ kind: "element",
2208
2202
  tag: EPIGRAPH_TAG,
2209
2203
  requiredAttributes: [...ID_ATTRS],
2210
2204
  optionalAttributes: [
@@ -2223,32 +2217,11 @@ var EPIGRAPH_SCHEMA = createSchema({
2223
2217
  ]
2224
2218
  });
2225
2219
 
2226
- // src/schema/elementSchemas/elements/example.ts
2227
- var EXAMPLE_SCHEMA = createSchema({
2228
- code: "example",
2229
- kind: "element",
2230
- tag: EXAMPLE_TAG,
2231
- requiredAttributes: [...ID_ATTRS],
2232
- optionalAttributes: [
2233
- ...TRACK_CHANGES_ATTRS,
2234
- "xmlid",
2235
- "track-code",
2236
- "element-change-description"
2237
- ],
2238
- defaultChildCode: "para",
2239
- allowedChildrenCodes: [
2240
- { code: "para", required: false },
2241
- { code: "ul", required: false },
2242
- { code: "ol", required: false },
2243
- { code: "tag", required: false }
2244
- ]
2245
- });
2246
-
2247
2220
  // src/schema/elementSchemas/elements/footnoteSection.ts
2248
2221
  var FOOTNOTE_SECTION_ROLES = ["ch", "bk"];
2249
2222
  var FOOTNOTE_SECTION_SCHEMA = createSchema({
2250
2223
  code: "footnoteSection",
2251
- kind: "group",
2224
+ kind: "element",
2252
2225
  tag: SECTION_TAG,
2253
2226
  matchesElement: (element) => {
2254
2227
  const role = element.getAttribute("role");
@@ -2274,7 +2247,7 @@ var FOOTNOTE_SECTION_SCHEMA = createSchema({
2274
2247
  // src/schema/elementSchemas/elements/info.ts
2275
2248
  var INFO_SCHEMA = createSchema({
2276
2249
  code: "info1",
2277
- kind: "group",
2250
+ kind: "element",
2278
2251
  tag: INFO_TAG,
2279
2252
  requiredAttributes: [...ID_ATTRS],
2280
2253
  optionalAttributes: [],
@@ -2292,7 +2265,7 @@ var INFO_SCHEMA = createSchema({
2292
2265
  // src/schema/elementSchemas/elements/poem.ts
2293
2266
  var POEM_SCHEMA = createSchema({
2294
2267
  code: "poem",
2295
- kind: "group",
2268
+ kind: "element",
2296
2269
  tag: POEM_TAG,
2297
2270
  requiredAttributes: [...ID_ATTRS],
2298
2271
  optionalAttributes: [...TRACK_CHANGES_ATTRS, "role", "trackmsg"],
@@ -2318,7 +2291,7 @@ var MATHPHRASE_SCHEMA = createSchema({
2318
2291
  // src/schema/elementSchemas/elements/reference/bibliography.ts
2319
2292
  var REFERENCE_BIBLIOGRAPHY_SCHEMA = createSchema({
2320
2293
  code: "referenceBibliography",
2321
- kind: "group",
2294
+ kind: "element",
2322
2295
  tag: REFERENCE_BIBLIOGRAPHY_TAG,
2323
2296
  requiredAttributes: [
2324
2297
  ...ID_ATTRS,
@@ -2346,7 +2319,7 @@ var REFERENCE_BIBLIOGRAPHY_SCHEMA = createSchema({
2346
2319
  // src/schema/elementSchemas/elements/reference/bibliodiv.ts
2347
2320
  var BIBLIODIV_SCHEMA = createSchema({
2348
2321
  code: "bibliodiv",
2349
- kind: "group",
2322
+ kind: "element",
2350
2323
  tag: BIBLIODIV_TAG,
2351
2324
  requiredAttributes: [
2352
2325
  ...ID_ATTRS,
@@ -2425,11 +2398,14 @@ var LEGAL_REFERENCE_BIBLIOMISC_ROLE = "legalRef";
2425
2398
 
2426
2399
  // src/schema/elementSchemas/elements/index.ts
2427
2400
  var ELEMENT_SCHEMAS = {
2401
+ bibliodiv: BIBLIODIV_SCHEMA,
2402
+ referenceBibliography: REFERENCE_BIBLIOGRAPHY_SCHEMA,
2428
2403
  translator: TRANSLATOR_SCHEMA,
2429
2404
  pagenum: PAGENUM_SCHEMA,
2430
2405
  pubId: PUB_ID_SCHEMA,
2431
2406
  para: PARA_SCHEMA,
2432
2407
  title1: TITLE_SCHEMA,
2408
+ footnote: FOOTNOTE_SCHEMA,
2433
2409
  footnoteno: FOOTNOTE_NUMBER_SCHEMA,
2434
2410
  olink: OLINK_SCHEMA,
2435
2411
  firstname: FIRSTNAME_SCHEMA,
@@ -2437,9 +2413,13 @@ var ELEMENT_SCHEMAS = {
2437
2413
  honorific: HONORIFIC_SCHEMA,
2438
2414
  orgname: ORGNAME_SCHEMA,
2439
2415
  email: EMAIL_SCHEMA,
2416
+ org: ORG_SCHEMA,
2440
2417
  degrees: DEGREES_SCHEMA,
2418
+ dialogue: DIALOGUE_SCHEMA,
2441
2419
  line: LINE_SCHEMA,
2420
+ linegroup: LINE_GROUP_SCHEMA,
2442
2421
  speaker: SPEAKER_SCHEMA,
2422
+ equation: EQUATION_SCHEMA,
2443
2423
  math: MATH_SCHEMA,
2444
2424
  mathphrase: MATHPHRASE_SCHEMA,
2445
2425
  merror: MERROR_SCHEMA,
@@ -2468,40 +2448,27 @@ var ELEMENT_SCHEMAS = {
2468
2448
  munder: MUNDER_SCHEMA,
2469
2449
  munderover: MUNDEROVER_SCHEMA,
2470
2450
  img: IMG_SCHEMA,
2451
+ alttext: ALTTEXT_SCHEMA,
2452
+ imageobject: IMAGEOBJECT_SCHEMA,
2453
+ mediaobject: MEDIAOBJECT_SCHEMA,
2454
+ caption1: CAPTION_SCHEMA,
2471
2455
  figsource: FIGSOURCE_SCHEMA,
2472
2456
  fignote: FIGNOTE_SCHEMA,
2457
+ figure1: FIGURE_SCHEMA,
2458
+ informalfigure: INFORMALFIGURE_SCHEMA,
2459
+ keywordset: KEYWORDSET_SCHEMA,
2473
2460
  keyword: KEYWORD_SCHEMA,
2474
2461
  punc: PUNC_SCHEMA,
2475
2462
  label1: LABEL_SCHEMA,
2476
2463
  li: LI_SCHEMA,
2464
+ ol: OL_SCHEMA,
2465
+ ul: UL_SCHEMA,
2477
2466
  token: TOKEN_SCHEMA,
2478
2467
  tag: TAG_SCHEMA,
2479
2468
  lrh: LRH_SCHEMA,
2480
2469
  rrh: RRH_SCHEMA,
2481
2470
  source1: SOURCE_SCHEMA,
2482
2471
  subtitle1: SUBTITLE_SCHEMA,
2483
- tp: TP_SCHEMA,
2484
- tblfn: TBLFN_SCHEMA,
2485
- tblsource: TBLSOURCE_SCHEMA,
2486
- chapter: CHAPTER_SCHEMA
2487
- };
2488
- var GROUP_SCHEMAS = {
2489
- bibliodiv: BIBLIODIV_SCHEMA,
2490
- referenceBibliography: REFERENCE_BIBLIOGRAPHY_SCHEMA,
2491
- footnote: FOOTNOTE_SCHEMA,
2492
- org: ORG_SCHEMA,
2493
- dialogue: DIALOGUE_SCHEMA,
2494
- linegroup: LINE_GROUP_SCHEMA,
2495
- equation: EQUATION_SCHEMA,
2496
- alttext: ALTTEXT_SCHEMA,
2497
- imageobject: IMAGEOBJECT_SCHEMA,
2498
- mediaobject: MEDIAOBJECT_SCHEMA,
2499
- caption1: CAPTION_SCHEMA,
2500
- figure1: FIGURE_SCHEMA,
2501
- informalfigure: INFORMALFIGURE_SCHEMA,
2502
- keywordset: KEYWORDSET_SCHEMA,
2503
- ol: OL_SCHEMA,
2504
- ul: UL_SCHEMA,
2505
2472
  table1: TABLE_SCHEMA,
2506
2473
  tgroup: TGROUP_SCHEMA,
2507
2474
  table: HTML_TABLE_SCHEMA,
@@ -2509,12 +2476,15 @@ var GROUP_SCHEMAS = {
2509
2476
  tbody: TBODY_SCHEMA,
2510
2477
  tr: TR_SCHEMA,
2511
2478
  td: TD_SCHEMA,
2479
+ tp: TP_SCHEMA,
2480
+ tblfn: TBLFN_SCHEMA,
2481
+ tblsource: TBLSOURCE_SCHEMA,
2512
2482
  heading: HEADING_SCHEMA,
2513
2483
  footnoteSection: FOOTNOTE_SECTION_SCHEMA,
2484
+ chapter: CHAPTER_SCHEMA,
2514
2485
  info1: INFO_SCHEMA,
2515
2486
  abstract1: ABSTRACT_SCHEMA,
2516
2487
  epigraph: EPIGRAPH_SCHEMA,
2517
- example: EXAMPLE_SCHEMA,
2518
2488
  poem: POEM_SCHEMA,
2519
2489
  blockquote: BLOCKQUOTE_SCHEMA,
2520
2490
  sidebar: BOX_SCHEMA,
@@ -2627,13 +2597,7 @@ var PHRASE_SCHEMA = createSchema({
2627
2597
  tag: PHRASE_TAG,
2628
2598
  requiredAttributes: [...ID_ATTRS, "xml:lang"],
2629
2599
  optionalAttributes: [],
2630
- allowedChildrenCodes: [
2631
- ...ATOM_CODES_ALLOWED_CHILDREN,
2632
- // DocBook lets a phrase hold footnotes and links, so a language phrase
2633
- // can span a sentence that carries a footnote call-out or a citation.
2634
- { code: "footnote1", required: false },
2635
- { code: "link", required: false }
2636
- ]
2600
+ allowedChildrenCodes: [...ATOM_CODES_ALLOWED_CHILDREN]
2637
2601
  });
2638
2602
 
2639
2603
  // src/schema/elementSchemas/inlineElements/index.ts
@@ -2976,7 +2940,7 @@ var createDocbookSchema = (name) => {
2976
2940
  );
2977
2941
  return createSchema({
2978
2942
  code: getDocbookSchemaCode(name),
2979
- kind: text ? "element" : "group",
2943
+ kind: "element",
2980
2944
  tag: EDITOR_TAGS[name] ?? name.toUpperCase(),
2981
2945
  requiredAttributes: [],
2982
2946
  optionalAttributes: [
@@ -3007,7 +2971,6 @@ var BIBLIOMIXED_SCHEMA = DOCBOOK_SCHEMAS.referenceBibliomixed;
3007
2971
  var SCHEMAS = {
3008
2972
  ...ATOM_SCHEMAS,
3009
2973
  ...ELEMENT_SCHEMAS,
3010
- ...GROUP_SCHEMAS,
3011
2974
  ...INLINE_ELEMENT_SCHEMAS,
3012
2975
  ...DOCBOOK_SCHEMAS
3013
2976
  };
@@ -3047,7 +3010,7 @@ var findSchemaByElement = (element) => getSchemasByTag().get(element.tagName.toU
3047
3010
  var isAttributeRestricted = (attr) => typeof attr !== "string";
3048
3011
 
3049
3012
  // src/schema/helpers/isTrackChangesSchema.ts
3050
- var isTrackChangesSchema = (schema) => schema.kind === "trackChanges";
3013
+ var isTrackChangesSchema = (schema) => schema.code === "insertion" || schema.code === "deletion" || schema.code === "lineGroupRemoval" || schema.code === "formatRemoval";
3051
3014
 
3052
3015
  // src/schema/referenceSchemas/referenceTypeSchemas.ts
3053
3016
  var LINK_FIELDS = ["doi", "url"];
@@ -3438,10 +3401,7 @@ var ElementLabel = {
3438
3401
  ...DOCBOOK_ELEMENT_LABELS,
3439
3402
  mark: "Mark",
3440
3403
  referenceBibliomixed: "Reference Bibliomixed",
3441
- referenceBibliography: {
3442
- default: "Reference Bibliography",
3443
- chapterend: "Chapter-End Reference Bibliography"
3444
- },
3404
+ referenceBibliography: "Reference Bibliography",
3445
3405
  bibliodiv: "Bibliodiv",
3446
3406
  bibliomset: "Reference Block",
3447
3407
  editor: "Editor",
@@ -3469,11 +3429,7 @@ var ElementLabel = {
3469
3429
  tertiary: "Tertiary",
3470
3430
  quaternary: "Quaternary",
3471
3431
  bookmark: "Bookmark",
3472
- see: {
3473
- default: "Cross Reference",
3474
- see: "See",
3475
- "see-also": "See Also"
3476
- },
3432
+ see: "Cross Reference",
3477
3433
  commentQuerySection: "Comment/Query",
3478
3434
  comment: "Comment",
3479
3435
  content: "Content",
@@ -3482,13 +3438,7 @@ var ElementLabel = {
3482
3438
  deletion: "Deletion",
3483
3439
  lineGroupRemoval: "Line Group Removal",
3484
3440
  formatRemoval: "Formatting Removal",
3485
- emphasis: {
3486
- default: "Emphasis",
3487
- lowercase: "Lowercase",
3488
- uppercase: "Uppercase",
3489
- initialcaps: "Initial Caps",
3490
- "Non breaking space": "Non-Breaking Space"
3491
- },
3441
+ emphasis: "Emphasis",
3492
3442
  highlightmark: "Highlightmark",
3493
3443
  i: "Italic",
3494
3444
  insertion: "Insertion",
@@ -3505,15 +3455,11 @@ var ElementLabel = {
3505
3455
  fignote: "Fignote",
3506
3456
  figsource: "Figsource",
3507
3457
  firstname: "Firstname",
3508
- footnote: {
3509
- default: "Footnote Marker",
3510
- "end-ch-note": "Chapter Footnote Marker",
3511
- "end-bk-note": "Book Footnote Marker"
3512
- },
3458
+ footnote: "Footnote Marker",
3513
3459
  footnoteno: "Footnote Number",
3514
3460
  honorific: "Honorific",
3515
3461
  img: "Image",
3516
- informalfigure: "Inline Figure",
3462
+ informalfigure: "Floating Figure",
3517
3463
  keyword: "Keyword",
3518
3464
  label1: "Label",
3519
3465
  li: "List Item",
@@ -3575,24 +3521,9 @@ var ElementLabel = {
3575
3521
  chapter: "Chapter",
3576
3522
  dialogue: "Dialogue",
3577
3523
  epigraph: "Epigraph",
3578
- example: "Example",
3579
- figure1: "Display Figure",
3580
- footnoteSection: {
3581
- default: "Footnote Section",
3582
- ch: "Chapter Footnote Section",
3583
- bk: "Book Footnote Section"
3584
- },
3585
- heading: {
3586
- default: "Heading",
3587
- H0: "Heading +1",
3588
- H1: "Heading 1",
3589
- H2: "Heading 2",
3590
- H3: "Heading 3",
3591
- H4: "Heading 4",
3592
- H5: "Heading 5",
3593
- H6: "Heading 6",
3594
- vignette_group: "Vignette Group"
3595
- },
3524
+ figure1: "Figure",
3525
+ footnoteSection: "Footnote Section",
3526
+ heading: "Heading",
3596
3527
  imageobject: "Image Object",
3597
3528
  info1: "Info",
3598
3529
  keywordset: "Keyword FGroup",
@@ -3600,40 +3531,17 @@ var ElementLabel = {
3600
3531
  ol: "Ordered List",
3601
3532
  personname: "Person Name",
3602
3533
  poem: "Poem",
3603
- sidebar: {
3604
- default: "Box",
3605
- box1: "Box 1",
3606
- box2: "Box 2",
3607
- box3: "Box 3",
3608
- box4: "Box 4",
3609
- box5: "Box 5"
3610
- },
3534
+ sidebar: "Box",
3611
3535
  table: "Table",
3612
- table1: {
3613
- default: "Table",
3614
- inline: "Inline Table",
3615
- float: "Floating Table"
3616
- },
3536
+ table1: "Table",
3617
3537
  tbody: "Table Body",
3618
3538
  td: "Table Data",
3619
3539
  tgroup: "Table Group",
3620
3540
  tr: "Table Row",
3621
3541
  ul: "Unordered List",
3622
- footnote1: {
3623
- default: "Footnote",
3624
- "end-ch-note": "Chapter Footnote",
3625
- "end-bk-note": "Book Footnote"
3626
- },
3542
+ footnote1: "Footnote",
3627
3543
  inlineequation: "Inline Equation",
3628
- link: {
3629
- default: "Link",
3630
- bibr: "Bibliography Link",
3631
- table: "Table Link",
3632
- figure: "Figure Link",
3633
- equation: "Equation Link",
3634
- footnote: "Footnote Link",
3635
- chapter: "Chapter Link"
3636
- },
3544
+ link: "Link",
3637
3545
  uri: "URI",
3638
3546
  phrase: "Phrase",
3639
3547
  abbreviation: "Abbreviation",
@@ -3641,13 +3549,6 @@ var ElementLabel = {
3641
3549
  em: "Emphasis",
3642
3550
  strong: "Strong"
3643
3551
  };
3644
- var getElementLabel = (code, role) => {
3645
- const label = ElementLabel[code];
3646
- if (typeof label === "string") {
3647
- return label;
3648
- }
3649
- return role && Object.prototype.hasOwnProperty.call(label, role) ? label[role] : label.default;
3650
- };
3651
3552
 
3652
3553
  // src/schema/shared/dependentsForbiddenElements.ts
3653
3554
  var DEPENDENT_FORBIDDEN_ELEMENTS = [
@@ -3658,7 +3559,6 @@ var DEPENDENT_FORBIDDEN_ELEMENTS = [
3658
3559
  ];
3659
3560
 
3660
3561
  // src/helpers/isIgnoredElement.ts
3661
- var DUMMY_SPAN_SELECTOR = "span#dummySpan";
3662
3562
  var IGNORED_ELEMENT_SELECTORS = [
3663
3563
  "span.rhlabel",
3664
3564
  "span.printlabel",
@@ -3667,7 +3567,7 @@ var IGNORED_ELEMENT_SELECTORS = [
3667
3567
  "span.ref-drag",
3668
3568
  "span.reference-type-label",
3669
3569
  "span.reference-validation-no-match",
3670
- DUMMY_SPAN_SELECTOR
3570
+ "span#dummySpan"
3671
3571
  ];
3672
3572
  var IGNORED_ELEMENT_SELECTOR = IGNORED_ELEMENT_SELECTORS.join(", ");
3673
3573
  var isIgnoredElement = (element) => element.tagName.toUpperCase() === "SPAN" && element.matches(IGNORED_ELEMENT_SELECTOR);
@@ -3995,14 +3895,8 @@ var validateRequiredChildren = (element, schema, childElements) => {
3995
3895
  );
3996
3896
  if (!hasChild) {
3997
3897
  const requiredChild = findSchemaByCode(allowedChild.code);
3998
- const elementLabel = getElementLabel(
3999
- requiredChild.code,
4000
- element.getAttribute("role")
4001
- );
4002
- const parentLabel = getElementLabel(
4003
- schema.code,
4004
- element.getAttribute("role")
4005
- );
3898
+ const elementLabel = ElementLabel[requiredChild.code];
3899
+ const parentLabel = ElementLabel[schema.code];
4006
3900
  const extraInstruction = getExtraInstruction(schema, requiredChild);
4007
3901
  const description = [
4008
3902
  `Please provide at least one ${elementLabel} in this ${parentLabel}.`,
@@ -4042,16 +3936,15 @@ var validateChildren = (element, schema) => {
4042
3936
  const childElements = getEffectiveChildElements(element, {
4043
3937
  includeDeleted: false
4044
3938
  });
4045
- if (schema.kind === "atom" || schema.kind === "trackChanges") {
3939
+ if (schema.kind === "atom") {
4046
3940
  return errors;
4047
3941
  }
4048
3942
  if (schema.allowsText === false && hasVisibleText(element)) {
4049
- const label = getElementLabel(schema.code, element.getAttribute("role"));
4050
3943
  addValidationIssue(errors, element, {
4051
- title: `Text not allowed in ${label}`,
3944
+ title: `Text not allowed in ${ElementLabel[schema.code]}`,
4052
3945
  level: "warning",
4053
3946
  kind: "forbidden",
4054
- description: `A ${label} holds only elements. Please tag or remove the text inside it.`,
3947
+ description: `A ${ElementLabel[schema.code]} holds only elements. Please tag or remove the text inside it.`,
4055
3948
  elements: [element]
4056
3949
  });
4057
3950
  }
@@ -4558,10 +4451,7 @@ var isInWrongBibliomset = (field) => {
4558
4451
  const relation = field.closest(BIBLIOMSET)?.getAttribute("relation");
4559
4452
  return relation !== void 0 && !FIELD_BIBLIOMSETS[field.localName]?.some((owner) => owner === relation);
4560
4453
  };
4561
- var isEditorWrapper = (element) => {
4562
- const kind = findSchemaByElement(element)?.kind;
4563
- return element.tagName.toUpperCase() === "SPAN" || kind === "atom" || kind === "trackChanges";
4564
- };
4454
+ var isEditorWrapper = (element) => element.tagName.toUpperCase() === "SPAN" || findSchemaByElement(element)?.kind === "atom";
4565
4455
  var getLiveChildren = (element) => Array.from(element.children).flatMap((child) => {
4566
4456
  if (!isLiveReferenceContent(child)) return [];
4567
4457
  return child.matches(INSERTION) || child.tagName.toUpperCase() === "SPAN" && !findSchemaByElement(child) ? getLiveChildren(child) : [child];
@@ -4698,6 +4588,182 @@ var validateReferenceMarkup = (reference, typeSchema) => {
4698
4588
  );
4699
4589
  };
4700
4590
 
4591
+ // src/validation/referenceBlockCopy.ts
4592
+ var BLOCK = "bibliomset";
4593
+ var BLOCK_TITLE_FIELDS = ["title", "containerTitle"];
4594
+ var BLOCK_NAMES = {
4595
+ part: "chapter",
4596
+ book: "book",
4597
+ article: "article",
4598
+ journal: "journal"
4599
+ };
4600
+ var capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
4601
+ var joinWords = (words, conjunction = "and") => words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} ${conjunction} ${words[words.length - 1]}`;
4602
+ var isBlockRelation = (value) => !!value && Object.prototype.hasOwnProperty.call(BLOCK_NAMES, value);
4603
+ var getRelation = (element) => {
4604
+ const relation = element?.getAttribute("relation");
4605
+ return isBlockRelation(relation) ? relation : void 0;
4606
+ };
4607
+ var getRelations = (blocks) => [
4608
+ ...new Set(
4609
+ blocks.map(getRelation).filter((relation) => !!relation)
4610
+ )
4611
+ ];
4612
+ var nameBlocks = (relations) => relations.length > 0 ? `${joinWords(relations.map((relation) => BLOCK_NAMES[relation]))} details` : "details";
4613
+ var getTitleLabel = ({ relation, typeSchema }) => {
4614
+ const index = typeSchema.bibliomsetRelations?.indexOf(relation) ?? -1;
4615
+ const field = BLOCK_TITLE_FIELDS[index];
4616
+ if (!field) return `${capitalize(BLOCK_NAMES[relation])} title`;
4617
+ return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
4618
+ };
4619
+ var isWorkBlock = ({ relation, typeSchema }) => typeSchema.bibliomsetRelations?.indexOf(relation) === 0;
4620
+ var getUntitledBlockCopy = ({
4621
+ elements,
4622
+ typeSchema
4623
+ }) => {
4624
+ const relations = getRelations(elements);
4625
+ const [relation] = relations;
4626
+ const allKnown = elements.every((element) => getRelation(element));
4627
+ if (relations.length !== 1 || !relation || !allKnown) {
4628
+ return {
4629
+ title: "Titles missing from the details",
4630
+ description: `The ${allKnown ? nameBlocks(relations) : "details"} have no titles. Tag each title inside its details.`
4631
+ };
4632
+ }
4633
+ const name = BLOCK_NAMES[relation];
4634
+ const title = getTitleLabel({ relation, typeSchema }).toLowerCase();
4635
+ return {
4636
+ title: `${capitalize(title)} missing from the ${name} details`,
4637
+ description: `The ${name} details have no ${title}. Tag the ${title} inside them.`
4638
+ };
4639
+ };
4640
+ var getMissingBlockCopy = ({
4641
+ elements,
4642
+ typeSchema
4643
+ }) => {
4644
+ const relations = typeSchema.bibliomsetRelations ?? [];
4645
+ const present = new Set(
4646
+ getRelations(
4647
+ elements.flatMap(
4648
+ (reference) => Array.from(reference.querySelectorAll(BLOCK)).filter(
4649
+ isLiveReferenceContent
4650
+ )
4651
+ )
4652
+ )
4653
+ );
4654
+ const missing = relations.filter((relation) => !present.has(relation));
4655
+ const shown = missing.length > 0 ? missing : relations;
4656
+ const groups = shown.map((relation) => {
4657
+ const name = BLOCK_NAMES[relation];
4658
+ const contents = isWorkBlock({ relation, typeSchema }) ? `the ${name}'s title and authors` : `the ${name}'s title`;
4659
+ return `${contents} in the ${name} details`;
4660
+ });
4661
+ const titles = shown.map(
4662
+ (relation) => `the ${getTitleLabel({ relation, typeSchema }).toLowerCase()}`
4663
+ );
4664
+ return {
4665
+ title: `${capitalize(nameBlocks(shown))} missing`,
4666
+ description: `${typeSchema.label} references group ${groups.join(", and ")}. Tag ${joinWords(titles)} to create them.`
4667
+ };
4668
+ };
4669
+ var getRepeatedBlockCopy = ({
4670
+ elements
4671
+ }) => {
4672
+ const relations = getRelations(elements);
4673
+ const blocks = nameBlocks(relations);
4674
+ const repeatsPerRelation = elements.map(getRelation);
4675
+ const eachAppearsTwice = relations.every(
4676
+ (relation) => repeatsPerRelation.filter((repeat) => repeat === relation).length === 1
4677
+ );
4678
+ return {
4679
+ title: `${capitalize(blocks)} repeated`,
4680
+ 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.`
4681
+ };
4682
+ };
4683
+ var getNestedBlockCopy = ({
4684
+ elements
4685
+ }) => {
4686
+ const pairs = [
4687
+ ...new Set(
4688
+ elements.map(
4689
+ (block) => `${getRelation(block)}|${getRelation(block.parentElement?.closest(BLOCK))}`
4690
+ )
4691
+ )
4692
+ ];
4693
+ const [inner, outer] = pairs.length === 1 ? pairs[0].split("|") : [];
4694
+ if (!isBlockRelation(inner) || !isBlockRelation(outer)) {
4695
+ return {
4696
+ title: "Details inside other details",
4697
+ description: "Move each one out so they sit side by side."
4698
+ };
4699
+ }
4700
+ return {
4701
+ title: `${capitalize(BLOCK_NAMES[inner])} details inside the ${BLOCK_NAMES[outer]} details`,
4702
+ description: `Move the ${BLOCK_NAMES[inner]} details out so the two sit side by side.`
4703
+ };
4704
+ };
4705
+ var getUnusedBlockCopy = ({
4706
+ elements,
4707
+ typeSchema
4708
+ }) => {
4709
+ const relations = typeSchema.bibliomsetRelations ?? [];
4710
+ const title = `${capitalize(nameBlocks(getRelations(elements)))} not used by ${typeSchema.label.toLowerCase()} references`;
4711
+ if (relations.length === 0) {
4712
+ return { title, description: "Remove the grouping and keep its contents." };
4713
+ }
4714
+ const used = relations.map(
4715
+ (relation) => `the ${BLOCK_NAMES[relation]} details`
4716
+ );
4717
+ return {
4718
+ title,
4719
+ description: `${typeSchema.label} references use ${joinWords(used)}. Change the grouping to one of them.`
4720
+ };
4721
+ };
4722
+ var getMisplacedFieldCopy = ({
4723
+ elements,
4724
+ typeSchema
4725
+ }) => {
4726
+ const typeRelations = typeSchema.bibliomsetRelations ?? [];
4727
+ const moves = [
4728
+ ...new Map(
4729
+ elements.flatMap((element) => {
4730
+ const field = findReferenceFieldByElement(element);
4731
+ const relation = getRelation(element.closest(BLOCK));
4732
+ const allowed = FIELD_BIBLIOMSETS[element.localName] ?? [];
4733
+ const usedByType = allowed.filter(
4734
+ (home) => typeRelations.includes(home)
4735
+ );
4736
+ const homes = usedByType.length > 0 ? usedByType : allowed;
4737
+ if (!field) return [];
4738
+ const label = REFERENCE_FIELD_SCHEMAS[field].label;
4739
+ const source = relation ? `the ${BLOCK_NAMES[relation]}` : "the wrong";
4740
+ return [
4741
+ [
4742
+ `${field}|${relation}`,
4743
+ {
4744
+ title: `${label} in ${source} details`,
4745
+ description: `Move the ${label.toLowerCase()} to the ${joinWords(
4746
+ homes.map((home) => BLOCK_NAMES[home]),
4747
+ "or"
4748
+ )} details.`
4749
+ }
4750
+ ]
4751
+ ];
4752
+ })
4753
+ ).values()
4754
+ ];
4755
+ const [move] = moves;
4756
+ if (moves.length === 1 && move) return move;
4757
+ return {
4758
+ title: "Fields in the wrong details",
4759
+ description: moves.map(({ description }) => description).join(" ") || "Move each field to the details it belongs in."
4760
+ };
4761
+ };
4762
+ var PART_EDITOR_COPY = {
4763
+ title: "Editor tagged in the chapter details",
4764
+ description: "The chapter details hold the chapter and its authors. Tag the name as an author, or move the editor to the book details."
4765
+ };
4766
+
4701
4767
  // src/validation/validateReferenceStructure.ts
4702
4768
  var getLiveReferenceFieldElements = (reference) => getReferenceFieldElements(reference).filter(
4703
4769
  ({ element }) => isLiveReferenceContent(element)
@@ -4775,11 +4841,7 @@ var getFieldLabel = (field, typeSchema) => {
4775
4841
  }
4776
4842
  return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
4777
4843
  };
4778
- var getBibliomsetRelationCopy = (typeSchema) => {
4779
- const relations = typeSchema.bibliomsetRelations ?? [];
4780
- 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.`;
4781
- };
4782
- var getMarkupCopy = (rule, typeSchema) => {
4844
+ var getMarkupCopy = (rule, blockCopyParams) => {
4783
4845
  switch (rule) {
4784
4846
  case "missing_id":
4785
4847
  return {
@@ -4788,41 +4850,17 @@ var getMarkupCopy = (rule, typeSchema) => {
4788
4850
  description: "Every reference needs an xml:id. Please add one."
4789
4851
  };
4790
4852
  case "bibliomset_relation":
4791
- return {
4792
- title: "Wrong bibliomset for this reference type",
4793
- kind: "forbidden",
4794
- description: getBibliomsetRelationCopy(typeSchema)
4795
- };
4853
+ return { kind: "forbidden", ...getUnusedBlockCopy(blockCopyParams) };
4796
4854
  case "bibliomset_missing":
4797
- return {
4798
- title: "Bibliomset missing",
4799
- kind: "missing",
4800
- description: `${typeSchema.label} references need one bibliomset with the relation ${(typeSchema.bibliomsetRelations ?? []).join(" and one with ")}. Please wrap the details in them.`
4801
- };
4855
+ return { kind: "missing", ...getMissingBlockCopy(blockCopyParams) };
4802
4856
  case "bibliomset_repeated":
4803
- return {
4804
- title: "Bibliomset repeated",
4805
- kind: "forbidden",
4806
- description: "A reference holds one bibliomset of each relation. Please move the details of the repeated bibliomset into the first one."
4807
- };
4857
+ return { kind: "forbidden", ...getRepeatedBlockCopy(blockCopyParams) };
4808
4858
  case "bibliomset_title":
4809
- return {
4810
- title: "Bibliomset without a title",
4811
- kind: "missing",
4812
- description: "Every bibliomset must contain a title. Please move its title into it or remove the bibliomset."
4813
- };
4859
+ return { kind: "missing", ...getUntitledBlockCopy(blockCopyParams) };
4814
4860
  case "bibliomset_nested":
4815
- return {
4816
- title: "Bibliomset inside another bibliomset",
4817
- kind: "forbidden",
4818
- description: "A bibliomset cannot sit inside another bibliomset. Please move it out so the two sit side by side."
4819
- };
4861
+ return { kind: "forbidden", ...getNestedBlockCopy(blockCopyParams) };
4820
4862
  case "part_editor":
4821
- return {
4822
- title: "Editor tagged in the chapter part",
4823
- kind: "forbidden",
4824
- 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."
4825
- };
4863
+ return { kind: "forbidden", ...PART_EDITOR_COPY };
4826
4864
  case "personname_role":
4827
4865
  return {
4828
4866
  title: "Name order not set",
@@ -4842,11 +4880,7 @@ var getMarkupCopy = (rule, typeSchema) => {
4842
4880
  description: "An author, editor or credit holds one personname or orgname. Please tag each name as its own creator."
4843
4881
  };
4844
4882
  case "bibliomset_field":
4845
- return {
4846
- title: "Field in the wrong bibliomset",
4847
- kind: "forbidden",
4848
- 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."
4849
- };
4883
+ return { kind: "forbidden", ...getMisplacedFieldCopy(blockCopyParams) };
4850
4884
  case "bibliomisc_role":
4851
4885
  return {
4852
4886
  title: "Description type not set",
@@ -4910,7 +4944,9 @@ var getIssueCopy = (issue, typeSchema) => {
4910
4944
  };
4911
4945
  }
4912
4946
  const typeLabel = typeSchema.label.toLowerCase();
4913
- if (issue.code === "markup") return getMarkupCopy(issue.rule, typeSchema);
4947
+ if (issue.code === "markup") {
4948
+ return getMarkupCopy(issue.rule, { elements: issue.elements, typeSchema });
4949
+ }
4914
4950
  if (issue.code === "wrong_element") {
4915
4951
  return {
4916
4952
  title: `${issue.tag} not allowed`,
@@ -4953,28 +4989,6 @@ var validateReference = (reference) => {
4953
4989
  );
4954
4990
  };
4955
4991
 
4956
- // src/validation/validateDummySpan.ts
4957
- var validateDummySpan = (root) => {
4958
- const placeholders = [];
4959
- for (const dummySpan of root.querySelectorAll(DUMMY_SPAN_SELECTOR)) {
4960
- const parentElement = dummySpan.parentElement;
4961
- if (parentElement) {
4962
- placeholders.push(parentElement);
4963
- continue;
4964
- }
4965
- placeholders.push(root);
4966
- }
4967
- return placeholders.map(
4968
- (holder) => createValidationIssue(holder, {
4969
- title: "Placeholder element found",
4970
- kind: "placeholder",
4971
- description: "This element contains an empty placeholder. Type text into the placeholder or delete it.",
4972
- level: "blocker",
4973
- elements: [holder]
4974
- })
4975
- );
4976
- };
4977
-
4978
4992
  // src/validation/validateXml.ts
4979
4993
  var ELEMENTS_PER_STEP = 64;
4980
4994
  var DEFAULT_TIME_BUDGET_MS = 8;
@@ -5032,7 +5046,6 @@ function* validateXmlSteps(xml, elementsToLink, linkElements, schemasToValidateA
5032
5046
  const errors = [];
5033
5047
  errors.push(...validateConsecutiveFootnotes(xml));
5034
5048
  errors.push(...validateConsecutiveFootnoteCues(xml));
5035
- errors.push(...validateDummySpan(xml));
5036
5049
  yield;
5037
5050
  errors.push(...yield* validatePossibleWeblinksSteps(xml));
5038
5051
  yield* validateElements(xml, {
@@ -5166,11 +5179,10 @@ var getAdjacentElement = ({
5166
5179
  DOCBOOK_ELEMENT_LABELS,
5167
5180
  DOCBOOK_ELEMENT_NAMES,
5168
5181
  DOCBOOK_SCHEMAS,
5169
- DUMMY_SPAN_SELECTOR,
5170
5182
  ELEMENT_SCHEMAS,
5171
5183
  ELE_ID_ATTRIBUTE,
5184
+ ElementLabel,
5172
5185
  FIGURE_PLACEMENT_ATTRIBUTE,
5173
- GROUP_SCHEMAS,
5174
5186
  ID_ATTRS,
5175
5187
  IGNORED_ATTRIBUTES,
5176
5188
  IGNORED_ATTRIBUTES_STARTS_WITH,
@@ -5219,7 +5231,6 @@ var getAdjacentElement = ({
5219
5231
  getAttributeName,
5220
5232
  getDocbookSchemaCode,
5221
5233
  getEffectiveChildElements,
5222
- getElementLabel,
5223
5234
  getElementLinks,
5224
5235
  getPossibleWeblinks,
5225
5236
  getReferenceFieldElements,
@@ -5237,7 +5248,6 @@ var getAdjacentElement = ({
5237
5248
  validateAttributes,
5238
5249
  validateConsecutiveFootnoteCues,
5239
5250
  validateConsecutiveFootnotes,
5240
- validateDummySpan,
5241
5251
  validateElementAgainstSchema,
5242
5252
  validateElementToLinkTo,
5243
5253
  validateFootnoteNumber,