wikiparser-node 1.11.1 → 1.12.0-b

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.
Files changed (175) hide show
  1. package/bundle/bundle.min.js +37 -0
  2. package/config/default.json +28 -28
  3. package/config/enwiki.json +14 -827
  4. package/config/llwiki.json +20 -54
  5. package/config/minimum.json +1 -1
  6. package/config/moegirl.json +20 -63
  7. package/config/zhwiki.json +27 -492
  8. package/extensions/dist/base.js +162 -0
  9. package/extensions/dist/codejar.js +52 -0
  10. package/extensions/dist/editor.js +159 -0
  11. package/extensions/dist/highlight.js +30 -0
  12. package/extensions/dist/lint.js +72 -0
  13. package/extensions/editor.css +59 -0
  14. package/extensions/ui.css +159 -0
  15. package/package.json +29 -21
  16. package/config/.schema.json +0 -186
  17. package/dist/addon/table.js +0 -486
  18. package/dist/addon/token.js +0 -304
  19. package/dist/addon/transclude.js +0 -184
  20. package/dist/base.d.ts +0 -81
  21. package/dist/base.js +0 -39
  22. package/dist/index.d.ts +0 -33
  23. package/dist/index.js +0 -235
  24. package/dist/internal.d.ts +0 -46
  25. package/dist/lib/element.d.ts +0 -125
  26. package/dist/lib/element.js +0 -375
  27. package/dist/lib/node.d.ts +0 -173
  28. package/dist/lib/node.js +0 -477
  29. package/dist/lib/range.d.ts +0 -105
  30. package/dist/lib/range.js +0 -406
  31. package/dist/lib/ranges.d.ts +0 -28
  32. package/dist/lib/ranges.js +0 -126
  33. package/dist/lib/rect.d.ts +0 -18
  34. package/dist/lib/rect.js +0 -34
  35. package/dist/lib/text.d.ts +0 -58
  36. package/dist/lib/text.js +0 -400
  37. package/dist/lib/title.d.ts +0 -42
  38. package/dist/lib/title.js +0 -208
  39. package/dist/mixin/attributesParent.d.ts +0 -49
  40. package/dist/mixin/attributesParent.js +0 -79
  41. package/dist/mixin/fixed.d.ts +0 -5
  42. package/dist/mixin/fixed.js +0 -32
  43. package/dist/mixin/flagsParent.d.ts +0 -43
  44. package/dist/mixin/flagsParent.js +0 -64
  45. package/dist/mixin/hidden.d.ts +0 -7
  46. package/dist/mixin/hidden.js +0 -37
  47. package/dist/mixin/magicLinkParent.d.ts +0 -19
  48. package/dist/mixin/magicLinkParent.js +0 -43
  49. package/dist/mixin/singleLine.d.ts +0 -5
  50. package/dist/mixin/singleLine.js +0 -25
  51. package/dist/mixin/sol.d.ts +0 -6
  52. package/dist/mixin/sol.js +0 -45
  53. package/dist/mixin/syntax.d.ts +0 -8
  54. package/dist/mixin/syntax.js +0 -46
  55. package/dist/parser/braces.js +0 -150
  56. package/dist/parser/commentAndExt.js +0 -79
  57. package/dist/parser/converter.js +0 -39
  58. package/dist/parser/externalLinks.js +0 -37
  59. package/dist/parser/hrAndDoubleUnderscore.js +0 -42
  60. package/dist/parser/html.js +0 -38
  61. package/dist/parser/links.js +0 -101
  62. package/dist/parser/list.js +0 -114
  63. package/dist/parser/magicLinks.js +0 -52
  64. package/dist/parser/quotes.js +0 -67
  65. package/dist/parser/redirect.js +0 -26
  66. package/dist/parser/selector.js +0 -394
  67. package/dist/parser/table.js +0 -123
  68. package/dist/src/arg.d.ts +0 -51
  69. package/dist/src/arg.js +0 -214
  70. package/dist/src/atom.d.ts +0 -14
  71. package/dist/src/atom.js +0 -52
  72. package/dist/src/attribute.d.ts +0 -64
  73. package/dist/src/attribute.js +0 -480
  74. package/dist/src/attributes.d.ts +0 -101
  75. package/dist/src/attributes.js +0 -381
  76. package/dist/src/converter.d.ts +0 -28
  77. package/dist/src/converter.js +0 -148
  78. package/dist/src/converterFlags.d.ts +0 -80
  79. package/dist/src/converterFlags.js +0 -239
  80. package/dist/src/converterRule.d.ts +0 -71
  81. package/dist/src/converterRule.js +0 -216
  82. package/dist/src/extLink.d.ts +0 -36
  83. package/dist/src/extLink.js +0 -218
  84. package/dist/src/gallery.d.ts +0 -47
  85. package/dist/src/gallery.js +0 -143
  86. package/dist/src/heading.d.ts +0 -40
  87. package/dist/src/heading.js +0 -192
  88. package/dist/src/hidden.d.ts +0 -9
  89. package/dist/src/hidden.js +0 -80
  90. package/dist/src/html.d.ts +0 -61
  91. package/dist/src/html.js +0 -343
  92. package/dist/src/imageParameter.d.ts +0 -60
  93. package/dist/src/imageParameter.js +0 -260
  94. package/dist/src/imagemap.d.ts +0 -47
  95. package/dist/src/imagemap.js +0 -146
  96. package/dist/src/imagemapLink.d.ts +0 -31
  97. package/dist/src/imagemapLink.js +0 -97
  98. package/dist/src/index.d.ts +0 -136
  99. package/dist/src/index.js +0 -834
  100. package/dist/src/link/base.d.ts +0 -52
  101. package/dist/src/link/base.js +0 -256
  102. package/dist/src/link/category.d.ts +0 -22
  103. package/dist/src/link/category.js +0 -34
  104. package/dist/src/link/file.d.ts +0 -102
  105. package/dist/src/link/file.js +0 -333
  106. package/dist/src/link/galleryImage.d.ts +0 -29
  107. package/dist/src/link/galleryImage.js +0 -132
  108. package/dist/src/link/index.d.ts +0 -39
  109. package/dist/src/link/index.js +0 -98
  110. package/dist/src/link/redirectTarget.d.ts +0 -27
  111. package/dist/src/link/redirectTarget.js +0 -69
  112. package/dist/src/magicLink.d.ts +0 -58
  113. package/dist/src/magicLink.js +0 -256
  114. package/dist/src/nested.d.ts +0 -40
  115. package/dist/src/nested.js +0 -106
  116. package/dist/src/nowiki/base.d.ts +0 -28
  117. package/dist/src/nowiki/base.js +0 -89
  118. package/dist/src/nowiki/comment.d.ts +0 -14
  119. package/dist/src/nowiki/comment.js +0 -121
  120. package/dist/src/nowiki/dd.d.ts +0 -8
  121. package/dist/src/nowiki/dd.js +0 -72
  122. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -15
  123. package/dist/src/nowiki/doubleUnderscore.js +0 -97
  124. package/dist/src/nowiki/hr.d.ts +0 -5
  125. package/dist/src/nowiki/hr.js +0 -70
  126. package/dist/src/nowiki/index.d.ts +0 -14
  127. package/dist/src/nowiki/index.js +0 -28
  128. package/dist/src/nowiki/list.d.ts +0 -5
  129. package/dist/src/nowiki/list.js +0 -65
  130. package/dist/src/nowiki/listBase.d.ts +0 -23
  131. package/dist/src/nowiki/listBase.js +0 -99
  132. package/dist/src/nowiki/noinclude.d.ts +0 -6
  133. package/dist/src/nowiki/noinclude.js +0 -75
  134. package/dist/src/nowiki/quote.d.ts +0 -14
  135. package/dist/src/nowiki/quote.js +0 -140
  136. package/dist/src/onlyinclude.d.ts +0 -13
  137. package/dist/src/onlyinclude.js +0 -58
  138. package/dist/src/paramTag/index.d.ts +0 -28
  139. package/dist/src/paramTag/index.js +0 -78
  140. package/dist/src/paramTag/inputbox.d.ts +0 -8
  141. package/dist/src/paramTag/inputbox.js +0 -22
  142. package/dist/src/parameter.d.ts +0 -60
  143. package/dist/src/parameter.js +0 -264
  144. package/dist/src/pre.d.ts +0 -28
  145. package/dist/src/pre.js +0 -60
  146. package/dist/src/redirect.d.ts +0 -30
  147. package/dist/src/redirect.js +0 -126
  148. package/dist/src/syntax.d.ts +0 -17
  149. package/dist/src/syntax.js +0 -87
  150. package/dist/src/table/base.d.ts +0 -28
  151. package/dist/src/table/base.js +0 -81
  152. package/dist/src/table/index.d.ts +0 -230
  153. package/dist/src/table/index.js +0 -506
  154. package/dist/src/table/td.d.ts +0 -72
  155. package/dist/src/table/td.js +0 -370
  156. package/dist/src/table/tr.d.ts +0 -30
  157. package/dist/src/table/tr.js +0 -59
  158. package/dist/src/table/trBase.d.ts +0 -49
  159. package/dist/src/table/trBase.js +0 -164
  160. package/dist/src/tagPair/ext.d.ts +0 -29
  161. package/dist/src/tagPair/ext.js +0 -220
  162. package/dist/src/tagPair/include.d.ts +0 -33
  163. package/dist/src/tagPair/include.js +0 -130
  164. package/dist/src/tagPair/index.d.ts +0 -23
  165. package/dist/src/tagPair/index.js +0 -128
  166. package/dist/src/transclude.d.ts +0 -159
  167. package/dist/src/transclude.js +0 -587
  168. package/dist/util/constants.js +0 -25
  169. package/dist/util/debug.js +0 -95
  170. package/dist/util/diff.js +0 -83
  171. package/dist/util/html.js +0 -143
  172. package/dist/util/lint.js +0 -32
  173. package/dist/util/string.js +0 -87
  174. package/errors/README +0 -3
  175. package/printed/README +0 -3
@@ -659,32 +659,32 @@
659
659
  ]
660
660
  ],
661
661
  "doubleUnderscore": [
662
- [
663
- "forcetoc",
664
- "强显目录",
665
- "強制目錄",
666
- "nocc",
667
- "nocontentconvert",
668
- "不转换内容",
669
- "不轉換內容",
670
- "noeditsection",
671
- "无段落编辑",
672
- "无编辑段落",
673
- "無段落編輯",
674
- "nogallery",
675
- "无图库",
676
- "無圖庫",
677
- "notc",
678
- "notitleconvert",
679
- "不转换标题",
680
- "不轉換標題",
681
- "notoc",
682
- "无目录",
683
- "無目錄",
684
- "toc",
685
- "目录",
686
- "目錄"
687
- ],
662
+ {
663
+ "forcetoc": "forcetoc",
664
+ "强显目录": "forcetoc",
665
+ "強制目錄": "forcetoc",
666
+ "nocc": "nocontentconvert",
667
+ "nocontentconvert": "nocontentconvert",
668
+ "不转换内容": "nocontentconvert",
669
+ "不轉換內容": "nocontentconvert",
670
+ "noeditsection": "noeditsection",
671
+ "无段落编辑": "noeditsection",
672
+ "无编辑段落": "noeditsection",
673
+ "無段落編輯": "noeditsection",
674
+ "nogallery": "nogallery",
675
+ "无图库": "nogallery",
676
+ "無圖庫": "nogallery",
677
+ "notc": "notitleconvert",
678
+ "notitleconvert": "notitleconvert",
679
+ "不转换标题": "notitleconvert",
680
+ "不轉換標題": "notitleconvert",
681
+ "notoc": "notoc",
682
+ "无目录": "notoc",
683
+ "無目錄": "notoc",
684
+ "toc": "toc",
685
+ "目录": "toc",
686
+ "目錄": "toc"
687
+ },
688
688
  [
689
689
  "EXPECTUNUSEDCATEGORY",
690
690
  "DISAMBIG",
@@ -708,472 +708,7 @@
708
708
  ]
709
709
  ],
710
710
  "protocol": "bitcoin:|ftp://|ftps://|geo:|git://|gopher://|http://|https://|irc://|ircs://|magnet:|mailto:|matrix:|mms://|news:|nntp://|redis://|sftp://|sip:|sips:|sms:|ssh://|svn://|tel:|telnet://|urn:|worldwind://|xmpp:",
711
- "interwiki": [
712
- "acronym",
713
- "advisory",
714
- "advogato",
715
- "aew",
716
- "appropedia",
717
- "aquariumwiki",
718
- "arborwiki",
719
- "arxiv",
720
- "baden",
721
- "battlestarwiki",
722
- "bcnbio",
723
- "beacha",
724
- "betawiki",
725
- "bibcode",
726
- "bibliowiki",
727
- "bluwiki",
728
- "botwiki",
729
- "boxrec",
730
- "bugzilla",
731
- "bulba",
732
- "c",
733
- "c2",
734
- "c2find",
735
- "cache",
736
- "ĉej",
737
- "centralwikia",
738
- "chej",
739
- "choralwiki",
740
- "citizendium",
741
- "comixpedia",
742
- "commons",
743
- "communityscheme",
744
- "communitywiki",
745
- "comune",
746
- "creativecommons",
747
- "creativecommonswiki",
748
- "cxej",
749
- "dcc",
750
- "dcdatabase",
751
- "dcma",
752
- "debian",
753
- "delicious",
754
- "devmo",
755
- "dico",
756
- "dicoado",
757
- "dictionary",
758
- "dict",
759
- "disinfopedia",
760
- "distributedproofreaders",
761
- "distributedproofreadersca",
762
- "dmoz",
763
- "dmozs",
764
- "doi",
765
- "donate",
766
- "doom_wiki",
767
- "download",
768
- "dbdump",
769
- "dpd",
770
- "dpla",
771
- "drae",
772
- "dreamhost",
773
- "drumcorpswiki",
774
- "dwjwiki",
775
- "ecoreality",
776
- "elibre",
777
- "emacswiki",
778
- "encyc",
779
- "energiewiki",
780
- "englyphwiki",
781
- "enkol",
782
- "eokulturcentro",
783
- "esolang",
784
- "etherpad",
785
- "ethnologue",
786
- "ethnologuefamily",
787
- "evowiki",
788
- "exotica",
789
- "fanimutationwiki",
790
- "fedora",
791
- "finalfantasy",
792
- "finnix",
793
- "flickruser",
794
- "flickrphoto",
795
- "floralwiki",
796
- "foldoc",
797
- "foundation",
798
- "foundationsite",
799
- "foxwiki",
800
- "freebio",
801
- "freebsdman",
802
- "freeculturewiki",
803
- "freedomdefined",
804
- "freefeel",
805
- "freekiwiki",
806
- "freenode",
807
- "freesoft",
808
- "ganfyd",
809
- "gardenology",
810
- "gausswiki",
811
- "gentoo",
812
- "genwiki",
813
- "gerrit",
814
- "git",
815
- "gitlab",
816
- "globalcontribs",
817
- "glottolog",
818
- "glottopedia",
819
- "google",
820
- "googledefine",
821
- "googlegroups",
822
- "guildwarswiki",
823
- "guildwiki",
824
- "gucprefix",
825
- "gutenberg",
826
- "gutenbergwiki",
827
- "hackerspaces",
828
- "h2wiki",
829
- "hammondwiki",
830
- "hdl",
831
- "heraldik",
832
- "horizonlabs",
833
- "hrwiki",
834
- "hrfwiki",
835
- "hupwiki",
836
- "iarchive",
837
- "imdbname",
838
- "imdbtitle",
839
- "imdbcompany",
840
- "imdbcharacter",
841
- "incubator",
842
- "infosecpedia",
843
- "infosphere",
844
- "irc",
845
- "ircs",
846
- "ircrc",
847
- "rcirc",
848
- "iso639-3",
849
- "issn",
850
- "iuridictum",
851
- "jaglyphwiki",
852
- "jefo",
853
- "jerseydatabase",
854
- "jira",
855
- "jspwiki",
856
- "jstor",
857
- "kamelo",
858
- "karlsruhe",
859
- "kinowiki",
860
- "komicawiki",
861
- "kontuwiki",
862
- "lexemes",
863
- "liberachat",
864
- "libreplanet",
865
- "lingualibre",
866
- "linguistlist",
867
- "linuxwiki",
868
- "linuxwikide",
869
- "listarchive",
870
- "liswiki",
871
- "literateprograms",
872
- "livepedia",
873
- "localwiki",
874
- "lojban",
875
- "lokalhistoriewiki",
876
- "lostpedia",
877
- "lqwiki",
878
- "luxo",
879
- "mail",
880
- "mailarchive",
881
- "mariowiki",
882
- "marveldatabase",
883
- "meatball",
884
- "mw",
885
- "mediazilla",
886
- "memoryalpha",
887
- "metawiki",
888
- "metawikimedia",
889
- "metawikipedia",
890
- "mineralienatlas",
891
- "mixnmatch",
892
- "moinmoin",
893
- "monstropedia",
894
- "mosapedia",
895
- "mozcom",
896
- "mozillawiki",
897
- "mozillazinekb",
898
- "musicbrainz",
899
- "mediawikiwiki",
900
- "mwod",
901
- "mwot",
902
- "nkcells",
903
- "nlab",
904
- "nara",
905
- "nosmoke",
906
- "nost",
907
- "nostalgia",
908
- "oeis",
909
- "oldwikisource",
910
- "olpc",
911
- "omegawiki",
912
- "onelook",
913
- "openlibrary",
914
- "openstreetmap",
915
- "openwetware",
916
- "opera7wiki",
917
- "organicdesign",
918
- "orthodoxwiki",
919
- "osmwiki",
920
- "otrs",
921
- "otrswiki",
922
- "ourmedia",
923
- "outreach",
924
- "outreachwiki",
925
- "owasp",
926
- "panawiki",
927
- "patwiki",
928
- "paws",
929
- "personaltelco",
930
- "petscan",
931
- "phab",
932
- "phabricator",
933
- "phwiki",
934
- "phpwiki",
935
- "planetmath",
936
- "pmeg",
937
- "pmid",
938
- "pokewiki",
939
- "pokéwiki",
940
- "policy",
941
- "proofwiki",
942
- "pyrev",
943
- "pythoninfo",
944
- "pythonwiki",
945
- "pywiki",
946
- "quality",
947
- "quarry",
948
- "regiowiki",
949
- "rev",
950
- "revo",
951
- "rfc",
952
- "rheinneckar",
953
- "robowiki",
954
- "rodovid",
955
- "rowiki",
956
- "rt",
957
- "s23wiki",
958
- "scholar",
959
- "schoolswp",
960
- "scores",
961
- "scoutwiki",
962
- "scramble",
963
- "seapig",
964
- "seattlewiki",
965
- "slwiki",
966
- "semantic-mw",
967
- "senseislibrary",
968
- "sep11",
969
- "sharemap",
970
- "silcode",
971
- "slashdot",
972
- "sourceforge",
973
- "spcom",
974
- "species",
975
- "squeak",
976
- "stats",
977
- "stewardry",
978
- "strategy",
979
- "strategywiki",
980
- "sulutil",
981
- "swtrain",
982
- "svn",
983
- "swinbrain",
984
- "tabwiki",
985
- "tclerswiki",
986
- "technorati",
987
- "tenwiki",
988
- "testwiki",
989
- "testwikidata",
990
- "test2wiki",
991
- "tfwiki",
992
- "thelemapedia",
993
- "theopedia",
994
- "thinkwiki",
995
- "ticket",
996
- "tmbw",
997
- "tmnet",
998
- "tmwiki",
999
- "toolforge",
1000
- "toollabs",
1001
- "tools",
1002
- "tswiki",
1003
- "translatewiki",
1004
- "tviv",
1005
- "tvtropes",
1006
- "twiki",
1007
- "twl",
1008
- "tyvawiki",
1009
- "umap",
1010
- "uncyclopedia",
1011
- "unihan",
1012
- "unreal",
1013
- "urbandict",
1014
- "usej",
1015
- "usemod",
1016
- "usability",
1017
- "utrs",
1018
- "vikidia",
1019
- "viaf",
1020
- "vlos",
1021
- "vkol",
1022
- "votewiki",
1023
- "vrtwiki",
1024
- "vrts",
1025
- "weirdgloop",
1026
- "werelate",
1027
- "wg",
1028
- "wikia",
1029
- "wikiasite",
1030
- "wikiapiary",
1031
- "wikibooks",
1032
- "wikichristian",
1033
- "wikicities",
1034
- "wikicity",
1035
- "wikiconference",
1036
- "wikidata",
1037
- "wikiedudashboard",
1038
- "wikif1",
1039
- "wikifur",
1040
- "wikihow",
1041
- "wikiindex",
1042
- "wikilemon",
1043
- "wikilivres",
1044
- "wikilivresru",
1045
- "wikimac-de",
1046
- "wikimedia",
1047
- "wikinews",
1048
- "wikinfo",
1049
- "wikinvest",
1050
- "wikiotics",
1051
- "wikipapers",
1052
- "wikipedia",
1053
- "wikipediawikipedia",
1054
- "wikiquote",
1055
- "wikisophia",
1056
- "wikisource",
1057
- "wikisp",
1058
- "wikispecies",
1059
- "wikispot",
1060
- "wikiskripta",
1061
- "wikitech",
1062
- "labsconsole",
1063
- "wikiti",
1064
- "wikiversity",
1065
- "wikivoyage",
1066
- "betawikiversity",
1067
- "wikiwikiweb",
1068
- "wiktionary",
1069
- "wlug",
1070
- "wmam",
1071
- "wmar",
1072
- "wmat",
1073
- "wmau",
1074
- "wmbd",
1075
- "wmbe",
1076
- "wmbr",
1077
- "wmca",
1078
- "wmch",
1079
- "wmcl",
1080
- "wmcn",
1081
- "wmco",
1082
- "wmcz",
1083
- "wmcz_docs",
1084
- "wmcz_old",
1085
- "wmdc",
1086
- "securewikidc",
1087
- "wmde",
1088
- "wmdk",
1089
- "wmee",
1090
- "wmec",
1091
- "wmes",
1092
- "wmet",
1093
- "wmfdashboard",
1094
- "wmfi",
1095
- "wmfr",
1096
- "wmge",
1097
- "wmhi",
1098
- "wmhk",
1099
- "wmhu",
1100
- "wmid",
1101
- "wmil",
1102
- "wmin",
1103
- "wmit",
1104
- "wmke",
1105
- "wmmk",
1106
- "wmmx",
1107
- "wmnl",
1108
- "wmnyc",
1109
- "wmno",
1110
- "wmpa-us",
1111
- "wmph",
1112
- "wmpl",
1113
- "wmplsite",
1114
- "wmpt",
1115
- "wmpunjabi",
1116
- "wmromd",
1117
- "wmrs",
1118
- "wmru",
1119
- "wmse",
1120
- "wmsk",
1121
- "wmtr",
1122
- "wmtw",
1123
- "wmua",
1124
- "wmuk",
1125
- "wmve",
1126
- "wmza",
1127
- "wm2005",
1128
- "wm2006",
1129
- "wm2007",
1130
- "wm2008",
1131
- "wm2009",
1132
- "wm2010",
1133
- "wm2011",
1134
- "wm2012",
1135
- "wm2013",
1136
- "wm2014",
1137
- "wm2015",
1138
- "wm2016",
1139
- "wm2017",
1140
- "wm2018",
1141
- "wmania",
1142
- "wikimania",
1143
- "wikispore",
1144
- "wmteam",
1145
- "wmf",
1146
- "wmfblog",
1147
- "wmdeblog",
1148
- "wookieepedia",
1149
- "wowwiki",
1150
- "wqy",
1151
- "wurmpedia",
1152
- "xtools",
1153
- "zrhwiki",
1154
- "zum",
1155
- "zwiki",
1156
- "m",
1157
- "meta",
1158
- "d",
1159
- "cz",
1160
- "dk",
1161
- "epo",
1162
- "jp",
1163
- "minnan",
1164
- "zh-cfr",
1165
- "cmn",
1166
- "en-simple",
1167
- "w",
1168
- "wikt",
1169
- "q",
1170
- "b",
1171
- "n",
1172
- "s",
1173
- "chapter",
1174
- "v",
1175
- "voy"
1176
- ],
711
+ "interwiki": [],
1177
712
  "img": {
1178
713
  "thumbnail": "thumbnail",
1179
714
  "thumb": "thumbnail",
@@ -0,0 +1,162 @@
1
+ (() => {
2
+ const workerJS = () => {
3
+ importScripts('https://testingcf.jsdelivr.net/npm/wikiparser-node@1.12.0-b/bundle/bundle.min.js');
4
+ const entities = { '&': 'amp', '<': 'lt', '>': 'gt' };
5
+ self.onmessage = ({ data }) => {
6
+ const [command, qid, wikitext, include, stage] = data;
7
+ switch (command) {
8
+ case 'setI18N':
9
+ Parser.i18n = qid;
10
+ break;
11
+ case 'setConfig':
12
+ Parser.config = qid;
13
+ break;
14
+ case 'getConfig':
15
+ postMessage([qid, Parser.getConfig()]);
16
+ break;
17
+ case 'json':
18
+ postMessage([qid, Parser.parse(wikitext, include).json()]);
19
+ break;
20
+ case 'lint':
21
+ postMessage([qid, Parser.parse(wikitext, include).lint(), wikitext]);
22
+ break;
23
+ case 'print':
24
+ postMessage([
25
+ qid,
26
+ Parser.parse(wikitext, include, stage).childNodes.map(child => [
27
+ stage !== null && stage !== void 0 ? stage : Infinity,
28
+ String(child),
29
+ child.type === 'text'
30
+ ? String(child).replace(/[&<>]/gu, p => `&${entities[p]};`)
31
+ : child.print(),
32
+ ]),
33
+ ]);
34
+ }
35
+ };
36
+ };
37
+ const blob = new Blob([`(${String(workerJS)})()`], { type: 'text/javascript' }), url = URL.createObjectURL(blob), worker = new Worker(url);
38
+ URL.revokeObjectURL(url);
39
+ const getListener = (qid, resolve, raw) => {
40
+ const listener = ({ data: [rid, res, resRaw] }) => {
41
+ if (rid === qid && (raw === undefined || raw === resRaw)) {
42
+ worker.removeEventListener('message', listener);
43
+ resolve(res);
44
+ }
45
+ };
46
+ return listener;
47
+ };
48
+ const setI18N = (i18n) => {
49
+ worker.postMessage(['setI18N', i18n]);
50
+ };
51
+ const setConfig = (config) => {
52
+ worker.postMessage(['setConfig', config]);
53
+ };
54
+ const getFeedback = (command, qid, strict, raw, ...args) => new Promise(resolve => {
55
+ worker.addEventListener('message', getListener(qid, resolve, strict ? raw : undefined));
56
+ worker.postMessage([command, qid, raw, ...args]);
57
+ });
58
+ const getConfig = () => getFeedback('getConfig', -3);
59
+ const json = (wikitext, include, qid = -4) => getFeedback('json', qid, false, wikitext, include);
60
+ const print = (wikitext, include, stage, qid = -1) => getFeedback('print', qid, false, wikitext, include, stage);
61
+ const lint = (wikitext, include, qid = -2) => getFeedback('lint', qid, true, wikitext, include);
62
+ const append = (parent, text) => {
63
+ if (text) {
64
+ parent.append(text);
65
+ }
66
+ };
67
+ const splitNewLine = (html) => {
68
+ let cur = html.cloneNode();
69
+ cur.style.padding = '';
70
+ const result = [cur];
71
+ for (const child of html.childNodes) {
72
+ const { textContent } = child;
73
+ if (!(textContent === null || textContent === void 0 ? void 0 : textContent.includes('\n'))) {
74
+ cur.append(child.cloneNode(true));
75
+ continue;
76
+ }
77
+ const lines = child.nodeType === Node.TEXT_NODE ? textContent.split('\n') : splitNewLine(child);
78
+ append(cur, lines[0]);
79
+ for (const text of lines.slice(1)) {
80
+ cur = html.cloneNode();
81
+ cur.style.padding = '';
82
+ result.push(cur);
83
+ append(cur, text);
84
+ }
85
+ }
86
+ return result;
87
+ };
88
+ const getGutter = (container) => container.querySelector('.wikiparser-line-numbers');
89
+ const size = (html) => {
90
+ const container = html.parentElement, gutter = getGutter(container);
91
+ if (!gutter) {
92
+ intersectionObserver.unobserve(html);
93
+ return;
94
+ }
95
+ html.style.marginLeft = '';
96
+ const start = Number(html.dataset['start'] || 1), lines = splitNewLine(html), width = `${String(lines.length + start - 1).length + 1.5}ch`;
97
+ html.style.marginLeft = width;
98
+ gutter.style.width = width;
99
+ const sizer = document.createElement('span'), { style: { paddingLeft, paddingRight } } = html;
100
+ sizer.className = 'wikiparser-sizer';
101
+ sizer.style.paddingLeft = paddingLeft;
102
+ sizer.style.paddingRight = paddingRight;
103
+ for (const child of lines) {
104
+ sizer.append(child, '\n');
105
+ }
106
+ html.append(sizer);
107
+ let line, lastTop;
108
+ for (let i = 0; i < lines.length; i++) {
109
+ const child = lines[i], { top } = child.getBoundingClientRect();
110
+ if (line) {
111
+ line.style.height = `${top - lastTop}px`;
112
+ }
113
+ line = document.createElement('span');
114
+ line.textContent = String(i + start);
115
+ gutter.append(line);
116
+ lastTop = top;
117
+ }
118
+ if (line) {
119
+ const noScroll = html.offsetHeight <= container.clientHeight;
120
+ if (html.isContentEditable) {
121
+ line.style.height = `${container.clientHeight}px`;
122
+ }
123
+ else if (noScroll) {
124
+ line.style.height = `${container.getBoundingClientRect().top + container.scrollHeight - lastTop}px`;
125
+ container.style.overflowY = 'hidden';
126
+ }
127
+ else {
128
+ line.style.height = `${html.getBoundingClientRect().bottom - lastTop}px`;
129
+ container.style.overflowY = '';
130
+ }
131
+ }
132
+ sizer.remove();
133
+ intersectionObserver.unobserve(html);
134
+ };
135
+ const intersectionObserver = new IntersectionObserver(entries => {
136
+ for (const entry of entries) {
137
+ if (!entry.isIntersecting) {
138
+ continue;
139
+ }
140
+ size(entry.target);
141
+ }
142
+ });
143
+ const lineNumbers = (html, start = 1, paddingTop = '') => {
144
+ const container = html.parentElement, gutter = document.createElement('span');
145
+ html.dataset['start'] = String(start);
146
+ gutter.className = 'wikiparser-line-numbers';
147
+ gutter.style.paddingTop = paddingTop;
148
+ container.classList.add('wikiparse-container');
149
+ container.append(gutter);
150
+ if (getComputedStyle(html).whiteSpace !== 'pre') {
151
+ html.style.whiteSpace = 'pre-wrap';
152
+ }
153
+ if (html.offsetParent) {
154
+ size(html);
155
+ }
156
+ else {
157
+ intersectionObserver.observe(html);
158
+ }
159
+ };
160
+ const wikiparse = { id: 0, setI18N, setConfig, getConfig, print, lint, json, lineNumbers };
161
+ Object.assign(window, { wikiparse });
162
+ })();