An abstract enum providing all known Html Entities for
autocompletion, returning an array of codepoints, built from
the whatwg entities.json
file.
Php | Python | Java/JVM | C# | Js/Node | Interp | Neko | HashLink | Lua | CPP |
---|---|---|---|---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ➖ | ➖ |
lix install gh:skial/html-entities
import uhx.sys.HtmlEntity;
class Main {
public static function main() {
var raw:HtmlEntity = Aacute;
var codepoints:Array<Int> = Aacute;
trace( raw ); // Á
trace( codepoints ); // [193]
trace( HtmlEntity.has('quote') ); // false
trace( HtmlEntity.has('⫐') ); // true
var value:String = "csup";
codepoints = csup;
trace(
HtmlEntity.has( '&' + value + ';' ), // true
value, // csup
'\u2AD0', // ⫐
unifill.InternalEncoding.fromCodePoints(codepoints) // ⫐
);
}
}
HtmlEntity
provides an enum listing all the HTML entity names from entities.json
.
The single difference is the entity ∈
, which is referenced as In
, due to in
being a Haxe keyword.
All other entity names are available in the their original case.
The Java target loads all the values from an embedded resource.
Run haxe build.template.hxml
with -D dryrun
to test everything compiles without overwriting anything. Then -D save
to save the output.