@mark1russell7/text 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/build/error-6yypUDJz.js +37 -0
- package/build/error-6yypUDJz.js.map +1 -0
- package/build/index.js +1 -36
- package/build/plain-text.d.ts +16 -0
- package/build/plain-text.d.ts.map +1 -0
- package/build/plain-text.js +29 -0
- package/build/plain-text.js.map +1 -0
- package/build/print.d.ts +51 -0
- package/build/print.d.ts.map +1 -0
- package/build/print.js +55 -0
- package/build/print.js.map +1 -0
- package/build/references-BFiMj2LL.js +344 -0
- package/build/references-BFiMj2LL.js.map +1 -0
- package/build/references.js +1 -344
- package/package.json +13 -2
- package/src/plain-text.ts +27 -0
- package/src/print.ts +93 -0
- package/build/index.js.map +0 -1
- package/build/references.js.map +0 -1
package/build/references.js
CHANGED
|
@@ -1,344 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This module has the named character references of HTML. The script `scripts/html-references.ts` made it. Do not
|
|
4
|
-
* edit it. Start the script again to make it.
|
|
5
|
-
*
|
|
6
|
-
* The source is the table of the HTML Living Standard, `https://html.spec.whatwg.org/entities.json`. Copyright WHATWG
|
|
7
|
-
* (Apple, Google, Mozilla, Microsoft). The table has the license CC BY 4.0,
|
|
8
|
-
* `https://creativecommons.org/licenses/by/4.0/`. The SHA-256 of the source file is
|
|
9
|
-
* `d741d877ac77c4194c4ad526b5b4a19aef8dfe411ab840a466891cdbb9f362e6`.
|
|
10
|
-
*
|
|
11
|
-
* The script changed the format of the table, not its content. The source has 2231 names. 106 of them are
|
|
12
|
-
* legacy names, which are in the source with a semicolon and with no semicolon.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* The names and the values of the named character references. The names with one value make one group. A comma or a
|
|
16
|
-
* line end comes between two groups. Each group has these parts:
|
|
17
|
-
*
|
|
18
|
-
* - the first code point of the value, as the difference from the first code point of the group before it,
|
|
19
|
-
* - a plus sign and the second code point, only for a value with two code points,
|
|
20
|
-
* - an equals sign and the names of the group, with a space between two names.
|
|
21
|
-
*
|
|
22
|
-
* Each number is in base 36. A name has no ampersand and no semicolon. A star after a name tells that the name is also
|
|
23
|
-
* correct with no semicolon. The groups are in the order of their values. The longest name has 31 characters, and the
|
|
24
|
-
* longest legacy name has 6 characters.
|
|
25
|
-
*/
|
|
26
|
-
const NAMED_REFERENCES = `9=Tab,1=NewLine,n=excl,1=QUOT* quot*,1=num,1=dollar,1=percnt,1=AMP* amp*,1=apos,1=lpar,1=rpar,1=ast midast,1=plus
|
|
27
|
-
1=comma,2=period,1=sol,b=colon,1=semi,1=LT* lt*,0+6he=nvlt,1=equals,0+6hx=bne,1=GT* gt*,0+6he=nvgt,1=quest,1=commat
|
|
28
|
-
r=lbrack lsqb,1=bsol,1=rbrack rsqb,1=Hat,1=UnderBar lowbar,1=DiacriticalGrave grave,6+2y=fjlig,l=lbrace lcub
|
|
29
|
-
1=VerticalLine verbar vert,1=rbrace rcub,z=NonBreakingSpace nbsp*,1=iexcl*,1=cent*,1=pound*,1=curren*,1=yen*
|
|
30
|
-
1=brvbar*,1=sect*,1=Dot DoubleDot die uml*,1=COPY* copy*,1=ordf*,1=laquo*,1=not*,1=shy*,1=REG* circledR reg*
|
|
31
|
-
1=macr* strns,1=deg*,1=PlusMinus plusmn* pm,1=sup2*,1=sup3*,1=DiacriticalAcute acute*,1=micro*,1=para*
|
|
32
|
-
1=CenterDot centerdot middot*,1=Cedilla cedil*,1=sup1*,1=ordm*,1=raquo*,1=frac14*,1=frac12* half,1=frac34*,1=iquest*
|
|
33
|
-
1=Agrave*,1=Aacute*,1=Acirc*,1=Atilde*,1=Auml*,1=Aring* angst,1=AElig*,1=Ccedil*,1=Egrave*,1=Eacute*,1=Ecirc*
|
|
34
|
-
1=Euml*,1=Igrave*,1=Iacute*,1=Icirc*,1=Iuml*,1=ETH*,1=Ntilde*,1=Ograve*,1=Oacute*,1=Ocirc*,1=Otilde*,1=Ouml*
|
|
35
|
-
1=times*,1=Oslash*,1=Ugrave*,1=Uacute*,1=Ucirc*,1=Uuml*,1=Yacute*,1=THORN*,1=szlig*,1=agrave*,1=aacute*,1=acirc*
|
|
36
|
-
1=atilde*,1=auml*,1=aring*,1=aelig*,1=ccedil*,1=egrave*,1=eacute*,1=ecirc*,1=euml*,1=igrave*,1=iacute*,1=icirc*
|
|
37
|
-
1=iuml*,1=eth*,1=ntilde*,1=ograve*,1=oacute*,1=ocirc*,1=otilde*,1=ouml*,1=div divide*,1=oslash*,1=ugrave*,1=uacute*
|
|
38
|
-
1=ucirc*,1=uuml*,1=yacute*,1=thorn*,1=yuml*,1=Amacr,1=amacr,1=Abreve,1=abreve,1=Aogon,1=aogon,1=Cacute,1=cacute
|
|
39
|
-
1=Ccirc,1=ccirc,1=Cdot,1=cdot,1=Ccaron,1=ccaron,1=Dcaron,1=dcaron,1=Dstrok,1=dstrok,1=Emacr,1=emacr,3=Edot,1=edot
|
|
40
|
-
1=Eogon,1=eogon,1=Ecaron,1=ecaron,1=Gcirc,1=gcirc,1=Gbreve,1=gbreve,1=Gdot,1=gdot,1=Gcedil,2=Hcirc,1=hcirc,1=Hstrok
|
|
41
|
-
1=hstrok,1=Itilde,1=itilde,1=Imacr,1=imacr,3=Iogon,1=iogon,1=Idot,1=imath inodot,1=IJlig,1=ijlig,1=Jcirc,1=jcirc
|
|
42
|
-
1=Kcedil,1=kcedil,1=kgreen,1=Lacute,1=lacute,1=Lcedil,1=lcedil,1=Lcaron,1=lcaron,1=Lmidot,1=lmidot,1=Lstrok,1=lstrok
|
|
43
|
-
1=Nacute,1=nacute,1=Ncedil,1=ncedil,1=Ncaron,1=ncaron,1=napos,1=ENG,1=eng,1=Omacr,1=omacr,3=Odblac,1=odblac,1=OElig
|
|
44
|
-
1=oelig,1=Racute,1=racute,1=Rcedil,1=rcedil,1=Rcaron,1=rcaron,1=Sacute,1=sacute,1=Scirc,1=scirc,1=Scedil,1=scedil
|
|
45
|
-
1=Scaron,1=scaron,1=Tcedil,1=tcedil,1=Tcaron,1=tcaron,1=Tstrok,1=tstrok,1=Utilde,1=utilde,1=Umacr,1=umacr,1=Ubreve
|
|
46
|
-
1=ubreve,1=Uring,1=uring,1=Udblac,1=udblac,1=Uogon,1=uogon,1=Wcirc,1=wcirc,1=Ycirc,1=ycirc,1=Yuml,1=Zacute,1=zacute
|
|
47
|
-
1=Zdot,1=zdot,1=Zcaron,1=zcaron,k=fnof,z=imped,1s=gacute,1u=jmath,3z=circ,1=Hacek caron,h=Breve breve
|
|
48
|
-
1=DiacriticalDot dot,1=ring,1=ogon,1=DiacriticalTilde tilde,1=DiacriticalDoubleAcute dblac,1g=DownBreve,3k=Alpha
|
|
49
|
-
1=Beta,1=Gamma,1=Delta,1=Epsilon,1=Zeta,1=Eta,1=Theta,1=Iota,1=Kappa,1=Lambda,1=Mu,1=Nu,1=Xi,1=Omicron,1=Pi,1=Rho
|
|
50
|
-
2=Sigma,1=Tau,1=Upsilon,1=Phi,1=Chi,1=Psi,1=Omega ohm,8=alpha,1=beta,1=gamma,1=delta,1=epsi epsilon,1=zeta,1=eta
|
|
51
|
-
1=theta,1=iota,1=kappa,1=lambda,1=mu,1=nu,1=xi,1=omicron,1=pi,1=rho,1=sigmaf sigmav varsigma,1=sigma,1=tau
|
|
52
|
-
1=upsi upsilon,1=phi,1=chi,1=psi,1=omega,8=thetasym thetav vartheta,1=Upsi upsih,3=phiv straightphi varphi
|
|
53
|
-
1=piv varpi,6=Gammad,1=digamma gammad,j=kappav varkappa,1=rhov varrho,4=epsiv straightepsilon varepsilon
|
|
54
|
-
1=backepsilon bepsi,b=IOcy,1=DJcy,1=GJcy,1=Jukcy,1=DScy,1=Iukcy,1=YIcy,1=Jsercy,1=LJcy,1=NJcy,1=TSHcy,1=KJcy,2=Ubrcy
|
|
55
|
-
1=DZcy,1=Acy,1=Bcy,1=Vcy,1=Gcy,1=Dcy,1=IEcy,1=ZHcy,1=Zcy,1=Icy,1=Jcy,1=Kcy,1=Lcy,1=Mcy,1=Ncy,1=Ocy,1=Pcy,1=Rcy,1=Scy
|
|
56
|
-
1=Tcy,1=Ucy,1=Fcy,1=KHcy,1=TScy,1=CHcy,1=SHcy,1=SHCHcy,1=HARDcy,1=Ycy,1=SOFTcy,1=Ecy,1=YUcy,1=YAcy,1=acy,1=bcy,1=vcy
|
|
57
|
-
1=gcy,1=dcy,1=iecy,1=zhcy,1=zcy,1=icy,1=jcy,1=kcy,1=lcy,1=mcy,1=ncy,1=ocy,1=pcy,1=rcy,1=scy,1=tcy,1=ucy,1=fcy,1=khcy
|
|
58
|
-
1=tscy,1=chcy,1=shcy,1=shchcy,1=hardcy,1=ycy,1=softcy,1=ecy,1=yucy,1=yacy,2=iocy,1=djcy,1=gjcy,1=jukcy,1=dscy
|
|
59
|
-
1=iukcy,1=yicy,1=jsercy,1=ljcy,1=njcy,1=tshcy,1=kjcy,2=ubrcy,1=dzcy,5gj=ensp,1=emsp,1=emsp13,1=emsp14,2=numsp
|
|
60
|
-
1=puncsp,1=ThinSpace thinsp,1=VeryThinSpace hairsp
|
|
61
|
-
1=NegativeMediumSpace NegativeThickSpace NegativeThinSpace NegativeVeryThinSpace ZeroWidthSpace,1=zwnj,1=zwj,1=lrm
|
|
62
|
-
1=rlm,1=dash hyphen,3=ndash,1=mdash,1=horbar,1=Verbar Vert,2=OpenCurlyQuote lsquo,1=CloseCurlyQuote rsquo rsquor
|
|
63
|
-
1=lsquor sbquo,2=OpenCurlyDoubleQuote ldquo,1=CloseCurlyDoubleQuote rdquo rdquor,1=bdquo ldquor,2=dagger
|
|
64
|
-
1=Dagger ddagger,1=bull bullet,3=nldr,1=hellip mldr,a=permil,1=pertenk,1=prime,1=Prime,1=tprime,1=backprime bprime
|
|
65
|
-
4=lsaquo,1=rsaquo,4=OverBar oline,3=caret,2=hybull,1=frasl,b=bsemi,8=qprime,8=MediumSpace,0+6bu=ThickSpace,1=NoBreak
|
|
66
|
-
1=ApplyFunction af,1=InvisibleTimes it,1=InvisibleComma ic,21=euro,1b=TripleDot tdot,1=DotDot,12=Copf complexes
|
|
67
|
-
3=incare,5=gscr,1=HilbertSpace Hscr hamilt,1=Hfr Poincareplane,1=Hopf quaternions,1=planckh
|
|
68
|
-
1=hbar hslash planck plankv,1=Iscr imagline,1=Ifr Im image imagpart,1=Laplacetrf Lscr lagran,1=ell,2=Nopf naturals
|
|
69
|
-
1=numero,1=copysr,1=weierp wp,1=Popf primes,1=Qopf rationals,1=Rscr realine,1=Re Rfr real realpart,1=Ropf reals,1=rx
|
|
70
|
-
4=TRADE trade,2=Zopf integers,3=mho,1=Zfr zeetrf,1=iiota,3=Bernoullis Bscr bernou,1=Cayleys Cfr,2=escr
|
|
71
|
-
1=Escr expectation,1=Fouriertrf Fscr,2=Mellintrf Mscr phmmat,1=order orderof oscr,1=alefsym aleph,1=beth,1=gimel
|
|
72
|
-
1=daleth,d=CapitalDifferentialD DD,1=DifferentialD dd,1=ExponentialE ee exponentiale,1=ImaginaryI ii,b=frac13
|
|
73
|
-
1=frac23,1=frac15,1=frac25,1=frac35,1=frac45,1=frac16,1=frac56,1=frac18,1=frac38,1=frac58,1=frac78
|
|
74
|
-
1e=LeftArrow ShortLeftArrow larr leftarrow slarr,1=ShortUpArrow UpArrow uarr uparrow
|
|
75
|
-
1=RightArrow ShortRightArrow rarr rightarrow srarr,1=DownArrow ShortDownArrow darr downarrow
|
|
76
|
-
1=LeftRightArrow harr leftrightarrow,1=UpDownArrow updownarrow varr,1=UpperLeftArrow nwarr nwarrow
|
|
77
|
-
1=UpperRightArrow nearr nearrow,1=LowerRightArrow searr searrow,1=LowerLeftArrow swarr swarrow,1=nlarr nleftarrow
|
|
78
|
-
1=nrarr nrightarrow,2=rarrw rightsquigarrow,0+mw=nrarrw,1=Larr twoheadleftarrow,1=Uarr,1=Rarr twoheadrightarrow
|
|
79
|
-
1=Darr,1=larrtl leftarrowtail,1=rarrtl rightarrowtail,1=LeftTeeArrow mapstoleft,1=UpTeeArrow mapstoup
|
|
80
|
-
1=RightTeeArrow map mapsto,1=DownTeeArrow mapstodown,2=hookleftarrow larrhk,1=hookrightarrow rarrhk
|
|
81
|
-
1=larrlp looparrowleft,1=looparrowright rarrlp,1=harrw leftrightsquigarrow,1=nharr nleftrightarrow,2=Lsh lsh
|
|
82
|
-
1=Rsh rsh,1=ldsh,1=rdsh,2=crarr,1=cularr curvearrowleft,1=curarr curvearrowright,3=circlearrowleft olarr
|
|
83
|
-
1=circlearrowright orarr,1=LeftVector leftharpoonup lharu,1=DownLeftVector leftharpoondown lhard
|
|
84
|
-
1=RightUpVector uharr upharpoonright,1=LeftUpVector uharl upharpoonleft,1=RightVector rharu rightharpoonup
|
|
85
|
-
1=DownRightVector rhard rightharpoondown,1=RightDownVector dharr downharpoonright
|
|
86
|
-
1=LeftDownVector dharl downharpoonleft,1=RightArrowLeftArrow rightleftarrows rlarr,1=UpArrowDownArrow udarr
|
|
87
|
-
1=LeftArrowRightArrow leftrightarrows lrarr,1=leftleftarrows llarr,1=upuparrows uuarr,1=rightrightarrows rrarr
|
|
88
|
-
1=ddarr downdownarrows,1=ReverseEquilibrium leftrightharpoons lrhar,1=Equilibrium rightleftharpoons rlhar
|
|
89
|
-
1=nLeftarrow nlArr,1=nLeftrightarrow nhArr,1=nRightarrow nrArr,1=DoubleLeftArrow Leftarrow lArr
|
|
90
|
-
1=DoubleUpArrow Uparrow uArr,1=DoubleRightArrow Implies Rightarrow rArr,1=DoubleDownArrow Downarrow dArr
|
|
91
|
-
1=DoubleLeftRightArrow Leftrightarrow hArr iff,1=DoubleUpDownArrow Updownarrow vArr,1=nwArr,1=neArr,1=seArr,1=swArr
|
|
92
|
-
1=Lleftarrow lAarr,1=Rrightarrow rAarr,2=zigrarr,7=LeftArrowBar larrb,1=RightArrowBar rarrb,g=DownArrowUpArrow duarr
|
|
93
|
-
8=loarr,1=roarr,1=hoarr,1=ForAll forall,1=comp complement,1=PartialD part,0+mw=npart,1=Exists exist
|
|
94
|
-
1=NotExists nexist nexists,1=empty emptyset emptyv varnothing,2=Del nabla,1=Element in isin isinv
|
|
95
|
-
1=NotElement notin notinva,2=ReverseElement SuchThat ni niv,1=NotReverseElement notni notniva,3=Product prod
|
|
96
|
-
1=Coproduct coprod,1=Sum sum,1=minus,1=MinusPlus mnplus mp,1=dotplus plusdo
|
|
97
|
-
2=Backslash setminus setmn smallsetminus ssetmn,1=lowast,1=SmallCircle compfn,2=Sqrt radic
|
|
98
|
-
3=Proportional prop propto varpropto vprop,1=infin,1=angrt,1=ang angle,0+6he=nang,1=angmsd measuredangle,1=angsph
|
|
99
|
-
1=VerticalBar mid shortmid smid,1=NotVerticalBar nmid nshortmid nsmid
|
|
100
|
-
1=DoubleVerticalBar par parallel shortparallel spar,1=NotDoubleVerticalBar npar nparallel nshortparallel nspar
|
|
101
|
-
1=and wedge,1=or vee,1=cap,0+1e68=caps,1=cup,0+1e68=cups,1=Integral int,1=Int,1=iiint tint
|
|
102
|
-
1=ContourIntegral conint oint,1=Conint DoubleContourIntegral,1=Cconint,1=cwint,1=ClockwiseContourIntegral cwconint
|
|
103
|
-
1=CounterClockwiseContourIntegral awconint,1=Therefore there4 therefore,1=Because becaus because,1=ratio
|
|
104
|
-
1=Colon Proportion,1=dotminus minusd,2=mDDot,1=homtht,1=Tilde sim thicksim thksim,0+6he=nvsim,1=backsim bsim
|
|
105
|
-
0+mp=race,1=ac mstpos,0+mr=acE,1=acd,1=VerticalTilde wr wreath,1=NotTilde nsim,1=EqualTilde eqsim esim
|
|
106
|
-
0+mw=NotEqualTilde nesim,1=TildeEqual sime simeq,1=NotTildeEqual nsime nsimeq,1=TildeFullEqual cong,1=simne
|
|
107
|
-
1=NotTildeFullEqual ncong,1=TildeTilde ap approx asymp thickapprox thkap,1=NotTildeTilde nap napprox,1=ape approxeq
|
|
108
|
-
1=apid,0+mw=napid,1=backcong bcong,1=CupCap asympeq,0+6he=nvap,1=Bumpeq HumpDownHump bump,0+mw=NotHumpDownHump nbump
|
|
109
|
-
1=HumpEqual bumpe bumpeq,0+mw=NotHumpEqual nbumpe,1=DotEqual doteq esdot,0+mw=nedot,1=doteqdot eDot
|
|
110
|
-
1=efDot fallingdotseq,1=erDot risingdotseq,1=Assign colone coloneq,1=ecolon eqcolon,1=ecir eqcirc,1=circeq cire
|
|
111
|
-
2=wedgeq,1=veeeq,2=triangleq trie,3=equest questeq,1=NotEqual ne,1=Congruent equiv,0+6hx=bnequiv
|
|
112
|
-
1=NotCongruent nequiv,2=le leq,0+6he=nvle,1=GreaterEqual ge geq,0+6he=nvge,1=LessFullEqual lE leqq,0+mw=nlE nleqq
|
|
113
|
-
1=GreaterFullEqual gE geqq,0+mw=NotGreaterFullEqual ngE ngeqq,1=lnE lneqq,0+1e68=lvertneqq lvnE,1=gnE gneqq
|
|
114
|
-
0+1e68=gvertneqq gvnE,1=Lt NestedLessLess ll,0+mw=NotLessLess nLtv,0+6he=nLt,1=Gt NestedGreaterGreater gg
|
|
115
|
-
0+mw=NotGreaterGreater nGtv,0+6he=nGt,1=between twixt,1=NotCupCap,1=NotLess nless nlt,1=NotGreater ngt ngtr
|
|
116
|
-
1=NotLessEqual nle nleq,1=NotGreaterEqual nge ngeq,1=LessTilde lesssim lsim,1=GreaterTilde gsim gtrsim
|
|
117
|
-
1=NotLessTilde nlsim,1=NotGreaterTilde ngsim,1=LessGreater lessgtr lg,1=GreaterLess gl gtrless,1=NotLessGreater ntlg
|
|
118
|
-
1=NotGreaterLess ntgl,1=Precedes pr prec,1=Succeeds sc succ,1=PrecedesSlantEqual prcue preccurlyeq
|
|
119
|
-
1=SucceedsSlantEqual sccue succcurlyeq,1=PrecedesTilde precsim prsim,1=SucceedsTilde scsim succsim
|
|
120
|
-
0+mw=NotSucceedsTilde,1=NotPrecedes npr nprec,1=NotSucceeds nsc nsucc,1=sub subset,0+6he=NotSubset nsubset vnsub
|
|
121
|
-
1=Superset sup supset,0+6he=NotSuperset nsupset vnsup,1=nsub,1=nsup,1=SubsetEqual sube subseteq
|
|
122
|
-
1=SupersetEqual supe supseteq,1=NotSubsetEqual nsube nsubseteq,1=NotSupersetEqual nsupe nsupseteq,1=subne subsetneq
|
|
123
|
-
0+1e68=varsubsetneq vsubne,1=supne supsetneq,0+1e68=varsupsetneq vsupne,2=cupdot,1=UnionPlus uplus
|
|
124
|
-
1=SquareSubset sqsub sqsubset,0+mw=NotSquareSubset,1=SquareSuperset sqsup sqsupset,0+mw=NotSquareSuperset
|
|
125
|
-
1=SquareSubsetEqual sqsube sqsubseteq,1=SquareSupersetEqual sqsupe sqsupseteq,1=SquareIntersection sqcap
|
|
126
|
-
0+1e68=sqcaps,1=SquareUnion sqcup,0+1e68=sqcups,1=CirclePlus oplus,1=CircleMinus ominus,1=CircleTimes otimes,1=osol
|
|
127
|
-
1=CircleDot odot,1=circledcirc ocir,1=circledast oast,2=circleddash odash,1=boxplus plusb,1=boxminus minusb
|
|
128
|
-
1=boxtimes timesb,1=dotsquare sdotb,1=RightTee vdash,1=LeftTee dashv,1=DownTee top,1=UpTee bot bottom perp,2=models
|
|
129
|
-
1=DoubleRightTee vDash,1=Vdash,1=Vvdash,1=VDash,1=nvdash,1=nvDash,1=nVdash,1=nVDash,1=prurel
|
|
130
|
-
2=LeftTriangle vartriangleleft vltri,1=RightTriangle vartriangleright vrtri,1=LeftTriangleEqual ltrie trianglelefteq
|
|
131
|
-
0+6he=nvltrie,1=RightTriangleEqual rtrie trianglerighteq,0+6he=nvrtrie,1=origof,1=imof,1=multimap mumap,1=hercon
|
|
132
|
-
1=intcal intercal,1=veebar,2=barvee,1=angrtvb,1=lrtri,1=Wedge bigwedge xwedge,1=Vee bigvee xvee
|
|
133
|
-
1=Intersection bigcap xcap,1=Union bigcup xcup,1=Diamond diam diamond,1=sdot,1=Star sstarf,1=divideontimes divonx
|
|
134
|
-
1=bowtie,1=ltimes,1=rtimes,1=leftthreetimes lthree,1=rightthreetimes rthree,1=backsimeq bsime,1=curlyvee cuvee
|
|
135
|
-
1=curlywedge cuwed,1=Sub Subset,1=Sup Supset,1=Cap,1=Cup,1=fork pitchfork,1=epar,1=lessdot ltdot,1=gtdot gtrdot,1=Ll
|
|
136
|
-
0+mw=nLl,1=Gg ggg,0+mw=nGg,1=LessEqualGreater leg lesseqgtr,0+1e68=lesg,1=GreaterEqualLess gel gtreqless,0+1e68=gesl
|
|
137
|
-
3=cuepr curlyeqprec,1=cuesc curlyeqsucc,1=NotPrecedesSlantEqual nprcue,1=NotSucceedsSlantEqual nsccue
|
|
138
|
-
1=NotSquareSubsetEqual nsqsube,1=NotSquareSupersetEqual nsqsupe,3=lnsim,1=gnsim,1=precnsim prnsim,1=scnsim succnsim
|
|
139
|
-
1=NotLeftTriangle nltri ntriangleleft,1=NotRightTriangle nrtri ntriangleright
|
|
140
|
-
1=NotLeftTriangleEqual nltrie ntrianglelefteq,1=NotRightTriangleEqual nrtrie ntrianglerighteq,1=vellip,1=ctdot
|
|
141
|
-
1=utdot,1=dtdot,1=disin,1=isinsv,1=isins,1=isindot,0+mw=notindot,1=notinvc,1=notinvb,2=isinE,0+mw=notinE,1=nisd
|
|
142
|
-
1=xnis,1=nis,1=notnivc,1=notnivb,7=barwed barwedge,1=Barwed doublebarwedge,2=LeftCeiling lceil,1=RightCeiling rceil
|
|
143
|
-
1=LeftFloor lfloor,1=RightFloor rfloor,1=drcrop,1=dlcrop,1=urcrop,1=ulcrop,1=bnot,2=profline,1=profsurf,2=telrec
|
|
144
|
-
1=target,6=ulcorn ulcorner,1=urcorn urcorner,1=dlcorn llcorner,1=drcorn lrcorner,3=frown sfrown,1=smile ssmile
|
|
145
|
-
a=cylcty,1=profalar,8=topbot,7=ovbar,2=solbar,1p=angzarr,1g=lmoust lmoustache,1=rmoust rmoustache,3=OverBracket tbrk
|
|
146
|
-
1=UnderBracket bbrk,1=bbrktbrk,12=OverParenthesis,1=UnderParenthesis,1=OverBrace,1=UnderBrace,3=trpezium,5=elinters
|
|
147
|
-
1o=blank,4l=circledS oS,1k=HorizontalLine boxh,2=boxv,a=boxdr,4=boxdl,4=boxur,4=boxul,4=boxvr,8=boxvl,8=boxhd
|
|
148
|
-
8=boxhu,8=boxvh,k=boxH,1=boxV,1=boxdR,1=boxDr,1=boxDR,1=boxdL,1=boxDl,1=boxDL,1=boxuR,1=boxUr,1=boxUR,1=boxuL
|
|
149
|
-
1=boxUl,1=boxUL,1=boxvR,1=boxVr,1=boxVR,1=boxvL,1=boxVl,1=boxVL,1=boxHd,1=boxhD,1=boxHD,1=boxHu,1=boxhU,1=boxHU
|
|
150
|
-
1=boxvH,1=boxVh,1=boxVH,k=uhblk,4=lhblk,4=block,9=blk14,1=blk12,1=blk34,e=Square squ square
|
|
151
|
-
9=FilledVerySmallSquare blacksquare squarf squf,1=EmptyVerySmallSquare,2=rect,1=marker,3=fltns,2=bigtriangleup xutri
|
|
152
|
-
1=blacktriangle utrif,1=triangle utri,3=blacktriangleright rtrif,1=rtri triangleright,4=bigtriangledown xdtri
|
|
153
|
-
1=blacktriangledown dtrif,1=dtri triangledown,3=blacktriangleleft ltrif,1=ltri triangleleft,7=loz lozenge,1=cir
|
|
154
|
-
x=tridot,3=bigcirc xcirc,9=ultri,1=urtri,1=lltri,1=EmptySmallSquare,1=FilledSmallSquare,9=bigstar starf,1=star
|
|
155
|
-
8=phone,1e=female,2=male,u=spades spadesuit,3=clubs clubsuit,2=hearts heartsuit,1=diamondsuit diams,4=sung,3=flat
|
|
156
|
-
1=natur natural,1=sharp,4k=check checkmark,4=cross,9=malt maltese,m=sext,y=VerticalSeparator,q=lbbrk,1=rbbrk
|
|
157
|
-
2d=bsolhsub,1=suphsol,t=LeftDoubleBracket lobrk,1=RightDoubleBracket robrk,1=LeftAngleBracket lang langle
|
|
158
|
-
1=RightAngleBracket rang rangle,1=Lang,1=Rang,1=loang,1=roang,8=LongLeftArrow longleftarrow xlarr
|
|
159
|
-
1=LongRightArrow longrightarrow xrarr,1=LongLeftRightArrow longleftrightarrow xharr
|
|
160
|
-
1=DoubleLongLeftArrow Longleftarrow xlArr,1=DoubleLongRightArrow Longrightarrow xrArr
|
|
161
|
-
1=DoubleLongLeftRightArrow Longleftrightarrow xhArr,2=longmapsto xmap,3=dzigrarr,77=nvlArr,1=nvrArr,1=nvHarr,1=Map
|
|
162
|
-
7=lbarr,1=bkarow rbarr,1=lBarr,1=dbkarow rBarr,1=RBarr drbkarow,1=DDotrahd,1=UpArrowBar,1=DownArrowBar,3=Rarrtl
|
|
163
|
-
3=latail,1=ratail,1=lAtail,1=rAtail,1=larrfs,1=rarrfs,1=larrbfs,1=rarrbfs,3=nwarhk,1=nearhk,1=hksearow searhk
|
|
164
|
-
1=hkswarow swarhk,1=nwnear,1=nesear toea,1=seswar tosa,1=swnwar,9=rarrc,0+mw=nrarrc,2=cudarrr,1=ldca,1=rdca
|
|
165
|
-
1=cudarrl,1=larrpl,3=curarrm,1=cularrp,8=rarrpl,3=harrcir,1=Uarrocir,1=lurdshar,1=ldrushar,3=LeftRightVector
|
|
166
|
-
1=RightUpDownVector,1=DownLeftRightVector,1=LeftUpDownVector,1=LeftVectorBar,1=RightVectorBar,1=RightUpVectorBar
|
|
167
|
-
1=RightDownVectorBar,1=DownLeftVectorBar,1=DownRightVectorBar,1=LeftUpVectorBar,1=LeftDownVectorBar,1=LeftTeeVector
|
|
168
|
-
1=RightTeeVector,1=RightUpTeeVector,1=RightDownTeeVector,1=DownLeftTeeVector,1=DownRightTeeVector,1=LeftUpTeeVector
|
|
169
|
-
1=LeftDownTeeVector,1=lHar,1=uHar,1=rHar,1=dHar,1=luruhar,1=ldrdhar,1=ruluhar,1=rdldhar,1=lharul,1=llhard,1=rharul
|
|
170
|
-
1=lrhard,1=UpEquilibrium udhar,1=ReverseUpEquilibrium duhar,1=RoundImplies,1=erarr,1=simrarr,1=larrsim,1=rarrsim
|
|
171
|
-
1=rarrap,1=ltlarr,2=gtrarr,1=subrarr,2=suplarr,1=lfisht,1=rfisht,1=ufisht,1=dfisht,6=lopar,1=ropar,5=lbrke,1=rbrke
|
|
172
|
-
1=lbrkslu,1=rbrksld,1=lbrksld,1=rbrkslu,1=langd,1=rangd,1=lparlt,1=rpargt,1=gtlPar,1=ltrPar,4=vzigzag,2=vangrt
|
|
173
|
-
1=angrtvbd,7=ange,1=range,1=dwangle,1=uwangle,1=angmsdaa,1=angmsdab,1=angmsdac,1=angmsdad,1=angmsdae,1=angmsdaf
|
|
174
|
-
1=angmsdag,1=angmsdah,1=bemptyv,1=demptyv,1=cemptyv,1=raemptyv,1=laemptyv,1=ohbar,1=omid,1=opar,2=operp,2=olcross
|
|
175
|
-
1=odsold,2=olcir,1=ofcir,1=olt,1=ogt,1=cirscir,1=cirE,1=solb,1=bsolb,4=boxbox,4=trisb,1=rtriltri,1=LeftTriangleBar
|
|
176
|
-
0+mw=NotLeftTriangleBar,1=RightTriangleBar,0+mw=NotRightTriangleBar,c=iinfin,1=infintie,1=nvinfin,5=eparsl
|
|
177
|
-
1=smeparsl,1=eqvparsl,6=blacklozenge lozf,9=RuleDelayed,2=dsol,a=bigodot xodot,1=bigoplus xoplus,1=bigotimes xotime
|
|
178
|
-
2=biguplus xuplus,2=bigsqcup xsqcup,6=iiiint qint,1=fpartint,3=cirfnint,1=awint,1=rppolint,1=scpolint,1=npolint
|
|
179
|
-
1=pointint,1=quatint,1=intlarhk,b=pluscir,1=plusacir,1=simplus,1=plusdu,1=plussim,1=plustwo,2=mcomma,1=minusdu
|
|
180
|
-
3=loplus,1=roplus,1=Cross,1=timesd,1=timesbar,2=smashp,1=lotimes,1=rotimes,1=otimesas,1=Otimes,1=odiv,1=triplus
|
|
181
|
-
1=triminus,1=tritime,1=intprod iprod,3=amalg,1=capdot,2=ncup,1=ncap,1=capand,1=cupor,1=cupcap,1=capcup,1=cupbrcap
|
|
182
|
-
1=capbrcup,1=cupcup,1=capcap,1=ccups,1=ccaps,3=ccupssm,3=And,1=Or,1=andand,1=oror,1=orslope,1=andslope,2=andv,1=orv
|
|
183
|
-
1=andd,1=ord,2=wedbar,7=sdote,4=simdot,3=congdot,0+mw=ncongdot,1=easter,1=apacir,1=apE,0+mw=napE,1=eplus,1=pluse
|
|
184
|
-
1=Esim,1=Colone,1=Equal,2=ddotseq eDDot,1=equivDD,1=ltcir,1=gtcir,1=ltquest,1=gtquest,1=LessSlantEqual leqslant les
|
|
185
|
-
0+mw=NotLessSlantEqual nleqslant nles,1=GreaterSlantEqual geqslant ges,0+mw=NotGreaterSlantEqual ngeqslant nges
|
|
186
|
-
1=lesdot,1=gesdot,1=lesdoto,1=gesdoto,1=lesdotor,1=gesdotol,1=lap lessapprox,1=gap gtrapprox,1=lne lneq,1=gne gneq
|
|
187
|
-
1=lnap lnapprox,1=gnap gnapprox,1=lEg lesseqqgtr,1=gEl gtreqqless,1=lsime,1=gsime,1=lsimg,1=gsiml,1=lgE,1=glE
|
|
188
|
-
1=lesges,1=gesles,1=els eqslantless,1=egs eqslantgtr,1=elsdot,1=egsdot,1=el,1=eg,3=siml,1=simg,1=simlE,1=simgE
|
|
189
|
-
1=LessLess,0+mw=NotNestedLessLess,1=GreaterGreater,0+mw=NotNestedGreaterGreater,2=glj,1=gla,1=ltcc,1=gtcc,1=lescc
|
|
190
|
-
1=gescc,1=smt,1=lat,1=smte,0+1e68=smtes,1=late,0+1e68=lates,1=bumpE,1=PrecedesEqual pre preceq
|
|
191
|
-
0+mw=NotPrecedesEqual npre npreceq,1=SucceedsEqual sce succeq,0+mw=NotSucceedsEqual nsce nsucceq,3=prE,1=scE
|
|
192
|
-
1=precneqq prnE,1=scnE succneqq,1=prap precapprox,1=scap succapprox,1=precnapprox prnap,1=scnap succnapprox,1=Pr
|
|
193
|
-
1=Sc,1=subdot,1=supdot,1=subplus,1=supplus,1=submult,1=supmult,1=subedot,1=supedot,1=subE subseteqq
|
|
194
|
-
0+mw=nsubE nsubseteqq,1=supE supseteqq,0+mw=nsupE nsupseteqq,1=subsim,1=supsim,3=subnE subsetneqq
|
|
195
|
-
0+1e68=varsubsetneqq vsubnE,1=supnE supsetneqq,0+1e68=varsupsetneqq vsupnE,3=csub,1=csup,1=csube,1=csupe,1=subsup
|
|
196
|
-
1=supsub,1=subsub,1=supsup,1=suphsub,1=supdsub,1=forkv,1=topfork,1=mlcp,9=Dashv DoubleLeftTee,2=Vdashl,1=Barv,1=vBar
|
|
197
|
-
1=vBarv,2=Vbar,1=Not,1=bNot,1=rnmid,1=cirmid,1=midcir,1=topcir,1=nhpar,1=parsim,a=parsl,0+6hx=nparsl,1537=fflig
|
|
198
|
-
1=filig,1=fllig,1=ffilig,1=ffllig,16zc=Ascr,2=Cscr,1=Dscr,3=Gscr,3=Jscr,1=Kscr,3=Nscr,1=Oscr,1=Pscr,1=Qscr,2=Sscr
|
|
199
|
-
1=Tscr,1=Uscr,1=Vscr,1=Wscr,1=Xscr,1=Yscr,1=Zscr,1=ascr,1=bscr,1=cscr,1=dscr,2=fscr,2=hscr,1=iscr,1=jscr,1=kscr
|
|
200
|
-
1=lscr,1=mscr,1=nscr,2=pscr,1=qscr,1=rscr,1=sscr,1=tscr,1=uscr,1=vscr,1=wscr,1=xscr,1=yscr,1=zscr,1h=Afr,1=Bfr,2=Dfr
|
|
201
|
-
1=Efr,1=Ffr,1=Gfr,3=Jfr,1=Kfr,1=Lfr,1=Mfr,1=Nfr,1=Ofr,1=Pfr,1=Qfr,2=Sfr,1=Tfr,1=Ufr,1=Vfr,1=Wfr,1=Xfr,1=Yfr,2=afr
|
|
202
|
-
1=bfr,1=cfr,1=dfr,1=efr,1=ffr,1=gfr,1=hfr,1=ifr,1=jfr,1=kfr,1=lfr,1=mfr,1=nfr,1=ofr,1=pfr,1=qfr,1=rfr,1=sfr,1=tfr
|
|
203
|
-
1=ufr,1=vfr,1=wfr,1=xfr,1=yfr,1=zfr,1=Aopf,1=Bopf,2=Dopf,1=Eopf,1=Fopf,1=Gopf,2=Iopf,1=Jopf,1=Kopf,1=Lopf,1=Mopf
|
|
204
|
-
2=Oopf,4=Sopf,1=Topf,1=Uopf,1=Vopf,1=Wopf,1=Xopf,1=Yopf,2=aopf,1=bopf,1=copf,1=dopf,1=eopf,1=fopf,1=gopf,1=hopf
|
|
205
|
-
1=iopf,1=jopf,1=kopf,1=lopf,1=mopf,1=nopf,1=oopf,1=popf,1=qopf,1=ropf,1=sopf,1=topf,1=uopf,1=vopf,1=wopf,1=xopf
|
|
206
|
-
1=yopf,1=zopf`;
|
|
207
|
-
// src/references.ts
|
|
208
|
-
/**
|
|
209
|
-
* This module decodes the character references of HTML content, with no DOM. The table of the named references has
|
|
210
|
-
* 2231 names. It is in a separate entry, so a bundle that only scans HTML does not get the table.
|
|
211
|
-
*/
|
|
212
|
-
/**
|
|
213
|
-
* The values of the code points 0x80 to 0x9F in a numeric character reference, from the table of the standard. They are
|
|
214
|
-
* the characters of windows-1252. The five code points that windows-1252 does not have stay as they are.
|
|
215
|
-
*/
|
|
216
|
-
const C1_VALUES = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ";
|
|
217
|
-
/** The value of each named character reference. A name with `;` is a key, and a legacy name is also a key with no `;`. */
|
|
218
|
-
let named;
|
|
219
|
-
/** The length of the longest name, with no `;`. */
|
|
220
|
-
let longestName = 0;
|
|
221
|
-
/** The length of the longest legacy name. */
|
|
222
|
-
let longestLegacy = 0;
|
|
223
|
-
/** This function reads the table of the named character references one time, when the decoder first needs it. */
|
|
224
|
-
function namedReferences() {
|
|
225
|
-
if (named !== void 0) return named;
|
|
226
|
-
const table = /* @__PURE__ */ new Map();
|
|
227
|
-
let point = 0;
|
|
228
|
-
for (const group of NAMED_REFERENCES.split(/[,\n]/)) {
|
|
229
|
-
const equals = group.indexOf("=");
|
|
230
|
-
const [first = "", second] = group.slice(0, equals).split("+");
|
|
231
|
-
point += parseInt(first, 36);
|
|
232
|
-
const value = second === void 0 ? String.fromCodePoint(point) : String.fromCodePoint(point, parseInt(second, 36));
|
|
233
|
-
for (const entry of group.slice(equals + 1).split(" ")) {
|
|
234
|
-
const legacy = entry.endsWith("*");
|
|
235
|
-
const name = legacy ? entry.slice(0, -1) : entry;
|
|
236
|
-
table.set(`${name};`, value);
|
|
237
|
-
longestName = Math.max(longestName, name.length);
|
|
238
|
-
if (legacy) {
|
|
239
|
-
table.set(name, value);
|
|
240
|
-
longestLegacy = Math.max(longestLegacy, name.length);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
named = table;
|
|
245
|
-
return table;
|
|
246
|
-
}
|
|
247
|
-
/** This function tells if a code unit is an ASCII letter or an ASCII digit. */
|
|
248
|
-
const isAlphanumeric = (code) => code >= 48 && code <= 57 || (code | 32) >= 97 && (code | 32) <= 122;
|
|
249
|
-
/** This function gives the value of a code unit as a decimal or a hexadecimal digit, or -1 for a different code unit. */
|
|
250
|
-
function digitOf(code, hex) {
|
|
251
|
-
if (code >= 48 && code <= 57) return code - 48;
|
|
252
|
-
const lower = code | 32;
|
|
253
|
-
return hex && lower >= 97 && lower <= 102 ? lower - 97 + 10 : -1;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* This function reads the numeric character reference at the "&" at `amp`, with the fixes of the standard. It gives
|
|
257
|
-
* undefined when no digit follows "&#" or "&#x".
|
|
258
|
-
*/
|
|
259
|
-
function readNumeric(text, amp) {
|
|
260
|
-
let at = amp + 2;
|
|
261
|
-
const hex = (text.charCodeAt(at) | 32) === 120;
|
|
262
|
-
if (hex) at += 1;
|
|
263
|
-
const start = at;
|
|
264
|
-
let point = 0;
|
|
265
|
-
for (let digit = digitOf(text.charCodeAt(at), hex); digit !== -1; digit = digitOf(text.charCodeAt(at), hex)) {
|
|
266
|
-
point = Math.min(point * (hex ? 16 : 10) + digit, 1114112);
|
|
267
|
-
at += 1;
|
|
268
|
-
}
|
|
269
|
-
if (at === start) return void 0;
|
|
270
|
-
if (text.charCodeAt(at) === 59) at += 1;
|
|
271
|
-
if (point === 0 || point > 1114111 || point >= 55296 && point <= 57343) return {
|
|
272
|
-
value: "�",
|
|
273
|
-
end: at
|
|
274
|
-
};
|
|
275
|
-
if (point >= 128 && point <= 159) return {
|
|
276
|
-
value: C1_VALUES.charAt(point - 128),
|
|
277
|
-
end: at
|
|
278
|
-
};
|
|
279
|
-
return {
|
|
280
|
-
value: String.fromCodePoint(point),
|
|
281
|
-
end: at
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* This function reads the named character reference at the "&" at `amp`. The longest name wins. It gives undefined when
|
|
286
|
-
* no name of the table follows the "&".
|
|
287
|
-
*/
|
|
288
|
-
function readNamed(text, amp) {
|
|
289
|
-
const from = amp + 1;
|
|
290
|
-
if (!isAlphanumeric(text.charCodeAt(from))) return void 0;
|
|
291
|
-
const table = namedReferences();
|
|
292
|
-
let at = from;
|
|
293
|
-
while (at - from <= longestName && isAlphanumeric(text.charCodeAt(at))) at += 1;
|
|
294
|
-
if (text.charCodeAt(at) === 59) {
|
|
295
|
-
const value = table.get(text.slice(from, at + 1));
|
|
296
|
-
if (value !== void 0) return {
|
|
297
|
-
value,
|
|
298
|
-
end: at + 1
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
for (let end = Math.min(at, from + longestLegacy); end > from; end -= 1) {
|
|
302
|
-
const value = table.get(text.slice(from, end));
|
|
303
|
-
if (value !== void 0) return {
|
|
304
|
-
value,
|
|
305
|
-
end
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* This function decodes the character references of a text, as the tokenizer of the HTML Living Standard does in the
|
|
311
|
-
* content of an element. Use it on the `text` of a scan of `scanHtml`.
|
|
312
|
-
*
|
|
313
|
-
* - A named reference gets its value from the table of the standard. The longest name wins.
|
|
314
|
-
* - A legacy name, for example `&` or `¬`, is also correct with no semicolon. Thus `¬it;` gives `¬it;`.
|
|
315
|
-
* - A decimal or hexadecimal reference, for example `’` or `’`, gives its code point. The semicolon is optional.
|
|
316
|
-
* - The value 0, a surrogate and a value above `0x10FFFF` give U+FFFD.
|
|
317
|
-
* - The values `0x80` to `0x9F` give the characters of windows-1252, from the table of the standard.
|
|
318
|
-
* - An ampersand with no reference after it stays as text. The function changes no other character.
|
|
319
|
-
*
|
|
320
|
-
* The function does not throw, and it is linear in the length of the text. The result is not longer than the text.
|
|
321
|
-
*
|
|
322
|
-
* @param text - The text of HTML content, with its character references.
|
|
323
|
-
* @returns The text with the value of each character reference in place of the reference.
|
|
324
|
-
*/
|
|
325
|
-
function decodeReferences(text) {
|
|
326
|
-
let amp = text.indexOf("&");
|
|
327
|
-
if (amp === -1) return text;
|
|
328
|
-
const parts = [];
|
|
329
|
-
let at = 0;
|
|
330
|
-
while (amp !== -1) {
|
|
331
|
-
const reference = text.charCodeAt(amp + 1) === 35 ? readNumeric(text, amp) : readNamed(text, amp);
|
|
332
|
-
if (reference === void 0) amp = text.indexOf("&", amp + 1);
|
|
333
|
-
else {
|
|
334
|
-
parts.push(text.slice(at, amp), reference.value);
|
|
335
|
-
at = reference.end;
|
|
336
|
-
amp = text.indexOf("&", at);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
parts.push(text.slice(at));
|
|
340
|
-
return parts.join("");
|
|
341
|
-
}
|
|
342
|
-
export { decodeReferences };
|
|
343
|
-
|
|
344
|
-
//# sourceMappingURL=references.js.map
|
|
1
|
+
export { t as decodeReferences } from "./references-BFiMj2LL.js";
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/text",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "Plain text helpers: the escapes for HTML, attributes, patterns, Markdown and workflow commands, English word forms (countOf, listOf), a word search (wordSearch), the text of a thrown value (errorMessage), the orders of texts by code units and by code points (compareCodeUnits, compareCodePoints), the removal of secrets (redactSecrets) and the shapes of tokens and of secrets by their context (findSecretShapes, redactSecretShapes, findSecretShapesInValue, CONTEXT_SHAPES, isSecretName), and lengths in code units, code points and graphemes with truncation and padding (textLength, truncate, pad), the marked parts of a text (partsAt, partsOf),
|
|
4
|
+
"version": "0.0.20",
|
|
5
|
+
"description": "Plain text helpers: the escapes for HTML, attributes, patterns, Markdown and workflow commands, English word forms (countOf, listOf), a word search (wordSearch), the text of a thrown value (errorMessage), the orders of texts by code units and by code points (compareCodeUnits, compareCodePoints), the removal of secrets (redactSecrets) and the shapes of tokens and of secrets by their context (findSecretShapes, redactSecretShapes, findSecretShapesInValue, CONTEXT_SHAPES, isSecretName), and lengths in code units, code points and graphemes with truncation and padding (textLength, truncate, pad), the marked parts of a text (partsAt, partsOf), a scan of HTML for its text and its start tags (scanHtml) with the decode of its character references (decodeReferences) and its plain text (plainText), and a printer of lines and tables to streams that the caller gives (createPrinter).",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"text",
|
|
8
8
|
"escape",
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
"pad",
|
|
20
20
|
"grapheme",
|
|
21
21
|
"unicode",
|
|
22
|
+
"cli",
|
|
23
|
+
"print",
|
|
24
|
+
"table",
|
|
22
25
|
"typescript"
|
|
23
26
|
],
|
|
24
27
|
"homepage": "https://github.com/mark1russell7/text#readme",
|
|
@@ -65,6 +68,10 @@
|
|
|
65
68
|
"types": "./build/references.d.ts",
|
|
66
69
|
"default": "./build/references.js"
|
|
67
70
|
},
|
|
71
|
+
"./plain-text": {
|
|
72
|
+
"types": "./build/plain-text.d.ts",
|
|
73
|
+
"default": "./build/plain-text.js"
|
|
74
|
+
},
|
|
68
75
|
"./english": {
|
|
69
76
|
"types": "./build/english.d.ts",
|
|
70
77
|
"default": "./build/english.js"
|
|
@@ -81,6 +88,10 @@
|
|
|
81
88
|
"types": "./build/shell.d.ts",
|
|
82
89
|
"default": "./build/shell.js"
|
|
83
90
|
},
|
|
91
|
+
"./print": {
|
|
92
|
+
"types": "./build/print.d.ts",
|
|
93
|
+
"default": "./build/print.js"
|
|
94
|
+
},
|
|
84
95
|
"./package.json": "./package.json"
|
|
85
96
|
},
|
|
86
97
|
"files": [
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plain text of a part of HTML: the entry `@mark1russell7/text/plain-text`. It is `scanHtml` of `./html`, then
|
|
3
|
+
* `decodeReferences` of `./references`. It is its own entry, so `./references` does not get the scanner.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { scanHtml } from "./html.ts";
|
|
7
|
+
import { decodeReferences } from "./references.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This function gives the plain text of a part of HTML, for a summary or a pattern. It is `scanHtml`, then `decodeReferences`.
|
|
11
|
+
*
|
|
12
|
+
* - The scan removes the tags, and it skips scripts, styles and templates.
|
|
13
|
+
* - Each tag gives one space, as in `scanHtml`. Thus `<b>3</b>,` gives `3 ,`, and two words in two elements stay two words.
|
|
14
|
+
* - Each character reference gives its value. A reference to `<` gives text, not a tag.
|
|
15
|
+
* - Each run of white space becomes one space, and the text has no space at its start or its end.
|
|
16
|
+
* - `undefined`, and a text that is empty after these steps, give `undefined`.
|
|
17
|
+
*
|
|
18
|
+
* The function does not throw, and it is linear in the length of the HTML. The result is not safe HTML: escape it before a page shows it.
|
|
19
|
+
*
|
|
20
|
+
* @param html - The HTML, or `undefined` for a field that is not there.
|
|
21
|
+
* @returns The plain text, or `undefined` when it is empty.
|
|
22
|
+
*/
|
|
23
|
+
export function plainText(html: string | undefined): string | undefined {
|
|
24
|
+
if (html === undefined) return undefined;
|
|
25
|
+
const text = decodeReferences(scanHtml(html).text).replace(/\s+/g, " ").trim();
|
|
26
|
+
return text === "" ? undefined : text;
|
|
27
|
+
}
|
package/src/print.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry `@mark1russell7/text/print`: the printer of the output of a command-line tool for a person. It writes lines,
|
|
3
|
+
* tables, status lines and the text of a thrown value to streams that the caller gives. Thus the entry imports no `node:`
|
|
4
|
+
* module, and a test gives a buffer in place of a stream.
|
|
5
|
+
*
|
|
6
|
+
* The printer is for output that a person reads: the text, the tables and the status lines of a CLI. A diagnostic of a
|
|
7
|
+
* library or a service (a warning, a debug line, a caught error) is not output. It goes to a log record with its trace
|
|
8
|
+
* context, through the logger of OpenTelemetry, and not to a printer.
|
|
9
|
+
*/
|
|
10
|
+
import { errorMessage } from "./error.ts";
|
|
11
|
+
import { pad, textLength } from "./length.ts";
|
|
12
|
+
import { redactSecretShapes, redactSecrets, type Secret } from "./redact.ts";
|
|
13
|
+
|
|
14
|
+
/** A stream of text, for example `process.stdout`. The printer uses only its `write`. */
|
|
15
|
+
export interface TextSink {
|
|
16
|
+
write(text: string): unknown;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The options of `createPrinter`. */
|
|
20
|
+
export interface PrinterOptions {
|
|
21
|
+
/** The stream of the output, for example `process.stdout`. */
|
|
22
|
+
readonly out: TextSink;
|
|
23
|
+
/** The stream of the errors and warnings, for example `process.stderr`. The default is `out`. */
|
|
24
|
+
readonly err?: TextSink;
|
|
25
|
+
/** The known secrets, for example the tokens of the command. The printer puts a mark in place of each before a write. */
|
|
26
|
+
readonly secrets?: readonly Secret[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The side of a column of a table. `end` aligns the cells at the right, for numbers. */
|
|
30
|
+
export type ColumnAlign = "start" | "end";
|
|
31
|
+
|
|
32
|
+
/** The options of `Printer.table`. */
|
|
33
|
+
export interface TableOptions {
|
|
34
|
+
/** The head of each column. The printer writes it as the first row. */
|
|
35
|
+
readonly head?: readonly string[];
|
|
36
|
+
/** The side of each column. The default is `start` for each column. */
|
|
37
|
+
readonly align?: readonly ColumnAlign[];
|
|
38
|
+
/** The text between two columns. The default is two spaces. */
|
|
39
|
+
readonly gap?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The state of a status line. */
|
|
43
|
+
export type StatusState = "ok" | "fail" | "warn" | "info";
|
|
44
|
+
|
|
45
|
+
/** A printer of the output of a command-line tool. */
|
|
46
|
+
export interface Printer {
|
|
47
|
+
/** This function writes a line to `out`. No text gives an empty line. */
|
|
48
|
+
line(text?: string): void;
|
|
49
|
+
/** This function writes a table to `out`. A cell is any value, and `String` gives its text. */
|
|
50
|
+
table(rows: readonly (readonly unknown[])[], options?: TableOptions): void;
|
|
51
|
+
/** This function writes a status line to `out`, for example `FAIL build: 2 errors`. The state `fail` goes to `err`. */
|
|
52
|
+
status(state: StatusState, text: string): void;
|
|
53
|
+
/** This function writes a warning line to `err`. */
|
|
54
|
+
warn(text: string): void;
|
|
55
|
+
/** This function writes the text of a thrown value to `err`. It does not throw. A `context` comes before the text. */
|
|
56
|
+
error(error: unknown, context?: string): void;
|
|
57
|
+
/** This function writes a value as JSON with two spaces, to `out`. It throws as `JSON.stringify` does, for a bigint or a cycle. */
|
|
58
|
+
json(value: unknown): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const MARKS: Readonly<Record<StatusState, string>> = { ok: "OK ", fail: "FAIL", warn: "WARN", info: "INFO" };
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This function makes a printer that writes to the streams of `options`. Each write puts a mark in place of each known
|
|
65
|
+
* secret and of each shape of a token (`redactSecretShapes`), and ends with a new line.
|
|
66
|
+
*
|
|
67
|
+
* @param options - The streams and the known secrets.
|
|
68
|
+
* @returns The printer.
|
|
69
|
+
*/
|
|
70
|
+
export function createPrinter(options: PrinterOptions): Printer {
|
|
71
|
+
const { out, err = out, secrets = [] } = options;
|
|
72
|
+
const write = (sink: TextSink, text: string): void => {
|
|
73
|
+
sink.write(`${redactSecretShapes(secrets.length > 0 ? redactSecrets(text, secrets) : text)}\n`);
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
line: (text = "") => write(out, text),
|
|
77
|
+
table: (rows, table = {}) => {
|
|
78
|
+
const { head, align = [], gap = " " } = table;
|
|
79
|
+
const cells = [...(head ? [head] : []), ...rows].map((row) => row.map((cell) => String(cell ?? "")));
|
|
80
|
+
const widths: number[] = [];
|
|
81
|
+
for (const row of cells) row.forEach((cell, at) => (widths[at] = Math.max(widths[at] ?? 0, textLength(cell, "grapheme"))));
|
|
82
|
+
for (const row of cells) {
|
|
83
|
+
const parts = row.map((cell, at) => pad(cell, widths[at] ?? 0, { unit: "grapheme", side: align[at] === "end" ? "start" : "end" }));
|
|
84
|
+
// A line has no spaces at its end, also after an empty last cell.
|
|
85
|
+
write(out, parts.join(gap).trimEnd());
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
status: (state, text) => write(state === "fail" ? err : out, `${MARKS[state]} ${text}`),
|
|
89
|
+
warn: (text) => write(err, `warning: ${text}`),
|
|
90
|
+
error: (error, context) => write(err, context === undefined ? errorMessage(error) : `${context}: ${errorMessage(error)}`),
|
|
91
|
+
json: (value) => write(out, JSON.stringify(value, null, 2) ?? String(value)),
|
|
92
|
+
};
|
|
93
|
+
}
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/error.ts"],"sourcesContent":["/**\n * This module has the text of a thrown value.\n */\n\n/**\n * This function gives the text of a thrown value, for a log line or a message on a screen. It does not throw.\n *\n * - An object with a `message` text gives that text. The check reads the field, not `instanceof Error`, so an error\n * from another realm (a `vm` context or an `iframe`) also gives its message.\n * - An `Error` with a `message` that is not a text gives `String(message)`. The brand check of\n * `Object.prototype.toString` finds an `Error` of each realm.\n * - Each other value gives `String(value)`.\n * - When `String` throws, the function gives the tag of `Object.prototype.toString`, for example `[object Object]`.\n * - A revoked `Proxy` gives its `typeof` in brackets: `[object]`.\n *\n * @param error - The thrown value. It can be any value.\n * @returns The text of the value.\n */\nexport function errorMessage(error: unknown): string {\n try {\n if (typeof error === \"object\" && error !== null && \"message\" in error) {\n const message: unknown = error.message;\n if (typeof message === \"string\") return message;\n if (Object.prototype.toString.call(error) === \"[object Error]\") return String(message);\n }\n return String(error);\n } catch {\n // String() throws for an object with no prototype, for a toString that throws and for a message getter that throws.\n try {\n return Object.prototype.toString.call(error);\n } catch {\n // A revoked Proxy throws also here. The operator typeof never throws.\n return `[${typeof error}]`;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,aAAa,OAAwB;CACnD,IAAI;EACF,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa,OAAO;GACrE,MAAM,UAAmB,MAAM;GAC/B,IAAI,OAAO,YAAY,UAAU,OAAO;GACxC,IAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,kBAAkB,OAAO,OAAO,OAAO;EACvF;EACA,OAAO,OAAO,KAAK;CACrB,QAAQ;EAEN,IAAI;GACF,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK;EAC7C,QAAQ;GAEN,OAAO,IAAI,OAAO,MAAM;EAC1B;CACF;AACF"}
|
package/build/references.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","names":[],"sources":["../src/html-references.ts","../src/references.ts"],"sourcesContent":["/**\n * This module has the named character references of HTML. The script `scripts/html-references.ts` made it. Do not\n * edit it. Start the script again to make it.\n *\n * The source is the table of the HTML Living Standard, `https://html.spec.whatwg.org/entities.json`. Copyright WHATWG\n * (Apple, Google, Mozilla, Microsoft). The table has the license CC BY 4.0,\n * `https://creativecommons.org/licenses/by/4.0/`. The SHA-256 of the source file is\n * `d741d877ac77c4194c4ad526b5b4a19aef8dfe411ab840a466891cdbb9f362e6`.\n *\n * The script changed the format of the table, not its content. The source has 2231 names. 106 of them are\n * legacy names, which are in the source with a semicolon and with no semicolon.\n */\n\n/**\n * The names and the values of the named character references. The names with one value make one group. A comma or a\n * line end comes between two groups. Each group has these parts:\n *\n * - the first code point of the value, as the difference from the first code point of the group before it,\n * - a plus sign and the second code point, only for a value with two code points,\n * - an equals sign and the names of the group, with a space between two names.\n *\n * Each number is in base 36. A name has no ampersand and no semicolon. A star after a name tells that the name is also\n * correct with no semicolon. The groups are in the order of their values. The longest name has 31 characters, and the\n * longest legacy name has 6 characters.\n */\nexport const NAMED_REFERENCES: string =\n `9=Tab,1=NewLine,n=excl,1=QUOT* quot*,1=num,1=dollar,1=percnt,1=AMP* amp*,1=apos,1=lpar,1=rpar,1=ast midast,1=plus\n1=comma,2=period,1=sol,b=colon,1=semi,1=LT* lt*,0+6he=nvlt,1=equals,0+6hx=bne,1=GT* gt*,0+6he=nvgt,1=quest,1=commat\nr=lbrack lsqb,1=bsol,1=rbrack rsqb,1=Hat,1=UnderBar lowbar,1=DiacriticalGrave grave,6+2y=fjlig,l=lbrace lcub\n1=VerticalLine verbar vert,1=rbrace rcub,z=NonBreakingSpace nbsp*,1=iexcl*,1=cent*,1=pound*,1=curren*,1=yen*\n1=brvbar*,1=sect*,1=Dot DoubleDot die uml*,1=COPY* copy*,1=ordf*,1=laquo*,1=not*,1=shy*,1=REG* circledR reg*\n1=macr* strns,1=deg*,1=PlusMinus plusmn* pm,1=sup2*,1=sup3*,1=DiacriticalAcute acute*,1=micro*,1=para*\n1=CenterDot centerdot middot*,1=Cedilla cedil*,1=sup1*,1=ordm*,1=raquo*,1=frac14*,1=frac12* half,1=frac34*,1=iquest*\n1=Agrave*,1=Aacute*,1=Acirc*,1=Atilde*,1=Auml*,1=Aring* angst,1=AElig*,1=Ccedil*,1=Egrave*,1=Eacute*,1=Ecirc*\n1=Euml*,1=Igrave*,1=Iacute*,1=Icirc*,1=Iuml*,1=ETH*,1=Ntilde*,1=Ograve*,1=Oacute*,1=Ocirc*,1=Otilde*,1=Ouml*\n1=times*,1=Oslash*,1=Ugrave*,1=Uacute*,1=Ucirc*,1=Uuml*,1=Yacute*,1=THORN*,1=szlig*,1=agrave*,1=aacute*,1=acirc*\n1=atilde*,1=auml*,1=aring*,1=aelig*,1=ccedil*,1=egrave*,1=eacute*,1=ecirc*,1=euml*,1=igrave*,1=iacute*,1=icirc*\n1=iuml*,1=eth*,1=ntilde*,1=ograve*,1=oacute*,1=ocirc*,1=otilde*,1=ouml*,1=div divide*,1=oslash*,1=ugrave*,1=uacute*\n1=ucirc*,1=uuml*,1=yacute*,1=thorn*,1=yuml*,1=Amacr,1=amacr,1=Abreve,1=abreve,1=Aogon,1=aogon,1=Cacute,1=cacute\n1=Ccirc,1=ccirc,1=Cdot,1=cdot,1=Ccaron,1=ccaron,1=Dcaron,1=dcaron,1=Dstrok,1=dstrok,1=Emacr,1=emacr,3=Edot,1=edot\n1=Eogon,1=eogon,1=Ecaron,1=ecaron,1=Gcirc,1=gcirc,1=Gbreve,1=gbreve,1=Gdot,1=gdot,1=Gcedil,2=Hcirc,1=hcirc,1=Hstrok\n1=hstrok,1=Itilde,1=itilde,1=Imacr,1=imacr,3=Iogon,1=iogon,1=Idot,1=imath inodot,1=IJlig,1=ijlig,1=Jcirc,1=jcirc\n1=Kcedil,1=kcedil,1=kgreen,1=Lacute,1=lacute,1=Lcedil,1=lcedil,1=Lcaron,1=lcaron,1=Lmidot,1=lmidot,1=Lstrok,1=lstrok\n1=Nacute,1=nacute,1=Ncedil,1=ncedil,1=Ncaron,1=ncaron,1=napos,1=ENG,1=eng,1=Omacr,1=omacr,3=Odblac,1=odblac,1=OElig\n1=oelig,1=Racute,1=racute,1=Rcedil,1=rcedil,1=Rcaron,1=rcaron,1=Sacute,1=sacute,1=Scirc,1=scirc,1=Scedil,1=scedil\n1=Scaron,1=scaron,1=Tcedil,1=tcedil,1=Tcaron,1=tcaron,1=Tstrok,1=tstrok,1=Utilde,1=utilde,1=Umacr,1=umacr,1=Ubreve\n1=ubreve,1=Uring,1=uring,1=Udblac,1=udblac,1=Uogon,1=uogon,1=Wcirc,1=wcirc,1=Ycirc,1=ycirc,1=Yuml,1=Zacute,1=zacute\n1=Zdot,1=zdot,1=Zcaron,1=zcaron,k=fnof,z=imped,1s=gacute,1u=jmath,3z=circ,1=Hacek caron,h=Breve breve\n1=DiacriticalDot dot,1=ring,1=ogon,1=DiacriticalTilde tilde,1=DiacriticalDoubleAcute dblac,1g=DownBreve,3k=Alpha\n1=Beta,1=Gamma,1=Delta,1=Epsilon,1=Zeta,1=Eta,1=Theta,1=Iota,1=Kappa,1=Lambda,1=Mu,1=Nu,1=Xi,1=Omicron,1=Pi,1=Rho\n2=Sigma,1=Tau,1=Upsilon,1=Phi,1=Chi,1=Psi,1=Omega ohm,8=alpha,1=beta,1=gamma,1=delta,1=epsi epsilon,1=zeta,1=eta\n1=theta,1=iota,1=kappa,1=lambda,1=mu,1=nu,1=xi,1=omicron,1=pi,1=rho,1=sigmaf sigmav varsigma,1=sigma,1=tau\n1=upsi upsilon,1=phi,1=chi,1=psi,1=omega,8=thetasym thetav vartheta,1=Upsi upsih,3=phiv straightphi varphi\n1=piv varpi,6=Gammad,1=digamma gammad,j=kappav varkappa,1=rhov varrho,4=epsiv straightepsilon varepsilon\n1=backepsilon bepsi,b=IOcy,1=DJcy,1=GJcy,1=Jukcy,1=DScy,1=Iukcy,1=YIcy,1=Jsercy,1=LJcy,1=NJcy,1=TSHcy,1=KJcy,2=Ubrcy\n1=DZcy,1=Acy,1=Bcy,1=Vcy,1=Gcy,1=Dcy,1=IEcy,1=ZHcy,1=Zcy,1=Icy,1=Jcy,1=Kcy,1=Lcy,1=Mcy,1=Ncy,1=Ocy,1=Pcy,1=Rcy,1=Scy\n1=Tcy,1=Ucy,1=Fcy,1=KHcy,1=TScy,1=CHcy,1=SHcy,1=SHCHcy,1=HARDcy,1=Ycy,1=SOFTcy,1=Ecy,1=YUcy,1=YAcy,1=acy,1=bcy,1=vcy\n1=gcy,1=dcy,1=iecy,1=zhcy,1=zcy,1=icy,1=jcy,1=kcy,1=lcy,1=mcy,1=ncy,1=ocy,1=pcy,1=rcy,1=scy,1=tcy,1=ucy,1=fcy,1=khcy\n1=tscy,1=chcy,1=shcy,1=shchcy,1=hardcy,1=ycy,1=softcy,1=ecy,1=yucy,1=yacy,2=iocy,1=djcy,1=gjcy,1=jukcy,1=dscy\n1=iukcy,1=yicy,1=jsercy,1=ljcy,1=njcy,1=tshcy,1=kjcy,2=ubrcy,1=dzcy,5gj=ensp,1=emsp,1=emsp13,1=emsp14,2=numsp\n1=puncsp,1=ThinSpace thinsp,1=VeryThinSpace hairsp\n1=NegativeMediumSpace NegativeThickSpace NegativeThinSpace NegativeVeryThinSpace ZeroWidthSpace,1=zwnj,1=zwj,1=lrm\n1=rlm,1=dash hyphen,3=ndash,1=mdash,1=horbar,1=Verbar Vert,2=OpenCurlyQuote lsquo,1=CloseCurlyQuote rsquo rsquor\n1=lsquor sbquo,2=OpenCurlyDoubleQuote ldquo,1=CloseCurlyDoubleQuote rdquo rdquor,1=bdquo ldquor,2=dagger\n1=Dagger ddagger,1=bull bullet,3=nldr,1=hellip mldr,a=permil,1=pertenk,1=prime,1=Prime,1=tprime,1=backprime bprime\n4=lsaquo,1=rsaquo,4=OverBar oline,3=caret,2=hybull,1=frasl,b=bsemi,8=qprime,8=MediumSpace,0+6bu=ThickSpace,1=NoBreak\n1=ApplyFunction af,1=InvisibleTimes it,1=InvisibleComma ic,21=euro,1b=TripleDot tdot,1=DotDot,12=Copf complexes\n3=incare,5=gscr,1=HilbertSpace Hscr hamilt,1=Hfr Poincareplane,1=Hopf quaternions,1=planckh\n1=hbar hslash planck plankv,1=Iscr imagline,1=Ifr Im image imagpart,1=Laplacetrf Lscr lagran,1=ell,2=Nopf naturals\n1=numero,1=copysr,1=weierp wp,1=Popf primes,1=Qopf rationals,1=Rscr realine,1=Re Rfr real realpart,1=Ropf reals,1=rx\n4=TRADE trade,2=Zopf integers,3=mho,1=Zfr zeetrf,1=iiota,3=Bernoullis Bscr bernou,1=Cayleys Cfr,2=escr\n1=Escr expectation,1=Fouriertrf Fscr,2=Mellintrf Mscr phmmat,1=order orderof oscr,1=alefsym aleph,1=beth,1=gimel\n1=daleth,d=CapitalDifferentialD DD,1=DifferentialD dd,1=ExponentialE ee exponentiale,1=ImaginaryI ii,b=frac13\n1=frac23,1=frac15,1=frac25,1=frac35,1=frac45,1=frac16,1=frac56,1=frac18,1=frac38,1=frac58,1=frac78\n1e=LeftArrow ShortLeftArrow larr leftarrow slarr,1=ShortUpArrow UpArrow uarr uparrow\n1=RightArrow ShortRightArrow rarr rightarrow srarr,1=DownArrow ShortDownArrow darr downarrow\n1=LeftRightArrow harr leftrightarrow,1=UpDownArrow updownarrow varr,1=UpperLeftArrow nwarr nwarrow\n1=UpperRightArrow nearr nearrow,1=LowerRightArrow searr searrow,1=LowerLeftArrow swarr swarrow,1=nlarr nleftarrow\n1=nrarr nrightarrow,2=rarrw rightsquigarrow,0+mw=nrarrw,1=Larr twoheadleftarrow,1=Uarr,1=Rarr twoheadrightarrow\n1=Darr,1=larrtl leftarrowtail,1=rarrtl rightarrowtail,1=LeftTeeArrow mapstoleft,1=UpTeeArrow mapstoup\n1=RightTeeArrow map mapsto,1=DownTeeArrow mapstodown,2=hookleftarrow larrhk,1=hookrightarrow rarrhk\n1=larrlp looparrowleft,1=looparrowright rarrlp,1=harrw leftrightsquigarrow,1=nharr nleftrightarrow,2=Lsh lsh\n1=Rsh rsh,1=ldsh,1=rdsh,2=crarr,1=cularr curvearrowleft,1=curarr curvearrowright,3=circlearrowleft olarr\n1=circlearrowright orarr,1=LeftVector leftharpoonup lharu,1=DownLeftVector leftharpoondown lhard\n1=RightUpVector uharr upharpoonright,1=LeftUpVector uharl upharpoonleft,1=RightVector rharu rightharpoonup\n1=DownRightVector rhard rightharpoondown,1=RightDownVector dharr downharpoonright\n1=LeftDownVector dharl downharpoonleft,1=RightArrowLeftArrow rightleftarrows rlarr,1=UpArrowDownArrow udarr\n1=LeftArrowRightArrow leftrightarrows lrarr,1=leftleftarrows llarr,1=upuparrows uuarr,1=rightrightarrows rrarr\n1=ddarr downdownarrows,1=ReverseEquilibrium leftrightharpoons lrhar,1=Equilibrium rightleftharpoons rlhar\n1=nLeftarrow nlArr,1=nLeftrightarrow nhArr,1=nRightarrow nrArr,1=DoubleLeftArrow Leftarrow lArr\n1=DoubleUpArrow Uparrow uArr,1=DoubleRightArrow Implies Rightarrow rArr,1=DoubleDownArrow Downarrow dArr\n1=DoubleLeftRightArrow Leftrightarrow hArr iff,1=DoubleUpDownArrow Updownarrow vArr,1=nwArr,1=neArr,1=seArr,1=swArr\n1=Lleftarrow lAarr,1=Rrightarrow rAarr,2=zigrarr,7=LeftArrowBar larrb,1=RightArrowBar rarrb,g=DownArrowUpArrow duarr\n8=loarr,1=roarr,1=hoarr,1=ForAll forall,1=comp complement,1=PartialD part,0+mw=npart,1=Exists exist\n1=NotExists nexist nexists,1=empty emptyset emptyv varnothing,2=Del nabla,1=Element in isin isinv\n1=NotElement notin notinva,2=ReverseElement SuchThat ni niv,1=NotReverseElement notni notniva,3=Product prod\n1=Coproduct coprod,1=Sum sum,1=minus,1=MinusPlus mnplus mp,1=dotplus plusdo\n2=Backslash setminus setmn smallsetminus ssetmn,1=lowast,1=SmallCircle compfn,2=Sqrt radic\n3=Proportional prop propto varpropto vprop,1=infin,1=angrt,1=ang angle,0+6he=nang,1=angmsd measuredangle,1=angsph\n1=VerticalBar mid shortmid smid,1=NotVerticalBar nmid nshortmid nsmid\n1=DoubleVerticalBar par parallel shortparallel spar,1=NotDoubleVerticalBar npar nparallel nshortparallel nspar\n1=and wedge,1=or vee,1=cap,0+1e68=caps,1=cup,0+1e68=cups,1=Integral int,1=Int,1=iiint tint\n1=ContourIntegral conint oint,1=Conint DoubleContourIntegral,1=Cconint,1=cwint,1=ClockwiseContourIntegral cwconint\n1=CounterClockwiseContourIntegral awconint,1=Therefore there4 therefore,1=Because becaus because,1=ratio\n1=Colon Proportion,1=dotminus minusd,2=mDDot,1=homtht,1=Tilde sim thicksim thksim,0+6he=nvsim,1=backsim bsim\n0+mp=race,1=ac mstpos,0+mr=acE,1=acd,1=VerticalTilde wr wreath,1=NotTilde nsim,1=EqualTilde eqsim esim\n0+mw=NotEqualTilde nesim,1=TildeEqual sime simeq,1=NotTildeEqual nsime nsimeq,1=TildeFullEqual cong,1=simne\n1=NotTildeFullEqual ncong,1=TildeTilde ap approx asymp thickapprox thkap,1=NotTildeTilde nap napprox,1=ape approxeq\n1=apid,0+mw=napid,1=backcong bcong,1=CupCap asympeq,0+6he=nvap,1=Bumpeq HumpDownHump bump,0+mw=NotHumpDownHump nbump\n1=HumpEqual bumpe bumpeq,0+mw=NotHumpEqual nbumpe,1=DotEqual doteq esdot,0+mw=nedot,1=doteqdot eDot\n1=efDot fallingdotseq,1=erDot risingdotseq,1=Assign colone coloneq,1=ecolon eqcolon,1=ecir eqcirc,1=circeq cire\n2=wedgeq,1=veeeq,2=triangleq trie,3=equest questeq,1=NotEqual ne,1=Congruent equiv,0+6hx=bnequiv\n1=NotCongruent nequiv,2=le leq,0+6he=nvle,1=GreaterEqual ge geq,0+6he=nvge,1=LessFullEqual lE leqq,0+mw=nlE nleqq\n1=GreaterFullEqual gE geqq,0+mw=NotGreaterFullEqual ngE ngeqq,1=lnE lneqq,0+1e68=lvertneqq lvnE,1=gnE gneqq\n0+1e68=gvertneqq gvnE,1=Lt NestedLessLess ll,0+mw=NotLessLess nLtv,0+6he=nLt,1=Gt NestedGreaterGreater gg\n0+mw=NotGreaterGreater nGtv,0+6he=nGt,1=between twixt,1=NotCupCap,1=NotLess nless nlt,1=NotGreater ngt ngtr\n1=NotLessEqual nle nleq,1=NotGreaterEqual nge ngeq,1=LessTilde lesssim lsim,1=GreaterTilde gsim gtrsim\n1=NotLessTilde nlsim,1=NotGreaterTilde ngsim,1=LessGreater lessgtr lg,1=GreaterLess gl gtrless,1=NotLessGreater ntlg\n1=NotGreaterLess ntgl,1=Precedes pr prec,1=Succeeds sc succ,1=PrecedesSlantEqual prcue preccurlyeq\n1=SucceedsSlantEqual sccue succcurlyeq,1=PrecedesTilde precsim prsim,1=SucceedsTilde scsim succsim\n0+mw=NotSucceedsTilde,1=NotPrecedes npr nprec,1=NotSucceeds nsc nsucc,1=sub subset,0+6he=NotSubset nsubset vnsub\n1=Superset sup supset,0+6he=NotSuperset nsupset vnsup,1=nsub,1=nsup,1=SubsetEqual sube subseteq\n1=SupersetEqual supe supseteq,1=NotSubsetEqual nsube nsubseteq,1=NotSupersetEqual nsupe nsupseteq,1=subne subsetneq\n0+1e68=varsubsetneq vsubne,1=supne supsetneq,0+1e68=varsupsetneq vsupne,2=cupdot,1=UnionPlus uplus\n1=SquareSubset sqsub sqsubset,0+mw=NotSquareSubset,1=SquareSuperset sqsup sqsupset,0+mw=NotSquareSuperset\n1=SquareSubsetEqual sqsube sqsubseteq,1=SquareSupersetEqual sqsupe sqsupseteq,1=SquareIntersection sqcap\n0+1e68=sqcaps,1=SquareUnion sqcup,0+1e68=sqcups,1=CirclePlus oplus,1=CircleMinus ominus,1=CircleTimes otimes,1=osol\n1=CircleDot odot,1=circledcirc ocir,1=circledast oast,2=circleddash odash,1=boxplus plusb,1=boxminus minusb\n1=boxtimes timesb,1=dotsquare sdotb,1=RightTee vdash,1=LeftTee dashv,1=DownTee top,1=UpTee bot bottom perp,2=models\n1=DoubleRightTee vDash,1=Vdash,1=Vvdash,1=VDash,1=nvdash,1=nvDash,1=nVdash,1=nVDash,1=prurel\n2=LeftTriangle vartriangleleft vltri,1=RightTriangle vartriangleright vrtri,1=LeftTriangleEqual ltrie trianglelefteq\n0+6he=nvltrie,1=RightTriangleEqual rtrie trianglerighteq,0+6he=nvrtrie,1=origof,1=imof,1=multimap mumap,1=hercon\n1=intcal intercal,1=veebar,2=barvee,1=angrtvb,1=lrtri,1=Wedge bigwedge xwedge,1=Vee bigvee xvee\n1=Intersection bigcap xcap,1=Union bigcup xcup,1=Diamond diam diamond,1=sdot,1=Star sstarf,1=divideontimes divonx\n1=bowtie,1=ltimes,1=rtimes,1=leftthreetimes lthree,1=rightthreetimes rthree,1=backsimeq bsime,1=curlyvee cuvee\n1=curlywedge cuwed,1=Sub Subset,1=Sup Supset,1=Cap,1=Cup,1=fork pitchfork,1=epar,1=lessdot ltdot,1=gtdot gtrdot,1=Ll\n0+mw=nLl,1=Gg ggg,0+mw=nGg,1=LessEqualGreater leg lesseqgtr,0+1e68=lesg,1=GreaterEqualLess gel gtreqless,0+1e68=gesl\n3=cuepr curlyeqprec,1=cuesc curlyeqsucc,1=NotPrecedesSlantEqual nprcue,1=NotSucceedsSlantEqual nsccue\n1=NotSquareSubsetEqual nsqsube,1=NotSquareSupersetEqual nsqsupe,3=lnsim,1=gnsim,1=precnsim prnsim,1=scnsim succnsim\n1=NotLeftTriangle nltri ntriangleleft,1=NotRightTriangle nrtri ntriangleright\n1=NotLeftTriangleEqual nltrie ntrianglelefteq,1=NotRightTriangleEqual nrtrie ntrianglerighteq,1=vellip,1=ctdot\n1=utdot,1=dtdot,1=disin,1=isinsv,1=isins,1=isindot,0+mw=notindot,1=notinvc,1=notinvb,2=isinE,0+mw=notinE,1=nisd\n1=xnis,1=nis,1=notnivc,1=notnivb,7=barwed barwedge,1=Barwed doublebarwedge,2=LeftCeiling lceil,1=RightCeiling rceil\n1=LeftFloor lfloor,1=RightFloor rfloor,1=drcrop,1=dlcrop,1=urcrop,1=ulcrop,1=bnot,2=profline,1=profsurf,2=telrec\n1=target,6=ulcorn ulcorner,1=urcorn urcorner,1=dlcorn llcorner,1=drcorn lrcorner,3=frown sfrown,1=smile ssmile\na=cylcty,1=profalar,8=topbot,7=ovbar,2=solbar,1p=angzarr,1g=lmoust lmoustache,1=rmoust rmoustache,3=OverBracket tbrk\n1=UnderBracket bbrk,1=bbrktbrk,12=OverParenthesis,1=UnderParenthesis,1=OverBrace,1=UnderBrace,3=trpezium,5=elinters\n1o=blank,4l=circledS oS,1k=HorizontalLine boxh,2=boxv,a=boxdr,4=boxdl,4=boxur,4=boxul,4=boxvr,8=boxvl,8=boxhd\n8=boxhu,8=boxvh,k=boxH,1=boxV,1=boxdR,1=boxDr,1=boxDR,1=boxdL,1=boxDl,1=boxDL,1=boxuR,1=boxUr,1=boxUR,1=boxuL\n1=boxUl,1=boxUL,1=boxvR,1=boxVr,1=boxVR,1=boxvL,1=boxVl,1=boxVL,1=boxHd,1=boxhD,1=boxHD,1=boxHu,1=boxhU,1=boxHU\n1=boxvH,1=boxVh,1=boxVH,k=uhblk,4=lhblk,4=block,9=blk14,1=blk12,1=blk34,e=Square squ square\n9=FilledVerySmallSquare blacksquare squarf squf,1=EmptyVerySmallSquare,2=rect,1=marker,3=fltns,2=bigtriangleup xutri\n1=blacktriangle utrif,1=triangle utri,3=blacktriangleright rtrif,1=rtri triangleright,4=bigtriangledown xdtri\n1=blacktriangledown dtrif,1=dtri triangledown,3=blacktriangleleft ltrif,1=ltri triangleleft,7=loz lozenge,1=cir\nx=tridot,3=bigcirc xcirc,9=ultri,1=urtri,1=lltri,1=EmptySmallSquare,1=FilledSmallSquare,9=bigstar starf,1=star\n8=phone,1e=female,2=male,u=spades spadesuit,3=clubs clubsuit,2=hearts heartsuit,1=diamondsuit diams,4=sung,3=flat\n1=natur natural,1=sharp,4k=check checkmark,4=cross,9=malt maltese,m=sext,y=VerticalSeparator,q=lbbrk,1=rbbrk\n2d=bsolhsub,1=suphsol,t=LeftDoubleBracket lobrk,1=RightDoubleBracket robrk,1=LeftAngleBracket lang langle\n1=RightAngleBracket rang rangle,1=Lang,1=Rang,1=loang,1=roang,8=LongLeftArrow longleftarrow xlarr\n1=LongRightArrow longrightarrow xrarr,1=LongLeftRightArrow longleftrightarrow xharr\n1=DoubleLongLeftArrow Longleftarrow xlArr,1=DoubleLongRightArrow Longrightarrow xrArr\n1=DoubleLongLeftRightArrow Longleftrightarrow xhArr,2=longmapsto xmap,3=dzigrarr,77=nvlArr,1=nvrArr,1=nvHarr,1=Map\n7=lbarr,1=bkarow rbarr,1=lBarr,1=dbkarow rBarr,1=RBarr drbkarow,1=DDotrahd,1=UpArrowBar,1=DownArrowBar,3=Rarrtl\n3=latail,1=ratail,1=lAtail,1=rAtail,1=larrfs,1=rarrfs,1=larrbfs,1=rarrbfs,3=nwarhk,1=nearhk,1=hksearow searhk\n1=hkswarow swarhk,1=nwnear,1=nesear toea,1=seswar tosa,1=swnwar,9=rarrc,0+mw=nrarrc,2=cudarrr,1=ldca,1=rdca\n1=cudarrl,1=larrpl,3=curarrm,1=cularrp,8=rarrpl,3=harrcir,1=Uarrocir,1=lurdshar,1=ldrushar,3=LeftRightVector\n1=RightUpDownVector,1=DownLeftRightVector,1=LeftUpDownVector,1=LeftVectorBar,1=RightVectorBar,1=RightUpVectorBar\n1=RightDownVectorBar,1=DownLeftVectorBar,1=DownRightVectorBar,1=LeftUpVectorBar,1=LeftDownVectorBar,1=LeftTeeVector\n1=RightTeeVector,1=RightUpTeeVector,1=RightDownTeeVector,1=DownLeftTeeVector,1=DownRightTeeVector,1=LeftUpTeeVector\n1=LeftDownTeeVector,1=lHar,1=uHar,1=rHar,1=dHar,1=luruhar,1=ldrdhar,1=ruluhar,1=rdldhar,1=lharul,1=llhard,1=rharul\n1=lrhard,1=UpEquilibrium udhar,1=ReverseUpEquilibrium duhar,1=RoundImplies,1=erarr,1=simrarr,1=larrsim,1=rarrsim\n1=rarrap,1=ltlarr,2=gtrarr,1=subrarr,2=suplarr,1=lfisht,1=rfisht,1=ufisht,1=dfisht,6=lopar,1=ropar,5=lbrke,1=rbrke\n1=lbrkslu,1=rbrksld,1=lbrksld,1=rbrkslu,1=langd,1=rangd,1=lparlt,1=rpargt,1=gtlPar,1=ltrPar,4=vzigzag,2=vangrt\n1=angrtvbd,7=ange,1=range,1=dwangle,1=uwangle,1=angmsdaa,1=angmsdab,1=angmsdac,1=angmsdad,1=angmsdae,1=angmsdaf\n1=angmsdag,1=angmsdah,1=bemptyv,1=demptyv,1=cemptyv,1=raemptyv,1=laemptyv,1=ohbar,1=omid,1=opar,2=operp,2=olcross\n1=odsold,2=olcir,1=ofcir,1=olt,1=ogt,1=cirscir,1=cirE,1=solb,1=bsolb,4=boxbox,4=trisb,1=rtriltri,1=LeftTriangleBar\n0+mw=NotLeftTriangleBar,1=RightTriangleBar,0+mw=NotRightTriangleBar,c=iinfin,1=infintie,1=nvinfin,5=eparsl\n1=smeparsl,1=eqvparsl,6=blacklozenge lozf,9=RuleDelayed,2=dsol,a=bigodot xodot,1=bigoplus xoplus,1=bigotimes xotime\n2=biguplus xuplus,2=bigsqcup xsqcup,6=iiiint qint,1=fpartint,3=cirfnint,1=awint,1=rppolint,1=scpolint,1=npolint\n1=pointint,1=quatint,1=intlarhk,b=pluscir,1=plusacir,1=simplus,1=plusdu,1=plussim,1=plustwo,2=mcomma,1=minusdu\n3=loplus,1=roplus,1=Cross,1=timesd,1=timesbar,2=smashp,1=lotimes,1=rotimes,1=otimesas,1=Otimes,1=odiv,1=triplus\n1=triminus,1=tritime,1=intprod iprod,3=amalg,1=capdot,2=ncup,1=ncap,1=capand,1=cupor,1=cupcap,1=capcup,1=cupbrcap\n1=capbrcup,1=cupcup,1=capcap,1=ccups,1=ccaps,3=ccupssm,3=And,1=Or,1=andand,1=oror,1=orslope,1=andslope,2=andv,1=orv\n1=andd,1=ord,2=wedbar,7=sdote,4=simdot,3=congdot,0+mw=ncongdot,1=easter,1=apacir,1=apE,0+mw=napE,1=eplus,1=pluse\n1=Esim,1=Colone,1=Equal,2=ddotseq eDDot,1=equivDD,1=ltcir,1=gtcir,1=ltquest,1=gtquest,1=LessSlantEqual leqslant les\n0+mw=NotLessSlantEqual nleqslant nles,1=GreaterSlantEqual geqslant ges,0+mw=NotGreaterSlantEqual ngeqslant nges\n1=lesdot,1=gesdot,1=lesdoto,1=gesdoto,1=lesdotor,1=gesdotol,1=lap lessapprox,1=gap gtrapprox,1=lne lneq,1=gne gneq\n1=lnap lnapprox,1=gnap gnapprox,1=lEg lesseqqgtr,1=gEl gtreqqless,1=lsime,1=gsime,1=lsimg,1=gsiml,1=lgE,1=glE\n1=lesges,1=gesles,1=els eqslantless,1=egs eqslantgtr,1=elsdot,1=egsdot,1=el,1=eg,3=siml,1=simg,1=simlE,1=simgE\n1=LessLess,0+mw=NotNestedLessLess,1=GreaterGreater,0+mw=NotNestedGreaterGreater,2=glj,1=gla,1=ltcc,1=gtcc,1=lescc\n1=gescc,1=smt,1=lat,1=smte,0+1e68=smtes,1=late,0+1e68=lates,1=bumpE,1=PrecedesEqual pre preceq\n0+mw=NotPrecedesEqual npre npreceq,1=SucceedsEqual sce succeq,0+mw=NotSucceedsEqual nsce nsucceq,3=prE,1=scE\n1=precneqq prnE,1=scnE succneqq,1=prap precapprox,1=scap succapprox,1=precnapprox prnap,1=scnap succnapprox,1=Pr\n1=Sc,1=subdot,1=supdot,1=subplus,1=supplus,1=submult,1=supmult,1=subedot,1=supedot,1=subE subseteqq\n0+mw=nsubE nsubseteqq,1=supE supseteqq,0+mw=nsupE nsupseteqq,1=subsim,1=supsim,3=subnE subsetneqq\n0+1e68=varsubsetneqq vsubnE,1=supnE supsetneqq,0+1e68=varsupsetneqq vsupnE,3=csub,1=csup,1=csube,1=csupe,1=subsup\n1=supsub,1=subsub,1=supsup,1=suphsub,1=supdsub,1=forkv,1=topfork,1=mlcp,9=Dashv DoubleLeftTee,2=Vdashl,1=Barv,1=vBar\n1=vBarv,2=Vbar,1=Not,1=bNot,1=rnmid,1=cirmid,1=midcir,1=topcir,1=nhpar,1=parsim,a=parsl,0+6hx=nparsl,1537=fflig\n1=filig,1=fllig,1=ffilig,1=ffllig,16zc=Ascr,2=Cscr,1=Dscr,3=Gscr,3=Jscr,1=Kscr,3=Nscr,1=Oscr,1=Pscr,1=Qscr,2=Sscr\n1=Tscr,1=Uscr,1=Vscr,1=Wscr,1=Xscr,1=Yscr,1=Zscr,1=ascr,1=bscr,1=cscr,1=dscr,2=fscr,2=hscr,1=iscr,1=jscr,1=kscr\n1=lscr,1=mscr,1=nscr,2=pscr,1=qscr,1=rscr,1=sscr,1=tscr,1=uscr,1=vscr,1=wscr,1=xscr,1=yscr,1=zscr,1h=Afr,1=Bfr,2=Dfr\n1=Efr,1=Ffr,1=Gfr,3=Jfr,1=Kfr,1=Lfr,1=Mfr,1=Nfr,1=Ofr,1=Pfr,1=Qfr,2=Sfr,1=Tfr,1=Ufr,1=Vfr,1=Wfr,1=Xfr,1=Yfr,2=afr\n1=bfr,1=cfr,1=dfr,1=efr,1=ffr,1=gfr,1=hfr,1=ifr,1=jfr,1=kfr,1=lfr,1=mfr,1=nfr,1=ofr,1=pfr,1=qfr,1=rfr,1=sfr,1=tfr\n1=ufr,1=vfr,1=wfr,1=xfr,1=yfr,1=zfr,1=Aopf,1=Bopf,2=Dopf,1=Eopf,1=Fopf,1=Gopf,2=Iopf,1=Jopf,1=Kopf,1=Lopf,1=Mopf\n2=Oopf,4=Sopf,1=Topf,1=Uopf,1=Vopf,1=Wopf,1=Xopf,1=Yopf,2=aopf,1=bopf,1=copf,1=dopf,1=eopf,1=fopf,1=gopf,1=hopf\n1=iopf,1=jopf,1=kopf,1=lopf,1=mopf,1=nopf,1=oopf,1=popf,1=qopf,1=ropf,1=sopf,1=topf,1=uopf,1=vopf,1=wopf,1=xopf\n1=yopf,1=zopf`;\n","/**\n * This module decodes the character references of HTML content, with no DOM. The table of the named references has\n * 2231 names. It is in a separate entry, so a bundle that only scans HTML does not get the table.\n */\nimport { NAMED_REFERENCES } from \"./html-references.ts\";\n\n/**\n * The values of the code points 0x80 to 0x9F in a numeric character reference, from the table of the standard. They are\n * the characters of windows-1252. The five code points that windows-1252 does not have stay as they are.\n */\nconst C1_VALUES =\n \"\\u20AC\\u0081\\u201A\\u0192\\u201E\\u2026\\u2020\\u2021\\u02C6\\u2030\\u0160\\u2039\\u0152\\u008D\\u017D\\u008F\" +\n \"\\u0090\\u2018\\u2019\\u201C\\u201D\\u2022\\u2013\\u2014\\u02DC\\u2122\\u0161\\u203A\\u0153\\u009D\\u017E\\u0178\";\n\n/** The value of each named character reference. A name with `;` is a key, and a legacy name is also a key with no `;`. */\nlet named: Map<string, string> | undefined;\n/** The length of the longest name, with no `;`. */\nlet longestName = 0;\n/** The length of the longest legacy name. */\nlet longestLegacy = 0;\n\n/** This function reads the table of the named character references one time, when the decoder first needs it. */\nfunction namedReferences(): Map<string, string> {\n if (named !== undefined) return named;\n const table = new Map<string, string>();\n let point = 0;\n for (const group of NAMED_REFERENCES.split(/[,\\n]/)) {\n const equals = group.indexOf(\"=\");\n const [first = \"\", second] = group.slice(0, equals).split(\"+\");\n point += parseInt(first, 36);\n const value = second === undefined ? String.fromCodePoint(point) : String.fromCodePoint(point, parseInt(second, 36));\n for (const entry of group.slice(equals + 1).split(\" \")) {\n const legacy = entry.endsWith(\"*\");\n const name = legacy ? entry.slice(0, -1) : entry;\n table.set(`${name};`, value);\n longestName = Math.max(longestName, name.length);\n if (legacy) {\n table.set(name, value);\n longestLegacy = Math.max(longestLegacy, name.length);\n }\n }\n }\n named = table;\n return table;\n}\n\n/** This function tells if a code unit is an ASCII letter or an ASCII digit. */\nconst isAlphanumeric = (code: number): boolean => (code >= 0x30 && code <= 0x39) || ((code | 0x20) >= 0x61 && (code | 0x20) <= 0x7a);\n\n/** This function gives the value of a code unit as a decimal or a hexadecimal digit, or -1 for a different code unit. */\nfunction digitOf(code: number, hex: boolean): number {\n if (code >= 0x30 && code <= 0x39) return code - 0x30;\n const lower = code | 0x20;\n return hex && lower >= 0x61 && lower <= 0x66 ? lower - 0x61 + 10 : -1;\n}\n\n/** A character reference that the decoder found: its value, and the index after its last character. */\ninterface Reference {\n readonly value: string;\n readonly end: number;\n}\n\n/**\n * This function reads the numeric character reference at the \"&\" at `amp`, with the fixes of the standard. It gives\n * undefined when no digit follows \"&#\" or \"&#x\".\n */\nfunction readNumeric(text: string, amp: number): Reference | undefined {\n let at = amp + 2;\n const hex = (text.charCodeAt(at) | 0x20) === 0x78;\n if (hex) at += 1;\n const start = at;\n let point = 0;\n for (let digit = digitOf(text.charCodeAt(at), hex); digit !== -1; digit = digitOf(text.charCodeAt(at), hex)) {\n // A value above 0x10FFFF stays at 0x110000. Thus a long run of digits does not make a number that is too large.\n point = Math.min(point * (hex ? 16 : 10) + digit, 0x110000);\n at += 1;\n }\n if (at === start) return undefined;\n if (text.charCodeAt(at) === 0x3b) at += 1;\n if (point === 0 || point > 0x10ffff || (point >= 0xd800 && point <= 0xdfff)) return { value: \"\\uFFFD\", end: at };\n if (point >= 0x80 && point <= 0x9f) return { value: C1_VALUES.charAt(point - 0x80), end: at };\n return { value: String.fromCodePoint(point), end: at };\n}\n\n/**\n * This function reads the named character reference at the \"&\" at `amp`. The longest name wins. It gives undefined when\n * no name of the table follows the \"&\".\n */\nfunction readNamed(text: string, amp: number): Reference | undefined {\n const from = amp + 1;\n if (!isAlphanumeric(text.charCodeAt(from))) return undefined;\n const table = namedReferences();\n // A run of letters and digits that is longer than the longest name is not a name. Thus each \"&\" reads few characters.\n let at = from;\n while (at - from <= longestName && isAlphanumeric(text.charCodeAt(at))) at += 1;\n if (text.charCodeAt(at) === 0x3b) {\n const value = table.get(text.slice(from, at + 1));\n if (value !== undefined) return { value, end: at + 1 };\n }\n // With no `;`, only a legacy name can match: the longest legacy name at the start of the run.\n for (let end = Math.min(at, from + longestLegacy); end > from; end -= 1) {\n const value = table.get(text.slice(from, end));\n if (value !== undefined) return { value, end };\n }\n return undefined;\n}\n\n/**\n * This function decodes the character references of a text, as the tokenizer of the HTML Living Standard does in the\n * content of an element. Use it on the `text` of a scan of `scanHtml`.\n *\n * - A named reference gets its value from the table of the standard. The longest name wins.\n * - A legacy name, for example `&` or `¬`, is also correct with no semicolon. Thus `¬it;` gives `¬it;`.\n * - A decimal or hexadecimal reference, for example `’` or `’`, gives its code point. The semicolon is optional.\n * - The value 0, a surrogate and a value above `0x10FFFF` give U+FFFD.\n * - The values `0x80` to `0x9F` give the characters of windows-1252, from the table of the standard.\n * - An ampersand with no reference after it stays as text. The function changes no other character.\n *\n * The function does not throw, and it is linear in the length of the text. The result is not longer than the text.\n *\n * @param text - The text of HTML content, with its character references.\n * @returns The text with the value of each character reference in place of the reference.\n */\nexport function decodeReferences(text: string): string {\n let amp = text.indexOf(\"&\");\n if (amp === -1) return text;\n const parts: string[] = [];\n let at = 0;\n while (amp !== -1) {\n const reference = text.charCodeAt(amp + 1) === 0x23 ? readNumeric(text, amp) : readNamed(text, amp);\n if (reference === undefined) amp = text.indexOf(\"&\", amp + 1);\n else {\n parts.push(text.slice(at, amp), reference.value);\n at = reference.end;\n amp = text.indexOf(\"&\", at);\n }\n }\n parts.push(text.slice(at));\n return parts.join(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,mBACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChBF,MAAM,YACJ;;AAIF,IAAI;;AAEJ,IAAI,cAAc;;AAElB,IAAI,gBAAgB;;AAGpB,SAAS,kBAAuC;CAC9C,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,wBAAQ,IAAI,IAAoB;CACtC,IAAI,QAAQ;CACZ,KAAK,MAAM,SAAS,iBAAiB,MAAM,OAAO,GAAG;EACnD,MAAM,SAAS,MAAM,QAAQ,GAAG;EAChC,MAAM,CAAC,QAAQ,IAAI,UAAU,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG;EAC7D,SAAS,SAAS,OAAO,EAAE;EAC3B,MAAM,QAAQ,WAAW,KAAA,IAAY,OAAO,cAAc,KAAK,IAAI,OAAO,cAAc,OAAO,SAAS,QAAQ,EAAE,CAAC;EACnH,KAAK,MAAM,SAAS,MAAM,MAAM,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG;GACtD,MAAM,SAAS,MAAM,SAAS,GAAG;GACjC,MAAM,OAAO,SAAS,MAAM,MAAM,GAAG,EAAE,IAAI;GAC3C,MAAM,IAAI,GAAG,KAAK,IAAI,KAAK;GAC3B,cAAc,KAAK,IAAI,aAAa,KAAK,MAAM;GAC/C,IAAI,QAAQ;IACV,MAAM,IAAI,MAAM,KAAK;IACrB,gBAAgB,KAAK,IAAI,eAAe,KAAK,MAAM;GACrD;EACF;CACF;CACA,QAAQ;CACR,OAAO;AACT;;AAGA,MAAM,kBAAkB,SAA2B,QAAQ,MAAQ,QAAQ,OAAW,OAAO,OAAS,OAAS,OAAO,OAAS;;AAG/H,SAAS,QAAQ,MAAc,KAAsB;CACnD,IAAI,QAAQ,MAAQ,QAAQ,IAAM,OAAO,OAAO;CAChD,MAAM,QAAQ,OAAO;CACrB,OAAO,OAAO,SAAS,MAAQ,SAAS,MAAO,QAAQ,KAAO,KAAK;AACrE;;;;;AAYA,SAAS,YAAY,MAAc,KAAoC;CACrE,IAAI,KAAK,MAAM;CACf,MAAM,OAAO,KAAK,WAAW,EAAE,IAAI,QAAU;CAC7C,IAAI,KAAK,MAAM;CACf,MAAM,QAAQ;CACd,IAAI,QAAQ;CACZ,KAAK,IAAI,QAAQ,QAAQ,KAAK,WAAW,EAAE,GAAG,GAAG,GAAG,UAAU,IAAI,QAAQ,QAAQ,KAAK,WAAW,EAAE,GAAG,GAAG,GAAG;EAE3G,QAAQ,KAAK,IAAI,SAAS,MAAM,KAAK,MAAM,OAAO,OAAQ;EAC1D,MAAM;CACR;CACA,IAAI,OAAO,OAAO,OAAO,KAAA;CACzB,IAAI,KAAK,WAAW,EAAE,MAAM,IAAM,MAAM;CACxC,IAAI,UAAU,KAAK,QAAQ,WAAa,SAAS,SAAU,SAAS,OAAS,OAAO;EAAE,OAAO;EAAU,KAAK;CAAG;CAC/G,IAAI,SAAS,OAAQ,SAAS,KAAM,OAAO;EAAE,OAAO,UAAU,OAAO,QAAQ,GAAI;EAAG,KAAK;CAAG;CAC5F,OAAO;EAAE,OAAO,OAAO,cAAc,KAAK;EAAG,KAAK;CAAG;AACvD;;;;;AAMA,SAAS,UAAU,MAAc,KAAoC;CACnE,MAAM,OAAO,MAAM;CACnB,IAAI,CAAC,eAAe,KAAK,WAAW,IAAI,CAAC,GAAG,OAAO,KAAA;CACnD,MAAM,QAAQ,gBAAgB;CAE9B,IAAI,KAAK;CACT,OAAO,KAAK,QAAQ,eAAe,eAAe,KAAK,WAAW,EAAE,CAAC,GAAG,MAAM;CAC9E,IAAI,KAAK,WAAW,EAAE,MAAM,IAAM;EAChC,MAAM,QAAQ,MAAM,IAAI,KAAK,MAAM,MAAM,KAAK,CAAC,CAAC;EAChD,IAAI,UAAU,KAAA,GAAW,OAAO;GAAE;GAAO,KAAK,KAAK;EAAE;CACvD;CAEA,KAAK,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,aAAa,GAAG,MAAM,MAAM,OAAO,GAAG;EACvE,MAAM,QAAQ,MAAM,IAAI,KAAK,MAAM,MAAM,GAAG,CAAC;EAC7C,IAAI,UAAU,KAAA,GAAW,OAAO;GAAE;GAAO;EAAI;CAC/C;AAEF;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,MAAsB;CACrD,IAAI,MAAM,KAAK,QAAQ,GAAG;CAC1B,IAAI,QAAQ,IAAI,OAAO;CACvB,MAAM,QAAkB,CAAC;CACzB,IAAI,KAAK;CACT,OAAO,QAAQ,IAAI;EACjB,MAAM,YAAY,KAAK,WAAW,MAAM,CAAC,MAAM,KAAO,YAAY,MAAM,GAAG,IAAI,UAAU,MAAM,GAAG;EAClG,IAAI,cAAc,KAAA,GAAW,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC;OACvD;GACH,MAAM,KAAK,KAAK,MAAM,IAAI,GAAG,GAAG,UAAU,KAAK;GAC/C,KAAK,UAAU;GACf,MAAM,KAAK,QAAQ,KAAK,EAAE;EAC5B;CACF;CACA,MAAM,KAAK,KAAK,MAAM,EAAE,CAAC;CACzB,OAAO,MAAM,KAAK,EAAE;AACtB"}
|