Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Update gen_tags.py to exempt generated files from clang-format, and r…
Browse files Browse the repository at this point in the history
…egen the tag lists.
  • Loading branch information
nostrademons committed Apr 30, 2015
1 parent aea66b3 commit ef95a14
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 155 deletions.
17 changes: 12 additions & 5 deletions gentags.py
@@ -1,10 +1,17 @@
import sys

tag_strings = open("src/tag_strings.h", "w")
tag_enum = open("src/tag_enum.h", "w")
tag_sizes = open("src/tag_sizes.h", "w")
def open_and_write_header(filename, comment_prefix):
f = open(filename, 'w')
f.write(comment_prefix + ' Generated via `gentags.py src/tag.in`.\n')
f.write(comment_prefix + ' Do not edit; edit src/tag.in instead.\n')
f.write(comment_prefix + ' clang-format off\n')
return f

tag_py = open("python/gumbo/gumboc_tags.py", "w")
tag_strings = open_and_write_header('src/tag_strings.h', '//')
tag_enum = open_and_write_header('src/tag_enum.h', '//')
tag_sizes = open_and_write_header('src/tag_sizes.h', '//')

tag_py = open_and_write_header('python/gumbo/gumboc_tags.py', '#')
tag_py.write('TagNames = [\n')

tagfile = open(sys.argv[1])
Expand All @@ -15,7 +22,7 @@
tag_strings.write('"%s",\n' % tag)
tag_enum.write('GUMBO_TAG_%s,\n' % tag_upper)
tag_sizes.write('%d, ' % len(tag))
tag_py.write('\t"%s",\n' % tag_upper)
tag_py.write(' "%s",\n' % tag_upper)

tagfile.close()

Expand Down
303 changes: 153 additions & 150 deletions python/gumbo/gumboc_tags.py
@@ -1,152 +1,155 @@
# Generated via `gentags.py src/tag.in`.
# Do not edit; edit src/tag.in instead.
# clang-format off
TagNames = [
"HTML",
"HEAD",
"TITLE",
"BASE",
"LINK",
"META",
"STYLE",
"SCRIPT",
"NOSCRIPT",
"TEMPLATE",
"BODY",
"ARTICLE",
"SECTION",
"NAV",
"ASIDE",
"H1",
"H2",
"H3",
"H4",
"H5",
"H6",
"HGROUP",
"HEADER",
"FOOTER",
"ADDRESS",
"P",
"HR",
"PRE",
"BLOCKQUOTE",
"OL",
"UL",
"LI",
"DL",
"DT",
"DD",
"FIGURE",
"FIGCAPTION",
"MAIN",
"DIV",
"A",
"EM",
"STRONG",
"SMALL",
"S",
"CITE",
"Q",
"DFN",
"ABBR",
"DATA",
"TIME",
"CODE",
"VAR",
"SAMP",
"KBD",
"SUB",
"SUP",
"I",
"B",
"U",
"MARK",
"RUBY",
"RT",
"RP",
"BDI",
"BDO",
"SPAN",
"BR",
"WBR",
"INS",
"DEL",
"IMAGE",
"IMG",
"IFRAME",
"EMBED",
"OBJECT",
"PARAM",
"VIDEO",
"AUDIO",
"SOURCE",
"TRACK",
"CANVAS",
"MAP",
"AREA",
"MATH",
"MI",
"MO",
"MN",
"MS",
"MTEXT",
"MGLYPH",
"MALIGNMARK",
"ANNOTATION_XML",
"SVG",
"FOREIGNOBJECT",
"DESC",
"TABLE",
"CAPTION",
"COLGROUP",
"COL",
"TBODY",
"THEAD",
"TFOOT",
"TR",
"TD",
"TH",
"FORM",
"FIELDSET",
"LEGEND",
"LABEL",
"INPUT",
"BUTTON",
"SELECT",
"DATALIST",
"OPTGROUP",
"OPTION",
"TEXTAREA",
"KEYGEN",
"OUTPUT",
"PROGRESS",
"METER",
"DETAILS",
"SUMMARY",
"MENU",
"MENUITEM",
"APPLET",
"ACRONYM",
"BGSOUND",
"DIR",
"FRAME",
"FRAMESET",
"NOFRAMES",
"ISINDEX",
"LISTING",
"XMP",
"NEXTID",
"NOEMBED",
"PLAINTEXT",
"RB",
"STRIKE",
"BASEFONT",
"BIG",
"BLINK",
"CENTER",
"FONT",
"MARQUEE",
"MULTICOL",
"NOBR",
"SPACER",
"TT",
"RTC",
"HTML",
"HEAD",
"TITLE",
"BASE",
"LINK",
"META",
"STYLE",
"SCRIPT",
"NOSCRIPT",
"TEMPLATE",
"BODY",
"ARTICLE",
"SECTION",
"NAV",
"ASIDE",
"H1",
"H2",
"H3",
"H4",
"H5",
"H6",
"HGROUP",
"HEADER",
"FOOTER",
"ADDRESS",
"P",
"HR",
"PRE",
"BLOCKQUOTE",
"OL",
"UL",
"LI",
"DL",
"DT",
"DD",
"FIGURE",
"FIGCAPTION",
"MAIN",
"DIV",
"A",
"EM",
"STRONG",
"SMALL",
"S",
"CITE",
"Q",
"DFN",
"ABBR",
"DATA",
"TIME",
"CODE",
"VAR",
"SAMP",
"KBD",
"SUB",
"SUP",
"I",
"B",
"U",
"MARK",
"RUBY",
"RT",
"RP",
"BDI",
"BDO",
"SPAN",
"BR",
"WBR",
"INS",
"DEL",
"IMAGE",
"IMG",
"IFRAME",
"EMBED",
"OBJECT",
"PARAM",
"VIDEO",
"AUDIO",
"SOURCE",
"TRACK",
"CANVAS",
"MAP",
"AREA",
"MATH",
"MI",
"MO",
"MN",
"MS",
"MTEXT",
"MGLYPH",
"MALIGNMARK",
"ANNOTATION_XML",
"SVG",
"FOREIGNOBJECT",
"DESC",
"TABLE",
"CAPTION",
"COLGROUP",
"COL",
"TBODY",
"THEAD",
"TFOOT",
"TR",
"TD",
"TH",
"FORM",
"FIELDSET",
"LEGEND",
"LABEL",
"INPUT",
"BUTTON",
"SELECT",
"DATALIST",
"OPTGROUP",
"OPTION",
"TEXTAREA",
"KEYGEN",
"OUTPUT",
"PROGRESS",
"METER",
"DETAILS",
"SUMMARY",
"MENU",
"MENUITEM",
"APPLET",
"ACRONYM",
"BGSOUND",
"DIR",
"FRAME",
"FRAMESET",
"NOFRAMES",
"ISINDEX",
"LISTING",
"XMP",
"NEXTID",
"NOEMBED",
"PLAINTEXT",
"RB",
"STRIKE",
"BASEFONT",
"BIG",
"BLINK",
"CENTER",
"FONT",
"MARQUEE",
"MULTICOL",
"NOBR",
"SPACER",
"TT",
"RTC",
]
3 changes: 3 additions & 0 deletions src/tag_enum.h
@@ -1,3 +1,6 @@
// Generated via `gentags.py src/tag.in`.
// Do not edit; edit src/tag.in instead.
// clang-format off
GUMBO_TAG_HTML,
GUMBO_TAG_HEAD,
GUMBO_TAG_TITLE,
Expand Down
3 changes: 3 additions & 0 deletions src/tag_sizes.h
@@ -1 +1,4 @@
// Generated via `gentags.py src/tag.in`.
// Do not edit; edit src/tag.in instead.
// clang-format off
4, 4, 5, 4, 4, 4, 5, 6, 8, 8, 4, 7, 7, 3, 5, 2, 2, 2, 2, 2, 2, 6, 6, 6, 7, 1, 2, 3, 10, 2, 2, 2, 2, 2, 2, 6, 10, 4, 3, 1, 2, 6, 5, 1, 4, 1, 3, 4, 4, 4, 4, 3, 4, 3, 3, 3, 1, 1, 1, 4, 4, 2, 2, 3, 3, 4, 2, 3, 3, 3, 5, 3, 6, 5, 6, 5, 5, 5, 6, 5, 6, 3, 4, 4, 2, 2, 2, 2, 5, 6, 10, 14, 3, 13, 4, 5, 7, 8, 3, 5, 5, 5, 2, 2, 2, 4, 8, 6, 5, 5, 6, 6, 8, 8, 6, 8, 6, 6, 8, 5, 7, 7, 4, 8, 6, 7, 7, 3, 5, 8, 8, 7, 7, 3, 6, 7, 9, 2, 6, 8, 3, 5, 6, 4, 7, 8, 4, 6, 2, 3,
3 changes: 3 additions & 0 deletions src/tag_strings.h
@@ -1,3 +1,6 @@
// Generated via `gentags.py src/tag.in`.
// Do not edit; edit src/tag.in instead.
// clang-format off
"html",
"head",
"title",
Expand Down

0 comments on commit ef95a14

Please sign in to comment.