pro-editor-schema 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +587 -9
- package/dist/index.mjs +587 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,8 @@ var createSchema = ({
|
|
|
6
6
|
requiredAttributes,
|
|
7
7
|
optionalAttributes,
|
|
8
8
|
defaultChildTagName,
|
|
9
|
-
allowedChildTagNames
|
|
9
|
+
allowedChildTagNames,
|
|
10
|
+
canBeWrappedByInsertOrDelete
|
|
10
11
|
}) => {
|
|
11
12
|
return {
|
|
12
13
|
code,
|
|
@@ -15,7 +16,8 @@ var createSchema = ({
|
|
|
15
16
|
requiredAttributes,
|
|
16
17
|
optionalAttributes,
|
|
17
18
|
defaultChildTagName,
|
|
18
|
-
allowedChildTagNames: new Set(allowedChildTagNames)
|
|
19
|
+
allowedChildTagNames: new Set(allowedChildTagNames),
|
|
20
|
+
canBeWrappedByInsertOrDelete
|
|
19
21
|
};
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -77,9 +79,17 @@ var COMMENT_TAG = "COMMENT";
|
|
|
77
79
|
var QUERY_TAG = "QUERY";
|
|
78
80
|
var CONTENT_TAG = "CONTENT";
|
|
79
81
|
var REPLY_TAG = "REPLY";
|
|
82
|
+
var INDEXTERM_TAG = "INDEXTERM";
|
|
83
|
+
var PRIMARY_TAG = "PRIMARY";
|
|
84
|
+
var SECONDARY_TAG = "SECONDARY";
|
|
85
|
+
var TERTIARY_TAG = "TERTIARY";
|
|
86
|
+
var QUATERNARY_TAG = "QUATERNARY";
|
|
87
|
+
var BOOKMARK_TAG = "BOOKMARK";
|
|
88
|
+
var SEE_TAG = "SEE";
|
|
80
89
|
|
|
81
90
|
// src/schema/shared/allowedAtomsChildren.ts
|
|
82
91
|
var ATOM_TAGS_ALLOWED_CHILDREN = [
|
|
92
|
+
{ tagName: INDEXTERM_TAG, required: false },
|
|
83
93
|
{ tagName: B_TAG, required: false },
|
|
84
94
|
{ tagName: I_TAG, required: false },
|
|
85
95
|
{ tagName: U_TAG, required: false },
|
|
@@ -326,8 +336,152 @@ var REPLY_SCHEMA = createSchema({
|
|
|
326
336
|
allowedChildTagNames: [{ tagName: CONTENT_TAG, required: true }]
|
|
327
337
|
});
|
|
328
338
|
|
|
339
|
+
// src/schema/elementSchemas/atoms/indexing/indexTermAttributes.ts
|
|
340
|
+
var INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES = [
|
|
341
|
+
"data-date",
|
|
342
|
+
"data-user",
|
|
343
|
+
"firstEntry",
|
|
344
|
+
"secondEntry",
|
|
345
|
+
"thirdEntry",
|
|
346
|
+
"entry",
|
|
347
|
+
STORE_ATTRIBUTE,
|
|
348
|
+
"linkend"
|
|
349
|
+
];
|
|
350
|
+
var BOOKMARK_INDEX_POSITION_ATTRIBUTE = {
|
|
351
|
+
name: "index-position",
|
|
352
|
+
values: ["start", "end"],
|
|
353
|
+
defaultValue: ""
|
|
354
|
+
};
|
|
355
|
+
var SEE_REQUIRED_ATTRIBUTES = [
|
|
356
|
+
"linkend",
|
|
357
|
+
"data-user",
|
|
358
|
+
"crossref-pageNumber",
|
|
359
|
+
{
|
|
360
|
+
name: "role",
|
|
361
|
+
values: ["see", "see-also"],
|
|
362
|
+
defaultValue: ""
|
|
363
|
+
},
|
|
364
|
+
STORE_ATTRIBUTE,
|
|
365
|
+
"data-date",
|
|
366
|
+
"crossref-firstEntry",
|
|
367
|
+
"crossref-secondEntry",
|
|
368
|
+
"crossref-thirdEntry",
|
|
369
|
+
"crossref-fourthEntry"
|
|
370
|
+
];
|
|
371
|
+
|
|
372
|
+
// src/schema/elementSchemas/atoms/indexing/bookmark.ts
|
|
373
|
+
var BOOKMARK_SCHEMA = createSchema({
|
|
374
|
+
code: "bookmark",
|
|
375
|
+
kind: "atom",
|
|
376
|
+
tag: BOOKMARK_TAG,
|
|
377
|
+
requiredAttributes: [
|
|
378
|
+
...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES,
|
|
379
|
+
BOOKMARK_INDEX_POSITION_ATTRIBUTE
|
|
380
|
+
],
|
|
381
|
+
optionalAttributes: [],
|
|
382
|
+
allowedChildTagNames: [
|
|
383
|
+
{
|
|
384
|
+
tagName: SEE_TAG,
|
|
385
|
+
required: false
|
|
386
|
+
}
|
|
387
|
+
]
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// src/schema/elementSchemas/atoms/indexing/indexterm.ts
|
|
391
|
+
var INDEXTERM_SCHEMA = createSchema({
|
|
392
|
+
code: "indexterm",
|
|
393
|
+
kind: "atom",
|
|
394
|
+
tag: INDEXTERM_TAG,
|
|
395
|
+
requiredAttributes: [
|
|
396
|
+
"linkend",
|
|
397
|
+
{
|
|
398
|
+
name: "index-level",
|
|
399
|
+
values: ["PRIMARY", "SECONDARY", "TERTIARY", "QUATERNARY"],
|
|
400
|
+
defaultValue: "PRIMARY"
|
|
401
|
+
},
|
|
402
|
+
STORE_ATTRIBUTE
|
|
403
|
+
],
|
|
404
|
+
optionalAttributes: [],
|
|
405
|
+
allowedChildTagNames: [
|
|
406
|
+
{ tagName: PRIMARY_TAG, required: false },
|
|
407
|
+
{ tagName: SECONDARY_TAG, required: false },
|
|
408
|
+
{ tagName: TERTIARY_TAG, required: false },
|
|
409
|
+
{ tagName: QUATERNARY_TAG, required: false },
|
|
410
|
+
{ tagName: BOOKMARK_TAG, required: false }
|
|
411
|
+
]
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
// src/schema/elementSchemas/atoms/indexing/primary.ts
|
|
415
|
+
var PRIMARY_SCHEMA = createSchema({
|
|
416
|
+
code: "primary",
|
|
417
|
+
kind: "atom",
|
|
418
|
+
tag: PRIMARY_TAG,
|
|
419
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
420
|
+
optionalAttributes: [],
|
|
421
|
+
allowedChildTagNames: [
|
|
422
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
423
|
+
{ tagName: SEE_TAG, required: false }
|
|
424
|
+
]
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// src/schema/elementSchemas/atoms/indexing/quaternary.ts
|
|
428
|
+
var QUATERNARY_SCHEMA = createSchema({
|
|
429
|
+
code: "quaternary",
|
|
430
|
+
kind: "atom",
|
|
431
|
+
tag: QUATERNARY_TAG,
|
|
432
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
433
|
+
optionalAttributes: [],
|
|
434
|
+
allowedChildTagNames: [
|
|
435
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
436
|
+
{ tagName: SEE_TAG, required: false }
|
|
437
|
+
]
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// src/schema/elementSchemas/atoms/indexing/secondary.ts
|
|
441
|
+
var SECONDARY_SCHEMA = createSchema({
|
|
442
|
+
code: "secondary",
|
|
443
|
+
kind: "atom",
|
|
444
|
+
tag: SECONDARY_TAG,
|
|
445
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
446
|
+
optionalAttributes: [],
|
|
447
|
+
allowedChildTagNames: [
|
|
448
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
449
|
+
{ tagName: SEE_TAG, required: false }
|
|
450
|
+
]
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// src/schema/elementSchemas/atoms/indexing/see.ts
|
|
454
|
+
var SEE_SCHEMA = createSchema({
|
|
455
|
+
code: "see",
|
|
456
|
+
kind: "atom",
|
|
457
|
+
tag: SEE_TAG,
|
|
458
|
+
requiredAttributes: [...SEE_REQUIRED_ATTRIBUTES],
|
|
459
|
+
optionalAttributes: [],
|
|
460
|
+
allowedChildTagNames: []
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// src/schema/elementSchemas/atoms/indexing/tertiary.ts
|
|
464
|
+
var TERTIARY_SCHEMA = createSchema({
|
|
465
|
+
code: "tertiary",
|
|
466
|
+
kind: "atom",
|
|
467
|
+
tag: TERTIARY_TAG,
|
|
468
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
469
|
+
optionalAttributes: [],
|
|
470
|
+
allowedChildTagNames: [
|
|
471
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
472
|
+
{ tagName: SEE_TAG, required: false }
|
|
473
|
+
]
|
|
474
|
+
});
|
|
475
|
+
|
|
329
476
|
// src/schema/elementSchemas/atoms/index.ts
|
|
330
477
|
var ATOM_SCHEMAS = {
|
|
478
|
+
indexterm: INDEXTERM_SCHEMA,
|
|
479
|
+
primary: PRIMARY_SCHEMA,
|
|
480
|
+
secondary: SECONDARY_SCHEMA,
|
|
481
|
+
tertiary: TERTIARY_SCHEMA,
|
|
482
|
+
quaternary: QUATERNARY_SCHEMA,
|
|
483
|
+
bookmark: BOOKMARK_SCHEMA,
|
|
484
|
+
see: SEE_SCHEMA,
|
|
331
485
|
b: B_SCHEMA,
|
|
332
486
|
i: I_SCHEMA,
|
|
333
487
|
u: U_SCHEMA,
|
|
@@ -408,6 +562,33 @@ var CHAPTER_TAG = "CHAPTER";
|
|
|
408
562
|
var EPIGRAPH_TAG = "EPIGRAPH";
|
|
409
563
|
var INFO_TAG = "INFO1";
|
|
410
564
|
var POEM_TAG = "POEM";
|
|
565
|
+
var MATHPHRASE_TAG = "MATHPHRASE";
|
|
566
|
+
var MATH_TAG = "MATH";
|
|
567
|
+
var MERROR_TAG = "MERROR";
|
|
568
|
+
var MFRAC_TAG = "MFRAC";
|
|
569
|
+
var MI_TAG = "MI";
|
|
570
|
+
var MMULTISCRIPTS_TAG = "MMULTISCRIPTS";
|
|
571
|
+
var MN_TAG = "MN";
|
|
572
|
+
var MO_TAG = "MO";
|
|
573
|
+
var MOVER_TAG = "MOVER";
|
|
574
|
+
var MPADDED_TAG = "MPADDED";
|
|
575
|
+
var MPHANTOM_TAG = "MPHANTOM";
|
|
576
|
+
var MPRESCRIPTS_TAG = "MPRESCRIPTS";
|
|
577
|
+
var MROOT_TAG = "MROOT";
|
|
578
|
+
var MROW_TAG = "MROW";
|
|
579
|
+
var MS_TAG = "MS";
|
|
580
|
+
var MSPACE_TAG = "MSPACE";
|
|
581
|
+
var MSQRT_TAG = "MSQRT";
|
|
582
|
+
var MSTYLE_TAG = "MSTYLE";
|
|
583
|
+
var MSUB_TAG = "MSUB";
|
|
584
|
+
var MSUBSUP_TAG = "MSUBSUP";
|
|
585
|
+
var MSUP_TAG = "MSUP";
|
|
586
|
+
var MTABLE_TAG = "MTABLE";
|
|
587
|
+
var MTD_TAG = "MTD";
|
|
588
|
+
var MTEXT_TAG = "MTEXT";
|
|
589
|
+
var MTR_TAG = "MTR";
|
|
590
|
+
var MUNDER_TAG = "MUNDER";
|
|
591
|
+
var MUNDEROVER_TAG = "MUNDEROVER";
|
|
411
592
|
|
|
412
593
|
// src/schema/elementSchemas/elements/authors/authorgroup.ts
|
|
413
594
|
var AUTHORGROUP_SCHEMA = createSchema({
|
|
@@ -595,16 +776,363 @@ var DIALOGUE_SCHEMA = createSchema({
|
|
|
595
776
|
]
|
|
596
777
|
});
|
|
597
778
|
|
|
598
|
-
// src/schema/elementSchemas/elements/equation.ts
|
|
779
|
+
// src/schema/elementSchemas/elements/equation/equation.ts
|
|
599
780
|
var EQUATION_SCHEMA = createSchema({
|
|
600
781
|
code: "equation",
|
|
601
782
|
kind: "element",
|
|
602
783
|
tag: EQUATION_TAG,
|
|
784
|
+
requiredAttributes: [...ID_ATTRS],
|
|
785
|
+
optionalAttributes: [
|
|
786
|
+
...TRACK_CHANGES_ATTRS,
|
|
787
|
+
{
|
|
788
|
+
name: "eqn-data",
|
|
789
|
+
values: ["new", "updated"],
|
|
790
|
+
defaultValue: "new"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: "element-status",
|
|
794
|
+
values: ["added", "changed"],
|
|
795
|
+
defaultValue: "added"
|
|
796
|
+
}
|
|
797
|
+
],
|
|
798
|
+
allowedChildTagNames: [{ tagName: MATHPHRASE_TAG, required: true }]
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
// src/schema/shared/allowedMathChildren.ts
|
|
802
|
+
var MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN = [
|
|
803
|
+
{ tagName: MERROR_TAG, required: false },
|
|
804
|
+
{ tagName: MFRAC_TAG, required: false },
|
|
805
|
+
{ tagName: MI_TAG, required: false },
|
|
806
|
+
{ tagName: MMULTISCRIPTS_TAG, required: false },
|
|
807
|
+
{ tagName: MN_TAG, required: false },
|
|
808
|
+
{ tagName: MO_TAG, required: false },
|
|
809
|
+
{ tagName: MOVER_TAG, required: false },
|
|
810
|
+
{ tagName: MPADDED_TAG, required: false },
|
|
811
|
+
{ tagName: MPHANTOM_TAG, required: false },
|
|
812
|
+
{ tagName: MPRESCRIPTS_TAG, required: false },
|
|
813
|
+
{ tagName: MROOT_TAG, required: false },
|
|
814
|
+
{ tagName: MROW_TAG, required: false },
|
|
815
|
+
{ tagName: MS_TAG, required: false },
|
|
816
|
+
{ tagName: MSPACE_TAG, required: false },
|
|
817
|
+
{ tagName: MSQRT_TAG, required: false },
|
|
818
|
+
{ tagName: MSTYLE_TAG, required: false },
|
|
819
|
+
{ tagName: MSUB_TAG, required: false },
|
|
820
|
+
{ tagName: MSUBSUP_TAG, required: false },
|
|
821
|
+
{ tagName: MSUP_TAG, required: false },
|
|
822
|
+
{ tagName: MTABLE_TAG, required: false },
|
|
823
|
+
{ tagName: MTD_TAG, required: false },
|
|
824
|
+
{ tagName: MTEXT_TAG, required: false },
|
|
825
|
+
{ tagName: MTR_TAG, required: false },
|
|
826
|
+
{ tagName: MUNDER_TAG, required: false },
|
|
827
|
+
{ tagName: MUNDEROVER_TAG, required: false }
|
|
828
|
+
];
|
|
829
|
+
|
|
830
|
+
// src/schema/elementSchemas/elements/equation/math.ts
|
|
831
|
+
var MATH_SCHEMA = createSchema({
|
|
832
|
+
code: "math",
|
|
833
|
+
kind: "element",
|
|
834
|
+
tag: MATH_TAG,
|
|
835
|
+
requiredAttributes: [],
|
|
836
|
+
optionalAttributes: ["xmlns"],
|
|
837
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN],
|
|
838
|
+
canBeWrappedByInsertOrDelete: true
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
// src/schema/elementSchemas/elements/equation/merror.ts
|
|
842
|
+
var MERROR_SCHEMA = createSchema({
|
|
843
|
+
code: "merror",
|
|
844
|
+
kind: "element",
|
|
845
|
+
tag: MERROR_TAG,
|
|
846
|
+
requiredAttributes: [],
|
|
847
|
+
optionalAttributes: [],
|
|
848
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
// src/schema/elementSchemas/elements/equation/mfrac.ts
|
|
852
|
+
var MFRAC_SCHEMA = createSchema({
|
|
853
|
+
code: "mfrac",
|
|
854
|
+
kind: "element",
|
|
855
|
+
tag: MFRAC_TAG,
|
|
856
|
+
requiredAttributes: [],
|
|
857
|
+
optionalAttributes: ["denomalign", "linethickness", "numalign"],
|
|
858
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
// src/schema/elementSchemas/elements/equation/mi.ts
|
|
862
|
+
var MI_SCHEMA = createSchema({
|
|
863
|
+
code: "mi",
|
|
864
|
+
kind: "element",
|
|
865
|
+
tag: MI_TAG,
|
|
866
|
+
requiredAttributes: [],
|
|
867
|
+
optionalAttributes: ["mathvariant"],
|
|
868
|
+
allowedChildTagNames: []
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
// src/schema/elementSchemas/elements/equation/mmultiscripts.ts
|
|
872
|
+
var MMULTISCRIPTS_SCHEMA = createSchema({
|
|
873
|
+
code: "mmultiscripts",
|
|
874
|
+
kind: "element",
|
|
875
|
+
tag: MMULTISCRIPTS_TAG,
|
|
876
|
+
requiredAttributes: [],
|
|
877
|
+
optionalAttributes: ["subscriptshift", "superscriptshift"],
|
|
878
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
// src/schema/elementSchemas/elements/equation/mn.ts
|
|
882
|
+
var MN_SCHEMA = createSchema({
|
|
883
|
+
code: "mn",
|
|
884
|
+
kind: "element",
|
|
885
|
+
tag: MN_TAG,
|
|
603
886
|
requiredAttributes: [],
|
|
604
887
|
optionalAttributes: [],
|
|
605
888
|
allowedChildTagNames: []
|
|
606
889
|
});
|
|
607
890
|
|
|
891
|
+
// src/schema/elementSchemas/elements/equation/mo.ts
|
|
892
|
+
var MO_SCHEMA = createSchema({
|
|
893
|
+
code: "mo",
|
|
894
|
+
kind: "element",
|
|
895
|
+
tag: MO_TAG,
|
|
896
|
+
requiredAttributes: [],
|
|
897
|
+
optionalAttributes: [
|
|
898
|
+
"accent",
|
|
899
|
+
"fence",
|
|
900
|
+
"form",
|
|
901
|
+
"largeop",
|
|
902
|
+
"lspace",
|
|
903
|
+
"maxsize",
|
|
904
|
+
"minsize",
|
|
905
|
+
"movablelimits",
|
|
906
|
+
"rspace",
|
|
907
|
+
"separator",
|
|
908
|
+
"stretchy",
|
|
909
|
+
"symmetric"
|
|
910
|
+
],
|
|
911
|
+
allowedChildTagNames: []
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
// src/schema/elementSchemas/elements/equation/mover.ts
|
|
915
|
+
var MOVER_SCHEMA = createSchema({
|
|
916
|
+
code: "mover",
|
|
917
|
+
kind: "element",
|
|
918
|
+
tag: MOVER_TAG,
|
|
919
|
+
requiredAttributes: [],
|
|
920
|
+
optionalAttributes: ["accent"],
|
|
921
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
// src/schema/elementSchemas/elements/equation/mpadded.ts
|
|
925
|
+
var MPADDED_SCHEMA = createSchema({
|
|
926
|
+
code: "mpadded",
|
|
927
|
+
kind: "element",
|
|
928
|
+
tag: MPADDED_TAG,
|
|
929
|
+
requiredAttributes: [],
|
|
930
|
+
optionalAttributes: [
|
|
931
|
+
"depth",
|
|
932
|
+
"height",
|
|
933
|
+
"lspace",
|
|
934
|
+
"voffset",
|
|
935
|
+
"width"
|
|
936
|
+
],
|
|
937
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
// src/schema/elementSchemas/elements/equation/mphantom.ts
|
|
941
|
+
var MPHANTOM_SCHEMA = createSchema({
|
|
942
|
+
code: "mphantom",
|
|
943
|
+
kind: "element",
|
|
944
|
+
tag: MPHANTOM_TAG,
|
|
945
|
+
requiredAttributes: [],
|
|
946
|
+
optionalAttributes: [],
|
|
947
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
// src/schema/elementSchemas/elements/equation/mprescripts.ts
|
|
951
|
+
var MPRESCRIPTS_SCHEMA = createSchema({
|
|
952
|
+
code: "mprescripts",
|
|
953
|
+
kind: "element",
|
|
954
|
+
tag: MPRESCRIPTS_TAG,
|
|
955
|
+
requiredAttributes: [],
|
|
956
|
+
optionalAttributes: [],
|
|
957
|
+
allowedChildTagNames: []
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
// src/schema/elementSchemas/elements/equation/mroot.ts
|
|
961
|
+
var MROOT_SCHEMA = createSchema({
|
|
962
|
+
code: "mroot",
|
|
963
|
+
kind: "element",
|
|
964
|
+
tag: MROOT_TAG,
|
|
965
|
+
requiredAttributes: [],
|
|
966
|
+
optionalAttributes: [],
|
|
967
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
// src/schema/elementSchemas/elements/equation/mrow.ts
|
|
971
|
+
var MROW_SCHEMA = createSchema({
|
|
972
|
+
code: "mrow",
|
|
973
|
+
kind: "element",
|
|
974
|
+
tag: MROW_TAG,
|
|
975
|
+
requiredAttributes: [],
|
|
976
|
+
optionalAttributes: [],
|
|
977
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
// src/schema/elementSchemas/elements/equation/ms.ts
|
|
981
|
+
var MS_SCHEMA = createSchema({
|
|
982
|
+
code: "ms",
|
|
983
|
+
kind: "element",
|
|
984
|
+
tag: MS_TAG,
|
|
985
|
+
requiredAttributes: [],
|
|
986
|
+
optionalAttributes: ["lquote", "rquote"],
|
|
987
|
+
allowedChildTagNames: []
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
// src/schema/elementSchemas/elements/equation/mspace.ts
|
|
991
|
+
var MSPACE_SCHEMA = createSchema({
|
|
992
|
+
code: "mspace",
|
|
993
|
+
kind: "element",
|
|
994
|
+
tag: MSPACE_TAG,
|
|
995
|
+
requiredAttributes: [],
|
|
996
|
+
optionalAttributes: ["depth", "height", "width"],
|
|
997
|
+
allowedChildTagNames: []
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
// src/schema/elementSchemas/elements/equation/msqrt.ts
|
|
1001
|
+
var MSQRT_SCHEMA = createSchema({
|
|
1002
|
+
code: "msqrt",
|
|
1003
|
+
kind: "element",
|
|
1004
|
+
tag: MSQRT_TAG,
|
|
1005
|
+
requiredAttributes: [],
|
|
1006
|
+
optionalAttributes: [],
|
|
1007
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
// src/schema/elementSchemas/elements/equation/mstyle.ts
|
|
1011
|
+
var MSTYLE_SCHEMA = createSchema({
|
|
1012
|
+
code: "mstyle",
|
|
1013
|
+
kind: "element",
|
|
1014
|
+
tag: MSTYLE_TAG,
|
|
1015
|
+
requiredAttributes: [],
|
|
1016
|
+
optionalAttributes: [
|
|
1017
|
+
"displaystyle",
|
|
1018
|
+
"mathbackground",
|
|
1019
|
+
"mathcolor",
|
|
1020
|
+
"mathsize",
|
|
1021
|
+
"scriptlevel",
|
|
1022
|
+
"scriptminsize",
|
|
1023
|
+
"scriptsizemultiplier"
|
|
1024
|
+
],
|
|
1025
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
// src/schema/elementSchemas/elements/equation/msub.ts
|
|
1029
|
+
var MSUB_SCHEMA = createSchema({
|
|
1030
|
+
code: "msub",
|
|
1031
|
+
kind: "element",
|
|
1032
|
+
tag: MSUB_TAG,
|
|
1033
|
+
requiredAttributes: [],
|
|
1034
|
+
optionalAttributes: ["subscriptshift"],
|
|
1035
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
// src/schema/elementSchemas/elements/equation/msubsup.ts
|
|
1039
|
+
var MSUBSUP_SCHEMA = createSchema({
|
|
1040
|
+
code: "msubsup",
|
|
1041
|
+
kind: "element",
|
|
1042
|
+
tag: MSUBSUP_TAG,
|
|
1043
|
+
requiredAttributes: [],
|
|
1044
|
+
optionalAttributes: ["subscriptshift", "superscriptshift"],
|
|
1045
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
// src/schema/elementSchemas/elements/equation/msup.ts
|
|
1049
|
+
var MSUP_SCHEMA = createSchema({
|
|
1050
|
+
code: "msup",
|
|
1051
|
+
kind: "element",
|
|
1052
|
+
tag: MSUP_TAG,
|
|
1053
|
+
requiredAttributes: [],
|
|
1054
|
+
optionalAttributes: ["superscriptshift"],
|
|
1055
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
// src/schema/elementSchemas/elements/equation/mtable.ts
|
|
1059
|
+
var MTABLE_SCHEMA = createSchema({
|
|
1060
|
+
code: "mtable",
|
|
1061
|
+
kind: "element",
|
|
1062
|
+
tag: MTABLE_TAG,
|
|
1063
|
+
requiredAttributes: [],
|
|
1064
|
+
optionalAttributes: [
|
|
1065
|
+
"align",
|
|
1066
|
+
"columnalign",
|
|
1067
|
+
"columnlines",
|
|
1068
|
+
"columnspacing",
|
|
1069
|
+
"displaystyle",
|
|
1070
|
+
"equalcolumns",
|
|
1071
|
+
"equalrows",
|
|
1072
|
+
"frame",
|
|
1073
|
+
"rowalign",
|
|
1074
|
+
"rowlines",
|
|
1075
|
+
"rowspacing",
|
|
1076
|
+
"width"
|
|
1077
|
+
],
|
|
1078
|
+
allowedChildTagNames: [{ tagName: MTR_TAG, required: false }]
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
// src/schema/elementSchemas/elements/equation/mtd.ts
|
|
1082
|
+
var MTD_SCHEMA = createSchema({
|
|
1083
|
+
code: "mtd",
|
|
1084
|
+
kind: "element",
|
|
1085
|
+
tag: MTD_TAG,
|
|
1086
|
+
requiredAttributes: [],
|
|
1087
|
+
optionalAttributes: [
|
|
1088
|
+
"columnalign",
|
|
1089
|
+
"columnspan",
|
|
1090
|
+
"rowalign",
|
|
1091
|
+
"rowspan"
|
|
1092
|
+
],
|
|
1093
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
// src/schema/elementSchemas/elements/equation/mtext.ts
|
|
1097
|
+
var MTEXT_SCHEMA = createSchema({
|
|
1098
|
+
code: "mtext",
|
|
1099
|
+
kind: "element",
|
|
1100
|
+
tag: MTEXT_TAG,
|
|
1101
|
+
requiredAttributes: [],
|
|
1102
|
+
optionalAttributes: ["mathvariant"],
|
|
1103
|
+
allowedChildTagNames: []
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
// src/schema/elementSchemas/elements/equation/mtr.ts
|
|
1107
|
+
var MTR_SCHEMA = createSchema({
|
|
1108
|
+
code: "mtr",
|
|
1109
|
+
kind: "element",
|
|
1110
|
+
tag: MTR_TAG,
|
|
1111
|
+
requiredAttributes: [],
|
|
1112
|
+
optionalAttributes: ["columnalign", "rowalign"],
|
|
1113
|
+
allowedChildTagNames: [{ tagName: MTD_TAG, required: false }]
|
|
1114
|
+
});
|
|
1115
|
+
|
|
1116
|
+
// src/schema/elementSchemas/elements/equation/munder.ts
|
|
1117
|
+
var MUNDER_SCHEMA = createSchema({
|
|
1118
|
+
code: "munder",
|
|
1119
|
+
kind: "element",
|
|
1120
|
+
tag: MUNDER_TAG,
|
|
1121
|
+
requiredAttributes: [],
|
|
1122
|
+
optionalAttributes: ["accentunder"],
|
|
1123
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1124
|
+
});
|
|
1125
|
+
|
|
1126
|
+
// src/schema/elementSchemas/elements/equation/munderover.ts
|
|
1127
|
+
var MUNDEROVER_SCHEMA = createSchema({
|
|
1128
|
+
code: "munderover",
|
|
1129
|
+
kind: "element",
|
|
1130
|
+
tag: MUNDEROVER_TAG,
|
|
1131
|
+
requiredAttributes: [],
|
|
1132
|
+
optionalAttributes: ["accent", "accentunder"],
|
|
1133
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1134
|
+
});
|
|
1135
|
+
|
|
608
1136
|
// src/schema/elementSchemas/elements/figure/img.ts
|
|
609
1137
|
var IMG_SCHEMA = createSchema({
|
|
610
1138
|
code: "img",
|
|
@@ -1425,6 +1953,16 @@ var POEM_SCHEMA = createSchema({
|
|
|
1425
1953
|
]
|
|
1426
1954
|
});
|
|
1427
1955
|
|
|
1956
|
+
// src/schema/elementSchemas/elements/equation/mathphrase.ts
|
|
1957
|
+
var MATHPHRASE_SCHEMA = createSchema({
|
|
1958
|
+
code: "mathphrase",
|
|
1959
|
+
kind: "element",
|
|
1960
|
+
tag: MATHPHRASE_TAG,
|
|
1961
|
+
requiredAttributes: [ELE_ID_ATTRIBUTE],
|
|
1962
|
+
optionalAttributes: [],
|
|
1963
|
+
allowedChildTagNames: [{ tagName: MATH_TAG, required: true }]
|
|
1964
|
+
});
|
|
1965
|
+
|
|
1428
1966
|
// src/schema/elementSchemas/elements/index.ts
|
|
1429
1967
|
var ELEMENT_SCHEMAS = {
|
|
1430
1968
|
para: PARA_SCHEMA,
|
|
@@ -1443,6 +1981,33 @@ var ELEMENT_SCHEMAS = {
|
|
|
1443
1981
|
line: LINE_SCHEMA,
|
|
1444
1982
|
speaker: SPEAKER_SCHEMA,
|
|
1445
1983
|
equation: EQUATION_SCHEMA,
|
|
1984
|
+
math: MATH_SCHEMA,
|
|
1985
|
+
mathphrase: MATHPHRASE_SCHEMA,
|
|
1986
|
+
merror: MERROR_SCHEMA,
|
|
1987
|
+
mfrac: MFRAC_SCHEMA,
|
|
1988
|
+
mi: MI_SCHEMA,
|
|
1989
|
+
mmultiscripts: MMULTISCRIPTS_SCHEMA,
|
|
1990
|
+
mn: MN_SCHEMA,
|
|
1991
|
+
mo: MO_SCHEMA,
|
|
1992
|
+
mover: MOVER_SCHEMA,
|
|
1993
|
+
mpadded: MPADDED_SCHEMA,
|
|
1994
|
+
mphantom: MPHANTOM_SCHEMA,
|
|
1995
|
+
mprescripts: MPRESCRIPTS_SCHEMA,
|
|
1996
|
+
mroot: MROOT_SCHEMA,
|
|
1997
|
+
mrow: MROW_SCHEMA,
|
|
1998
|
+
ms: MS_SCHEMA,
|
|
1999
|
+
mspace: MSPACE_SCHEMA,
|
|
2000
|
+
msqrt: MSQRT_SCHEMA,
|
|
2001
|
+
mstyle: MSTYLE_SCHEMA,
|
|
2002
|
+
msub: MSUB_SCHEMA,
|
|
2003
|
+
msubsup: MSUBSUP_SCHEMA,
|
|
2004
|
+
msup: MSUP_SCHEMA,
|
|
2005
|
+
mtable: MTABLE_SCHEMA,
|
|
2006
|
+
mtd: MTD_SCHEMA,
|
|
2007
|
+
mtext: MTEXT_SCHEMA,
|
|
2008
|
+
mtr: MTR_SCHEMA,
|
|
2009
|
+
munder: MUNDER_SCHEMA,
|
|
2010
|
+
munderover: MUNDEROVER_SCHEMA,
|
|
1446
2011
|
img: IMG_SCHEMA,
|
|
1447
2012
|
alttext: ALTTEXT_SCHEMA,
|
|
1448
2013
|
imageobject: IMAGEOBJECT_SCHEMA,
|
|
@@ -1508,8 +2073,20 @@ var INLINEEQUATION_SCHEMA = createSchema({
|
|
|
1508
2073
|
kind: "inline",
|
|
1509
2074
|
tag: INLINEEQUATION_TAG,
|
|
1510
2075
|
requiredAttributes: [...ID_ATTRS],
|
|
1511
|
-
optionalAttributes: [
|
|
1512
|
-
|
|
2076
|
+
optionalAttributes: [
|
|
2077
|
+
...TRACK_CHANGES_ATTRS,
|
|
2078
|
+
{
|
|
2079
|
+
name: "eqn-data",
|
|
2080
|
+
values: ["new", "updated"],
|
|
2081
|
+
defaultValue: "new"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
name: "element-status",
|
|
2085
|
+
values: ["added", "changed"],
|
|
2086
|
+
defaultValue: "added"
|
|
2087
|
+
}
|
|
2088
|
+
],
|
|
2089
|
+
allowedChildTagNames: [{ tagName: MATHPHRASE_TAG, required: true }]
|
|
1513
2090
|
});
|
|
1514
2091
|
|
|
1515
2092
|
// src/schema/elementSchemas/inlineElements/link.ts
|
|
@@ -1590,20 +2167,21 @@ var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute) |
|
|
|
1590
2167
|
var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
|
|
1591
2168
|
var findSchemaByCode = (code) => SCHEMAS[code];
|
|
1592
2169
|
var findSchemaByElement = (element) => {
|
|
2170
|
+
const tagName = element.tagName.toUpperCase();
|
|
1593
2171
|
const isInsertion = element.classList.contains("ins");
|
|
1594
2172
|
const isDeletion = element.classList.contains("del");
|
|
1595
2173
|
const isQueryComment = element.classList.contains("cmtQurySection");
|
|
1596
2174
|
const role = element.getAttribute("role");
|
|
1597
|
-
if (isQueryComment) {
|
|
2175
|
+
if (isQueryComment && tagName === SPAN_TAG) {
|
|
1598
2176
|
return findSchemaByCode("commentQuerySection");
|
|
1599
2177
|
}
|
|
1600
|
-
if (isInsertion) {
|
|
2178
|
+
if (isInsertion && tagName === SPAN_TAG) {
|
|
1601
2179
|
return findSchemaByCode("insertion");
|
|
1602
2180
|
}
|
|
1603
|
-
if (isDeletion) {
|
|
2181
|
+
if (isDeletion && tagName === SPAN_TAG) {
|
|
1604
2182
|
return findSchemaByCode("deletion");
|
|
1605
2183
|
}
|
|
1606
|
-
if (role) {
|
|
2184
|
+
if (role && tagName === SECTION_TAG) {
|
|
1607
2185
|
if (role.startsWith("H")) {
|
|
1608
2186
|
return findSchemaByCode("heading");
|
|
1609
2187
|
}
|