diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-07-03 01:17:47 +0700 |
---|---|---|
committer | Poommetee Ketson <poommetee@protonmail.com> | 2017-07-03 09:40:56 +0700 |
commit | 21f6cc75a1f6b6c90ae750facd2fbd922211533b (patch) | |
tree | 7d8f361088a997433f925b21802603cec8b0aed5 /editor/SCsub | |
parent | bb6e73f9c155c0340fa4a152fa60a146f0ae744f (diff) |
Authors/About: support for multiple sections
Diffstat (limited to 'editor/SCsub')
-rw-r--r-- | editor/SCsub | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/editor/SCsub b/editor/SCsub index ffdeed1523..a26f6bba77 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -143,6 +143,9 @@ def make_translations_header(target, source, env): def make_authors_header(target, source, env): + sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"] + sections_id = ["dev_founders", "dev_lead", "dev_manager", "dev_names"] + src = source[0].srcnode().abspath dst = target[0].srcnode().abspath f = open(src, "rb") @@ -151,19 +154,35 @@ def make_authors_header(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _EDITOR_AUTHORS_H\n") g.write("#define _EDITOR_AUTHORS_H\n") - g.write("static const char *dev_names[] = {\n") + current_section = "" name_count = -1 + + def close_section(): + g.write("\t0\n") + g.write("};\n") + g.write("#define " + current_section.upper() + "_COUNT " + str(name_count) + "\n") + for line in f: if name_count >= 0: if line.startswith(" "): g.write("\t\"" + line.strip() + "\",\n") name_count += 1 - elif line.strip() == "## Developers": - name_count = 0 - g.write("\t0\n") - g.write("};\n") - g.write("#define AUTHORS_COUNT " + str(name_count) + "\n") + continue + if line.startswith("## "): + if name_count >= 0: + close_section() + name_count = -1 + for i in range(len(sections)): + if line.strip().endswith(sections[i]): + current_section = sections_id[i] + name_count = 0 + g.write("static const char *" + current_section + "[] = {\n") + break + + if name_count >= 0: + close_section() + g.write("#endif\n") if (env["tools"] == "yes"): |