Skip to content

Instantly share code, notes, and snippets.

@bpeterso2000
Created June 1, 2025 20:39
Show Gist options
  • Save bpeterso2000/5cd3acc3ec984c9a8ebe1926ef93cc4a to your computer and use it in GitHub Desktop.
Save bpeterso2000/5cd3acc3ec984c9a8ebe1926ef93cc4a to your computer and use it in GitHub Desktop.
from fasttags import FT
# Tags for all elements in January 7 ,2025 HTML living standard
# http://html.spec.whatwg.org/multipage/indices.html
__all__ = {
'A', 'Abbr', 'Address', 'Area', 'Article', 'Aside', 'Audio', 'B',
'Base', 'Bdi', 'Bdo', 'Blockquote', 'Body', 'Br', 'Button',
'Canvas', 'Caption', 'Cite', 'Code', 'Col', 'Colgroup', 'Data',
'Datalist', 'Dd', 'Del', 'Details', 'Dfn', 'Dialog', 'Div', 'Dl',
'Dt', 'Em','Embed', 'Fieldset', 'Figcaption', 'Figure', 'Footer',
'Form', 'H1,', 'H2', 'H3', 'H4', 'H5', 'H6', 'Head', 'Header',
'Hgroup', 'Hr', 'Html', 'I', 'Iframe', 'Img', 'Input', 'Ins', 'Kbd',
'Label', 'Legend', 'Li', 'Link', 'Main', 'Map', 'Mark', 'Menu',
'Meta', 'Meter', 'Mathml', 'Nav', 'Noscript', 'Object', 'Ol',
'Optgroup', 'Option', 'Output', 'P', 'Picture', 'Pre', 'Progress',
'Q', 'Rp', 'Rt', 'Ruby', 'S', 'Samp', 'Script', 'Search', 'Section',
'Select', 'Slot', 'Small', 'Source', 'Span', 'Strong', 'Style',
'Sub', 'Summary', 'Svg', 'Sup', 'Table', 'Tbody', 'Td', 'Template',
'Textarea', 'Tfoot', 'Th', 'Thead', 'Time', 'Title', 'Tr', 'Track',
'U', 'Ul', 'Var', 'Video', 'Wbr'
}
# Tags for void elements; no closing tags; parsed from ...
# http://developer.mozilla.org/en-US/docs/Glossary/Void_element
VOID_ELEMENTS = {
'Area', 'Base', 'Br','Col', 'Embed', 'Hr', 'Iframe', 'Img', 'Input',
'Link', 'Meta', 'Source', 'Template', 'Track', 'Wbr'
}
# No attribute name translation performed if the name contains
# any of the following HTML ASCII printable special characters
# excluding alphanumeric characters and underscores.
# http://ascii.ci/htmlcodes.htm
SPECIAL_CHARS = set(' !"#$%&\'()*+,-./:;<=>?@[\\]^{|}~`')
# Create global variables for each tag
for tag in __all__:
globals()[tag] = FT(tag, void=tag in VOID_ELEMENTS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment