Skip to content

skial/html-entities

Repository files navigation

html-entities

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

Installation

lix install gh:skial/html-entities

Example

import uhx.sys.HtmlEntity;

class Main {

    public static function main() {
        var raw:HtmlEntity = Aacute;
        var codepoints:Array<Int> = Aacute;
        trace( raw );   // &Aacute;
        trace( codepoints );    // [193]
        trace( HtmlEntity.has('quote') );    // false
        trace( HtmlEntity.has('&csup;') );   // true
        var value:String = "csup";
        codepoints = csup;
        trace( 
            HtmlEntity.has( '&' + value + ';' ), // true
            value, // csup
            '\u2AD0', //
            unifill.InternalEncoding.fromCodePoints(codepoints) //
        );
    }

}

API

HtmlEntity provides an enum listing all the HTML entity names from entities.json. The single difference is the entity &in;, which is referenced as In, due to in being a Haxe keyword.

All other entity names are available in the their original case.

Platform notes

The Java target loads all the values from an embedded resource.

Rebuilding

Run haxe build.template.hxml with -D dryrun to test everything compiles without overwriting anything. Then -D save to save the output.

Releases

No releases published

Packages

No packages published

Languages