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.js
CHANGED
|
@@ -69,7 +69,8 @@ var createSchema = ({
|
|
|
69
69
|
requiredAttributes,
|
|
70
70
|
optionalAttributes,
|
|
71
71
|
defaultChildTagName,
|
|
72
|
-
allowedChildTagNames
|
|
72
|
+
allowedChildTagNames,
|
|
73
|
+
canBeWrappedByInsertOrDelete
|
|
73
74
|
}) => {
|
|
74
75
|
return {
|
|
75
76
|
code,
|
|
@@ -78,7 +79,8 @@ var createSchema = ({
|
|
|
78
79
|
requiredAttributes,
|
|
79
80
|
optionalAttributes,
|
|
80
81
|
defaultChildTagName,
|
|
81
|
-
allowedChildTagNames: new Set(allowedChildTagNames)
|
|
82
|
+
allowedChildTagNames: new Set(allowedChildTagNames),
|
|
83
|
+
canBeWrappedByInsertOrDelete
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
|
|
@@ -140,9 +142,17 @@ var COMMENT_TAG = "COMMENT";
|
|
|
140
142
|
var QUERY_TAG = "QUERY";
|
|
141
143
|
var CONTENT_TAG = "CONTENT";
|
|
142
144
|
var REPLY_TAG = "REPLY";
|
|
145
|
+
var INDEXTERM_TAG = "INDEXTERM";
|
|
146
|
+
var PRIMARY_TAG = "PRIMARY";
|
|
147
|
+
var SECONDARY_TAG = "SECONDARY";
|
|
148
|
+
var TERTIARY_TAG = "TERTIARY";
|
|
149
|
+
var QUATERNARY_TAG = "QUATERNARY";
|
|
150
|
+
var BOOKMARK_TAG = "BOOKMARK";
|
|
151
|
+
var SEE_TAG = "SEE";
|
|
143
152
|
|
|
144
153
|
// src/schema/shared/allowedAtomsChildren.ts
|
|
145
154
|
var ATOM_TAGS_ALLOWED_CHILDREN = [
|
|
155
|
+
{ tagName: INDEXTERM_TAG, required: false },
|
|
146
156
|
{ tagName: B_TAG, required: false },
|
|
147
157
|
{ tagName: I_TAG, required: false },
|
|
148
158
|
{ tagName: U_TAG, required: false },
|
|
@@ -389,8 +399,152 @@ var REPLY_SCHEMA = createSchema({
|
|
|
389
399
|
allowedChildTagNames: [{ tagName: CONTENT_TAG, required: true }]
|
|
390
400
|
});
|
|
391
401
|
|
|
402
|
+
// src/schema/elementSchemas/atoms/indexing/indexTermAttributes.ts
|
|
403
|
+
var INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES = [
|
|
404
|
+
"data-date",
|
|
405
|
+
"data-user",
|
|
406
|
+
"firstEntry",
|
|
407
|
+
"secondEntry",
|
|
408
|
+
"thirdEntry",
|
|
409
|
+
"entry",
|
|
410
|
+
STORE_ATTRIBUTE,
|
|
411
|
+
"linkend"
|
|
412
|
+
];
|
|
413
|
+
var BOOKMARK_INDEX_POSITION_ATTRIBUTE = {
|
|
414
|
+
name: "index-position",
|
|
415
|
+
values: ["start", "end"],
|
|
416
|
+
defaultValue: ""
|
|
417
|
+
};
|
|
418
|
+
var SEE_REQUIRED_ATTRIBUTES = [
|
|
419
|
+
"linkend",
|
|
420
|
+
"data-user",
|
|
421
|
+
"crossref-pageNumber",
|
|
422
|
+
{
|
|
423
|
+
name: "role",
|
|
424
|
+
values: ["see", "see-also"],
|
|
425
|
+
defaultValue: ""
|
|
426
|
+
},
|
|
427
|
+
STORE_ATTRIBUTE,
|
|
428
|
+
"data-date",
|
|
429
|
+
"crossref-firstEntry",
|
|
430
|
+
"crossref-secondEntry",
|
|
431
|
+
"crossref-thirdEntry",
|
|
432
|
+
"crossref-fourthEntry"
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
// src/schema/elementSchemas/atoms/indexing/bookmark.ts
|
|
436
|
+
var BOOKMARK_SCHEMA = createSchema({
|
|
437
|
+
code: "bookmark",
|
|
438
|
+
kind: "atom",
|
|
439
|
+
tag: BOOKMARK_TAG,
|
|
440
|
+
requiredAttributes: [
|
|
441
|
+
...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES,
|
|
442
|
+
BOOKMARK_INDEX_POSITION_ATTRIBUTE
|
|
443
|
+
],
|
|
444
|
+
optionalAttributes: [],
|
|
445
|
+
allowedChildTagNames: [
|
|
446
|
+
{
|
|
447
|
+
tagName: SEE_TAG,
|
|
448
|
+
required: false
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// src/schema/elementSchemas/atoms/indexing/indexterm.ts
|
|
454
|
+
var INDEXTERM_SCHEMA = createSchema({
|
|
455
|
+
code: "indexterm",
|
|
456
|
+
kind: "atom",
|
|
457
|
+
tag: INDEXTERM_TAG,
|
|
458
|
+
requiredAttributes: [
|
|
459
|
+
"linkend",
|
|
460
|
+
{
|
|
461
|
+
name: "index-level",
|
|
462
|
+
values: ["PRIMARY", "SECONDARY", "TERTIARY", "QUATERNARY"],
|
|
463
|
+
defaultValue: "PRIMARY"
|
|
464
|
+
},
|
|
465
|
+
STORE_ATTRIBUTE
|
|
466
|
+
],
|
|
467
|
+
optionalAttributes: [],
|
|
468
|
+
allowedChildTagNames: [
|
|
469
|
+
{ tagName: PRIMARY_TAG, required: false },
|
|
470
|
+
{ tagName: SECONDARY_TAG, required: false },
|
|
471
|
+
{ tagName: TERTIARY_TAG, required: false },
|
|
472
|
+
{ tagName: QUATERNARY_TAG, required: false },
|
|
473
|
+
{ tagName: BOOKMARK_TAG, required: false }
|
|
474
|
+
]
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
// src/schema/elementSchemas/atoms/indexing/primary.ts
|
|
478
|
+
var PRIMARY_SCHEMA = createSchema({
|
|
479
|
+
code: "primary",
|
|
480
|
+
kind: "atom",
|
|
481
|
+
tag: PRIMARY_TAG,
|
|
482
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
483
|
+
optionalAttributes: [],
|
|
484
|
+
allowedChildTagNames: [
|
|
485
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
486
|
+
{ tagName: SEE_TAG, required: false }
|
|
487
|
+
]
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// src/schema/elementSchemas/atoms/indexing/quaternary.ts
|
|
491
|
+
var QUATERNARY_SCHEMA = createSchema({
|
|
492
|
+
code: "quaternary",
|
|
493
|
+
kind: "atom",
|
|
494
|
+
tag: QUATERNARY_TAG,
|
|
495
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
496
|
+
optionalAttributes: [],
|
|
497
|
+
allowedChildTagNames: [
|
|
498
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
499
|
+
{ tagName: SEE_TAG, required: false }
|
|
500
|
+
]
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// src/schema/elementSchemas/atoms/indexing/secondary.ts
|
|
504
|
+
var SECONDARY_SCHEMA = createSchema({
|
|
505
|
+
code: "secondary",
|
|
506
|
+
kind: "atom",
|
|
507
|
+
tag: SECONDARY_TAG,
|
|
508
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
509
|
+
optionalAttributes: [],
|
|
510
|
+
allowedChildTagNames: [
|
|
511
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
512
|
+
{ tagName: SEE_TAG, required: false }
|
|
513
|
+
]
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
// src/schema/elementSchemas/atoms/indexing/see.ts
|
|
517
|
+
var SEE_SCHEMA = createSchema({
|
|
518
|
+
code: "see",
|
|
519
|
+
kind: "atom",
|
|
520
|
+
tag: SEE_TAG,
|
|
521
|
+
requiredAttributes: [...SEE_REQUIRED_ATTRIBUTES],
|
|
522
|
+
optionalAttributes: [],
|
|
523
|
+
allowedChildTagNames: []
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
// src/schema/elementSchemas/atoms/indexing/tertiary.ts
|
|
527
|
+
var TERTIARY_SCHEMA = createSchema({
|
|
528
|
+
code: "tertiary",
|
|
529
|
+
kind: "atom",
|
|
530
|
+
tag: TERTIARY_TAG,
|
|
531
|
+
requiredAttributes: [...INDEX_TERM_ENTRY_REQUIRED_ATTRIBUTES],
|
|
532
|
+
optionalAttributes: [],
|
|
533
|
+
allowedChildTagNames: [
|
|
534
|
+
...ATOM_TAGS_ALLOWED_CHILDREN,
|
|
535
|
+
{ tagName: SEE_TAG, required: false }
|
|
536
|
+
]
|
|
537
|
+
});
|
|
538
|
+
|
|
392
539
|
// src/schema/elementSchemas/atoms/index.ts
|
|
393
540
|
var ATOM_SCHEMAS = {
|
|
541
|
+
indexterm: INDEXTERM_SCHEMA,
|
|
542
|
+
primary: PRIMARY_SCHEMA,
|
|
543
|
+
secondary: SECONDARY_SCHEMA,
|
|
544
|
+
tertiary: TERTIARY_SCHEMA,
|
|
545
|
+
quaternary: QUATERNARY_SCHEMA,
|
|
546
|
+
bookmark: BOOKMARK_SCHEMA,
|
|
547
|
+
see: SEE_SCHEMA,
|
|
394
548
|
b: B_SCHEMA,
|
|
395
549
|
i: I_SCHEMA,
|
|
396
550
|
u: U_SCHEMA,
|
|
@@ -471,6 +625,33 @@ var CHAPTER_TAG = "CHAPTER";
|
|
|
471
625
|
var EPIGRAPH_TAG = "EPIGRAPH";
|
|
472
626
|
var INFO_TAG = "INFO1";
|
|
473
627
|
var POEM_TAG = "POEM";
|
|
628
|
+
var MATHPHRASE_TAG = "MATHPHRASE";
|
|
629
|
+
var MATH_TAG = "MATH";
|
|
630
|
+
var MERROR_TAG = "MERROR";
|
|
631
|
+
var MFRAC_TAG = "MFRAC";
|
|
632
|
+
var MI_TAG = "MI";
|
|
633
|
+
var MMULTISCRIPTS_TAG = "MMULTISCRIPTS";
|
|
634
|
+
var MN_TAG = "MN";
|
|
635
|
+
var MO_TAG = "MO";
|
|
636
|
+
var MOVER_TAG = "MOVER";
|
|
637
|
+
var MPADDED_TAG = "MPADDED";
|
|
638
|
+
var MPHANTOM_TAG = "MPHANTOM";
|
|
639
|
+
var MPRESCRIPTS_TAG = "MPRESCRIPTS";
|
|
640
|
+
var MROOT_TAG = "MROOT";
|
|
641
|
+
var MROW_TAG = "MROW";
|
|
642
|
+
var MS_TAG = "MS";
|
|
643
|
+
var MSPACE_TAG = "MSPACE";
|
|
644
|
+
var MSQRT_TAG = "MSQRT";
|
|
645
|
+
var MSTYLE_TAG = "MSTYLE";
|
|
646
|
+
var MSUB_TAG = "MSUB";
|
|
647
|
+
var MSUBSUP_TAG = "MSUBSUP";
|
|
648
|
+
var MSUP_TAG = "MSUP";
|
|
649
|
+
var MTABLE_TAG = "MTABLE";
|
|
650
|
+
var MTD_TAG = "MTD";
|
|
651
|
+
var MTEXT_TAG = "MTEXT";
|
|
652
|
+
var MTR_TAG = "MTR";
|
|
653
|
+
var MUNDER_TAG = "MUNDER";
|
|
654
|
+
var MUNDEROVER_TAG = "MUNDEROVER";
|
|
474
655
|
|
|
475
656
|
// src/schema/elementSchemas/elements/authors/authorgroup.ts
|
|
476
657
|
var AUTHORGROUP_SCHEMA = createSchema({
|
|
@@ -658,16 +839,363 @@ var DIALOGUE_SCHEMA = createSchema({
|
|
|
658
839
|
]
|
|
659
840
|
});
|
|
660
841
|
|
|
661
|
-
// src/schema/elementSchemas/elements/equation.ts
|
|
842
|
+
// src/schema/elementSchemas/elements/equation/equation.ts
|
|
662
843
|
var EQUATION_SCHEMA = createSchema({
|
|
663
844
|
code: "equation",
|
|
664
845
|
kind: "element",
|
|
665
846
|
tag: EQUATION_TAG,
|
|
847
|
+
requiredAttributes: [...ID_ATTRS],
|
|
848
|
+
optionalAttributes: [
|
|
849
|
+
...TRACK_CHANGES_ATTRS,
|
|
850
|
+
{
|
|
851
|
+
name: "eqn-data",
|
|
852
|
+
values: ["new", "updated"],
|
|
853
|
+
defaultValue: "new"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
name: "element-status",
|
|
857
|
+
values: ["added", "changed"],
|
|
858
|
+
defaultValue: "added"
|
|
859
|
+
}
|
|
860
|
+
],
|
|
861
|
+
allowedChildTagNames: [{ tagName: MATHPHRASE_TAG, required: true }]
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
// src/schema/shared/allowedMathChildren.ts
|
|
865
|
+
var MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN = [
|
|
866
|
+
{ tagName: MERROR_TAG, required: false },
|
|
867
|
+
{ tagName: MFRAC_TAG, required: false },
|
|
868
|
+
{ tagName: MI_TAG, required: false },
|
|
869
|
+
{ tagName: MMULTISCRIPTS_TAG, required: false },
|
|
870
|
+
{ tagName: MN_TAG, required: false },
|
|
871
|
+
{ tagName: MO_TAG, required: false },
|
|
872
|
+
{ tagName: MOVER_TAG, required: false },
|
|
873
|
+
{ tagName: MPADDED_TAG, required: false },
|
|
874
|
+
{ tagName: MPHANTOM_TAG, required: false },
|
|
875
|
+
{ tagName: MPRESCRIPTS_TAG, required: false },
|
|
876
|
+
{ tagName: MROOT_TAG, required: false },
|
|
877
|
+
{ tagName: MROW_TAG, required: false },
|
|
878
|
+
{ tagName: MS_TAG, required: false },
|
|
879
|
+
{ tagName: MSPACE_TAG, required: false },
|
|
880
|
+
{ tagName: MSQRT_TAG, required: false },
|
|
881
|
+
{ tagName: MSTYLE_TAG, required: false },
|
|
882
|
+
{ tagName: MSUB_TAG, required: false },
|
|
883
|
+
{ tagName: MSUBSUP_TAG, required: false },
|
|
884
|
+
{ tagName: MSUP_TAG, required: false },
|
|
885
|
+
{ tagName: MTABLE_TAG, required: false },
|
|
886
|
+
{ tagName: MTD_TAG, required: false },
|
|
887
|
+
{ tagName: MTEXT_TAG, required: false },
|
|
888
|
+
{ tagName: MTR_TAG, required: false },
|
|
889
|
+
{ tagName: MUNDER_TAG, required: false },
|
|
890
|
+
{ tagName: MUNDEROVER_TAG, required: false }
|
|
891
|
+
];
|
|
892
|
+
|
|
893
|
+
// src/schema/elementSchemas/elements/equation/math.ts
|
|
894
|
+
var MATH_SCHEMA = createSchema({
|
|
895
|
+
code: "math",
|
|
896
|
+
kind: "element",
|
|
897
|
+
tag: MATH_TAG,
|
|
898
|
+
requiredAttributes: [],
|
|
899
|
+
optionalAttributes: ["xmlns"],
|
|
900
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN],
|
|
901
|
+
canBeWrappedByInsertOrDelete: true
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
// src/schema/elementSchemas/elements/equation/merror.ts
|
|
905
|
+
var MERROR_SCHEMA = createSchema({
|
|
906
|
+
code: "merror",
|
|
907
|
+
kind: "element",
|
|
908
|
+
tag: MERROR_TAG,
|
|
909
|
+
requiredAttributes: [],
|
|
910
|
+
optionalAttributes: [],
|
|
911
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
// src/schema/elementSchemas/elements/equation/mfrac.ts
|
|
915
|
+
var MFRAC_SCHEMA = createSchema({
|
|
916
|
+
code: "mfrac",
|
|
917
|
+
kind: "element",
|
|
918
|
+
tag: MFRAC_TAG,
|
|
919
|
+
requiredAttributes: [],
|
|
920
|
+
optionalAttributes: ["denomalign", "linethickness", "numalign"],
|
|
921
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
// src/schema/elementSchemas/elements/equation/mi.ts
|
|
925
|
+
var MI_SCHEMA = createSchema({
|
|
926
|
+
code: "mi",
|
|
927
|
+
kind: "element",
|
|
928
|
+
tag: MI_TAG,
|
|
929
|
+
requiredAttributes: [],
|
|
930
|
+
optionalAttributes: ["mathvariant"],
|
|
931
|
+
allowedChildTagNames: []
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
// src/schema/elementSchemas/elements/equation/mmultiscripts.ts
|
|
935
|
+
var MMULTISCRIPTS_SCHEMA = createSchema({
|
|
936
|
+
code: "mmultiscripts",
|
|
937
|
+
kind: "element",
|
|
938
|
+
tag: MMULTISCRIPTS_TAG,
|
|
939
|
+
requiredAttributes: [],
|
|
940
|
+
optionalAttributes: ["subscriptshift", "superscriptshift"],
|
|
941
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
// src/schema/elementSchemas/elements/equation/mn.ts
|
|
945
|
+
var MN_SCHEMA = createSchema({
|
|
946
|
+
code: "mn",
|
|
947
|
+
kind: "element",
|
|
948
|
+
tag: MN_TAG,
|
|
666
949
|
requiredAttributes: [],
|
|
667
950
|
optionalAttributes: [],
|
|
668
951
|
allowedChildTagNames: []
|
|
669
952
|
});
|
|
670
953
|
|
|
954
|
+
// src/schema/elementSchemas/elements/equation/mo.ts
|
|
955
|
+
var MO_SCHEMA = createSchema({
|
|
956
|
+
code: "mo",
|
|
957
|
+
kind: "element",
|
|
958
|
+
tag: MO_TAG,
|
|
959
|
+
requiredAttributes: [],
|
|
960
|
+
optionalAttributes: [
|
|
961
|
+
"accent",
|
|
962
|
+
"fence",
|
|
963
|
+
"form",
|
|
964
|
+
"largeop",
|
|
965
|
+
"lspace",
|
|
966
|
+
"maxsize",
|
|
967
|
+
"minsize",
|
|
968
|
+
"movablelimits",
|
|
969
|
+
"rspace",
|
|
970
|
+
"separator",
|
|
971
|
+
"stretchy",
|
|
972
|
+
"symmetric"
|
|
973
|
+
],
|
|
974
|
+
allowedChildTagNames: []
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
// src/schema/elementSchemas/elements/equation/mover.ts
|
|
978
|
+
var MOVER_SCHEMA = createSchema({
|
|
979
|
+
code: "mover",
|
|
980
|
+
kind: "element",
|
|
981
|
+
tag: MOVER_TAG,
|
|
982
|
+
requiredAttributes: [],
|
|
983
|
+
optionalAttributes: ["accent"],
|
|
984
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
// src/schema/elementSchemas/elements/equation/mpadded.ts
|
|
988
|
+
var MPADDED_SCHEMA = createSchema({
|
|
989
|
+
code: "mpadded",
|
|
990
|
+
kind: "element",
|
|
991
|
+
tag: MPADDED_TAG,
|
|
992
|
+
requiredAttributes: [],
|
|
993
|
+
optionalAttributes: [
|
|
994
|
+
"depth",
|
|
995
|
+
"height",
|
|
996
|
+
"lspace",
|
|
997
|
+
"voffset",
|
|
998
|
+
"width"
|
|
999
|
+
],
|
|
1000
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
// src/schema/elementSchemas/elements/equation/mphantom.ts
|
|
1004
|
+
var MPHANTOM_SCHEMA = createSchema({
|
|
1005
|
+
code: "mphantom",
|
|
1006
|
+
kind: "element",
|
|
1007
|
+
tag: MPHANTOM_TAG,
|
|
1008
|
+
requiredAttributes: [],
|
|
1009
|
+
optionalAttributes: [],
|
|
1010
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
// src/schema/elementSchemas/elements/equation/mprescripts.ts
|
|
1014
|
+
var MPRESCRIPTS_SCHEMA = createSchema({
|
|
1015
|
+
code: "mprescripts",
|
|
1016
|
+
kind: "element",
|
|
1017
|
+
tag: MPRESCRIPTS_TAG,
|
|
1018
|
+
requiredAttributes: [],
|
|
1019
|
+
optionalAttributes: [],
|
|
1020
|
+
allowedChildTagNames: []
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
// src/schema/elementSchemas/elements/equation/mroot.ts
|
|
1024
|
+
var MROOT_SCHEMA = createSchema({
|
|
1025
|
+
code: "mroot",
|
|
1026
|
+
kind: "element",
|
|
1027
|
+
tag: MROOT_TAG,
|
|
1028
|
+
requiredAttributes: [],
|
|
1029
|
+
optionalAttributes: [],
|
|
1030
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
// src/schema/elementSchemas/elements/equation/mrow.ts
|
|
1034
|
+
var MROW_SCHEMA = createSchema({
|
|
1035
|
+
code: "mrow",
|
|
1036
|
+
kind: "element",
|
|
1037
|
+
tag: MROW_TAG,
|
|
1038
|
+
requiredAttributes: [],
|
|
1039
|
+
optionalAttributes: [],
|
|
1040
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
// src/schema/elementSchemas/elements/equation/ms.ts
|
|
1044
|
+
var MS_SCHEMA = createSchema({
|
|
1045
|
+
code: "ms",
|
|
1046
|
+
kind: "element",
|
|
1047
|
+
tag: MS_TAG,
|
|
1048
|
+
requiredAttributes: [],
|
|
1049
|
+
optionalAttributes: ["lquote", "rquote"],
|
|
1050
|
+
allowedChildTagNames: []
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
// src/schema/elementSchemas/elements/equation/mspace.ts
|
|
1054
|
+
var MSPACE_SCHEMA = createSchema({
|
|
1055
|
+
code: "mspace",
|
|
1056
|
+
kind: "element",
|
|
1057
|
+
tag: MSPACE_TAG,
|
|
1058
|
+
requiredAttributes: [],
|
|
1059
|
+
optionalAttributes: ["depth", "height", "width"],
|
|
1060
|
+
allowedChildTagNames: []
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
// src/schema/elementSchemas/elements/equation/msqrt.ts
|
|
1064
|
+
var MSQRT_SCHEMA = createSchema({
|
|
1065
|
+
code: "msqrt",
|
|
1066
|
+
kind: "element",
|
|
1067
|
+
tag: MSQRT_TAG,
|
|
1068
|
+
requiredAttributes: [],
|
|
1069
|
+
optionalAttributes: [],
|
|
1070
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
// src/schema/elementSchemas/elements/equation/mstyle.ts
|
|
1074
|
+
var MSTYLE_SCHEMA = createSchema({
|
|
1075
|
+
code: "mstyle",
|
|
1076
|
+
kind: "element",
|
|
1077
|
+
tag: MSTYLE_TAG,
|
|
1078
|
+
requiredAttributes: [],
|
|
1079
|
+
optionalAttributes: [
|
|
1080
|
+
"displaystyle",
|
|
1081
|
+
"mathbackground",
|
|
1082
|
+
"mathcolor",
|
|
1083
|
+
"mathsize",
|
|
1084
|
+
"scriptlevel",
|
|
1085
|
+
"scriptminsize",
|
|
1086
|
+
"scriptsizemultiplier"
|
|
1087
|
+
],
|
|
1088
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
// src/schema/elementSchemas/elements/equation/msub.ts
|
|
1092
|
+
var MSUB_SCHEMA = createSchema({
|
|
1093
|
+
code: "msub",
|
|
1094
|
+
kind: "element",
|
|
1095
|
+
tag: MSUB_TAG,
|
|
1096
|
+
requiredAttributes: [],
|
|
1097
|
+
optionalAttributes: ["subscriptshift"],
|
|
1098
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
// src/schema/elementSchemas/elements/equation/msubsup.ts
|
|
1102
|
+
var MSUBSUP_SCHEMA = createSchema({
|
|
1103
|
+
code: "msubsup",
|
|
1104
|
+
kind: "element",
|
|
1105
|
+
tag: MSUBSUP_TAG,
|
|
1106
|
+
requiredAttributes: [],
|
|
1107
|
+
optionalAttributes: ["subscriptshift", "superscriptshift"],
|
|
1108
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
// src/schema/elementSchemas/elements/equation/msup.ts
|
|
1112
|
+
var MSUP_SCHEMA = createSchema({
|
|
1113
|
+
code: "msup",
|
|
1114
|
+
kind: "element",
|
|
1115
|
+
tag: MSUP_TAG,
|
|
1116
|
+
requiredAttributes: [],
|
|
1117
|
+
optionalAttributes: ["superscriptshift"],
|
|
1118
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1119
|
+
});
|
|
1120
|
+
|
|
1121
|
+
// src/schema/elementSchemas/elements/equation/mtable.ts
|
|
1122
|
+
var MTABLE_SCHEMA = createSchema({
|
|
1123
|
+
code: "mtable",
|
|
1124
|
+
kind: "element",
|
|
1125
|
+
tag: MTABLE_TAG,
|
|
1126
|
+
requiredAttributes: [],
|
|
1127
|
+
optionalAttributes: [
|
|
1128
|
+
"align",
|
|
1129
|
+
"columnalign",
|
|
1130
|
+
"columnlines",
|
|
1131
|
+
"columnspacing",
|
|
1132
|
+
"displaystyle",
|
|
1133
|
+
"equalcolumns",
|
|
1134
|
+
"equalrows",
|
|
1135
|
+
"frame",
|
|
1136
|
+
"rowalign",
|
|
1137
|
+
"rowlines",
|
|
1138
|
+
"rowspacing",
|
|
1139
|
+
"width"
|
|
1140
|
+
],
|
|
1141
|
+
allowedChildTagNames: [{ tagName: MTR_TAG, required: false }]
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
// src/schema/elementSchemas/elements/equation/mtd.ts
|
|
1145
|
+
var MTD_SCHEMA = createSchema({
|
|
1146
|
+
code: "mtd",
|
|
1147
|
+
kind: "element",
|
|
1148
|
+
tag: MTD_TAG,
|
|
1149
|
+
requiredAttributes: [],
|
|
1150
|
+
optionalAttributes: [
|
|
1151
|
+
"columnalign",
|
|
1152
|
+
"columnspan",
|
|
1153
|
+
"rowalign",
|
|
1154
|
+
"rowspan"
|
|
1155
|
+
],
|
|
1156
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
// src/schema/elementSchemas/elements/equation/mtext.ts
|
|
1160
|
+
var MTEXT_SCHEMA = createSchema({
|
|
1161
|
+
code: "mtext",
|
|
1162
|
+
kind: "element",
|
|
1163
|
+
tag: MTEXT_TAG,
|
|
1164
|
+
requiredAttributes: [],
|
|
1165
|
+
optionalAttributes: ["mathvariant"],
|
|
1166
|
+
allowedChildTagNames: []
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
// src/schema/elementSchemas/elements/equation/mtr.ts
|
|
1170
|
+
var MTR_SCHEMA = createSchema({
|
|
1171
|
+
code: "mtr",
|
|
1172
|
+
kind: "element",
|
|
1173
|
+
tag: MTR_TAG,
|
|
1174
|
+
requiredAttributes: [],
|
|
1175
|
+
optionalAttributes: ["columnalign", "rowalign"],
|
|
1176
|
+
allowedChildTagNames: [{ tagName: MTD_TAG, required: false }]
|
|
1177
|
+
});
|
|
1178
|
+
|
|
1179
|
+
// src/schema/elementSchemas/elements/equation/munder.ts
|
|
1180
|
+
var MUNDER_SCHEMA = createSchema({
|
|
1181
|
+
code: "munder",
|
|
1182
|
+
kind: "element",
|
|
1183
|
+
tag: MUNDER_TAG,
|
|
1184
|
+
requiredAttributes: [],
|
|
1185
|
+
optionalAttributes: ["accentunder"],
|
|
1186
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
// src/schema/elementSchemas/elements/equation/munderover.ts
|
|
1190
|
+
var MUNDEROVER_SCHEMA = createSchema({
|
|
1191
|
+
code: "munderover",
|
|
1192
|
+
kind: "element",
|
|
1193
|
+
tag: MUNDEROVER_TAG,
|
|
1194
|
+
requiredAttributes: [],
|
|
1195
|
+
optionalAttributes: ["accent", "accentunder"],
|
|
1196
|
+
allowedChildTagNames: [...MATH_PRESENTATION_TAGS_ALLOWED_CHILDREN]
|
|
1197
|
+
});
|
|
1198
|
+
|
|
671
1199
|
// src/schema/elementSchemas/elements/figure/img.ts
|
|
672
1200
|
var IMG_SCHEMA = createSchema({
|
|
673
1201
|
code: "img",
|
|
@@ -1488,6 +2016,16 @@ var POEM_SCHEMA = createSchema({
|
|
|
1488
2016
|
]
|
|
1489
2017
|
});
|
|
1490
2018
|
|
|
2019
|
+
// src/schema/elementSchemas/elements/equation/mathphrase.ts
|
|
2020
|
+
var MATHPHRASE_SCHEMA = createSchema({
|
|
2021
|
+
code: "mathphrase",
|
|
2022
|
+
kind: "element",
|
|
2023
|
+
tag: MATHPHRASE_TAG,
|
|
2024
|
+
requiredAttributes: [ELE_ID_ATTRIBUTE],
|
|
2025
|
+
optionalAttributes: [],
|
|
2026
|
+
allowedChildTagNames: [{ tagName: MATH_TAG, required: true }]
|
|
2027
|
+
});
|
|
2028
|
+
|
|
1491
2029
|
// src/schema/elementSchemas/elements/index.ts
|
|
1492
2030
|
var ELEMENT_SCHEMAS = {
|
|
1493
2031
|
para: PARA_SCHEMA,
|
|
@@ -1506,6 +2044,33 @@ var ELEMENT_SCHEMAS = {
|
|
|
1506
2044
|
line: LINE_SCHEMA,
|
|
1507
2045
|
speaker: SPEAKER_SCHEMA,
|
|
1508
2046
|
equation: EQUATION_SCHEMA,
|
|
2047
|
+
math: MATH_SCHEMA,
|
|
2048
|
+
mathphrase: MATHPHRASE_SCHEMA,
|
|
2049
|
+
merror: MERROR_SCHEMA,
|
|
2050
|
+
mfrac: MFRAC_SCHEMA,
|
|
2051
|
+
mi: MI_SCHEMA,
|
|
2052
|
+
mmultiscripts: MMULTISCRIPTS_SCHEMA,
|
|
2053
|
+
mn: MN_SCHEMA,
|
|
2054
|
+
mo: MO_SCHEMA,
|
|
2055
|
+
mover: MOVER_SCHEMA,
|
|
2056
|
+
mpadded: MPADDED_SCHEMA,
|
|
2057
|
+
mphantom: MPHANTOM_SCHEMA,
|
|
2058
|
+
mprescripts: MPRESCRIPTS_SCHEMA,
|
|
2059
|
+
mroot: MROOT_SCHEMA,
|
|
2060
|
+
mrow: MROW_SCHEMA,
|
|
2061
|
+
ms: MS_SCHEMA,
|
|
2062
|
+
mspace: MSPACE_SCHEMA,
|
|
2063
|
+
msqrt: MSQRT_SCHEMA,
|
|
2064
|
+
mstyle: MSTYLE_SCHEMA,
|
|
2065
|
+
msub: MSUB_SCHEMA,
|
|
2066
|
+
msubsup: MSUBSUP_SCHEMA,
|
|
2067
|
+
msup: MSUP_SCHEMA,
|
|
2068
|
+
mtable: MTABLE_SCHEMA,
|
|
2069
|
+
mtd: MTD_SCHEMA,
|
|
2070
|
+
mtext: MTEXT_SCHEMA,
|
|
2071
|
+
mtr: MTR_SCHEMA,
|
|
2072
|
+
munder: MUNDER_SCHEMA,
|
|
2073
|
+
munderover: MUNDEROVER_SCHEMA,
|
|
1509
2074
|
img: IMG_SCHEMA,
|
|
1510
2075
|
alttext: ALTTEXT_SCHEMA,
|
|
1511
2076
|
imageobject: IMAGEOBJECT_SCHEMA,
|
|
@@ -1571,8 +2136,20 @@ var INLINEEQUATION_SCHEMA = createSchema({
|
|
|
1571
2136
|
kind: "inline",
|
|
1572
2137
|
tag: INLINEEQUATION_TAG,
|
|
1573
2138
|
requiredAttributes: [...ID_ATTRS],
|
|
1574
|
-
optionalAttributes: [
|
|
1575
|
-
|
|
2139
|
+
optionalAttributes: [
|
|
2140
|
+
...TRACK_CHANGES_ATTRS,
|
|
2141
|
+
{
|
|
2142
|
+
name: "eqn-data",
|
|
2143
|
+
values: ["new", "updated"],
|
|
2144
|
+
defaultValue: "new"
|
|
2145
|
+
},
|
|
2146
|
+
{
|
|
2147
|
+
name: "element-status",
|
|
2148
|
+
values: ["added", "changed"],
|
|
2149
|
+
defaultValue: "added"
|
|
2150
|
+
}
|
|
2151
|
+
],
|
|
2152
|
+
allowedChildTagNames: [{ tagName: MATHPHRASE_TAG, required: true }]
|
|
1576
2153
|
});
|
|
1577
2154
|
|
|
1578
2155
|
// src/schema/elementSchemas/inlineElements/link.ts
|
|
@@ -1653,20 +2230,21 @@ var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute) |
|
|
|
1653
2230
|
var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
|
|
1654
2231
|
var findSchemaByCode = (code) => SCHEMAS[code];
|
|
1655
2232
|
var findSchemaByElement = (element) => {
|
|
2233
|
+
const tagName = element.tagName.toUpperCase();
|
|
1656
2234
|
const isInsertion = element.classList.contains("ins");
|
|
1657
2235
|
const isDeletion = element.classList.contains("del");
|
|
1658
2236
|
const isQueryComment = element.classList.contains("cmtQurySection");
|
|
1659
2237
|
const role = element.getAttribute("role");
|
|
1660
|
-
if (isQueryComment) {
|
|
2238
|
+
if (isQueryComment && tagName === SPAN_TAG) {
|
|
1661
2239
|
return findSchemaByCode("commentQuerySection");
|
|
1662
2240
|
}
|
|
1663
|
-
if (isInsertion) {
|
|
2241
|
+
if (isInsertion && tagName === SPAN_TAG) {
|
|
1664
2242
|
return findSchemaByCode("insertion");
|
|
1665
2243
|
}
|
|
1666
|
-
if (isDeletion) {
|
|
2244
|
+
if (isDeletion && tagName === SPAN_TAG) {
|
|
1667
2245
|
return findSchemaByCode("deletion");
|
|
1668
2246
|
}
|
|
1669
|
-
if (role) {
|
|
2247
|
+
if (role && tagName === SECTION_TAG) {
|
|
1670
2248
|
if (role.startsWith("H")) {
|
|
1671
2249
|
return findSchemaByCode("heading");
|
|
1672
2250
|
}
|