There is no point in special casing entities like "quot", "amp"
and such in this function because neither of the two call sites
would ever pass in such a code point:
- the _Wikitext_append_sanitized_link_target already explicitly
handles all these cases, either emitting the entities manually
or raising an exception.
- the DEFAULT case won't ever have to process those characters
because they would have already been tokenized otherwise and
handled in the QUOT, AMP, LESS and GREATER cases.
Signed-off-by: Wincent Colaiuta <win@wincent.com>
void _Wikitext_append_entity_from_utf32_char(char *output, uint32_t character)
{
- // TODO: consider special casing some entities (ie. quot, amp, lt, gt etc)?
char hex_string[8] = { '&', '#', 'x', 0, 0, 0, 0, ';' };
char scratch = (character & 0xf000) >> 12;
hex_string[3] = (scratch <= 9 ? scratch + 48 : scratch + 87);