diff options
Diffstat (limited to 'doc/tools')
-rwxr-xr-x | doc/tools/doc_status.py | 26 | ||||
-rwxr-xr-x | doc/tools/makerst.py | 8 |
2 files changed, 20 insertions, 14 deletions
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 6e34cffc05..e6e6d5f606 100755 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -69,8 +69,8 @@ long_flags = { 'empty': 'e', } -table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals'] -table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals'] +table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals', 'theme_items'] +table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals', 'Theme Items'] colors = { 'name': [36], # cyan 'part_big_problem': [4, 31], # underline, red @@ -81,6 +81,7 @@ colors = { 'section': [1, 4], # bold, underline 'state_off': [36], # cyan 'state_on': [1, 35], # bold, magenta/plum + 'bold': [1], # bold } overall_progress_description_weigth = 10 @@ -176,6 +177,7 @@ class ClassStatus: 'methods': ClassStatusProgress(), 'constants': ClassStatusProgress(), 'members': ClassStatusProgress(), + 'theme_items': ClassStatusProgress(), 'signals': ClassStatusProgress() } @@ -220,13 +222,13 @@ class ClassStatus: ) items_progress = ClassStatusProgress() - for k in ['methods', 'constants', 'members', 'signals']: + for k in ['methods', 'constants', 'members', 'signals', 'theme_items']: items_progress += self.progresses[k] output[k] = self.progresses[k].to_configured_colored_string() output['items'] = items_progress.to_configured_colored_string() - output['overall'] = (description_progress + items_progress).to_colored_string('{percent}%', '{pad_percent}{s}') + output['overall'] = (description_progress + items_progress).to_colored_string(color('bold', '{percent}%'), '{pad_percent}{s}') if self.name.startswith('Total'): output['url'] = color('url', 'https://docs.godotengine.org/en/latest/classes/') @@ -257,7 +259,7 @@ class ClassStatus: for sub_tag in list(tag): descr = sub_tag.find('description') status.progresses[tag.tag].increment(len(descr.text.strip()) > 0) - elif tag.tag in ['constants', 'members']: + elif tag.tag in ['constants', 'members', 'theme_items']: for sub_tag in list(tag): if not sub_tag.text is None: status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0) @@ -300,7 +302,7 @@ for arg in sys.argv[1:]: sys.exit(1) if flags['i']: - for r in ['methods', 'constants', 'members', 'signals']: + for r in ['methods', 'constants', 'members', 'signals', 'theme_items']: index = table_columns.index(r) del table_column_names[index] del table_columns[index] @@ -308,7 +310,7 @@ if flags['i']: table_columns.append('items') if flags['o'] == (not flags['i']): - table_column_names.append('Overall') + table_column_names.append(color('bold', 'Overall')) table_columns.append('overall') if flags['u']: @@ -434,6 +436,11 @@ if len(table) > 2 or not flags['a']: row.append('') table.append(row) +if flags['a']: + # Duplicate the headers at the bottom of the table so they can be viewed + # without having to scroll back to the top. + table.append(table_column_names) + table_column_sizes = [] for row in table: for cell_i, cell in enumerate(row): @@ -459,7 +466,10 @@ for row_i, row in enumerate(table): print(row_string) - if row_i == 0 or row_i == len(table) - 2: + # Account for the possible double header (if the `a` flag is enabled). + # No need to have a condition for the flag, as this will behave correctly + # if the flag is disabled. + if row_i == 0 or row_i == len(table) - 3 or row_i == len(table) - 2: print(divider_string) print(divider_string) diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 4b07bf00ee..9012de03b3 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -98,7 +98,6 @@ class ClassDef: self.methods = OrderedDict() # type: OrderedDict[str, List[MethodDef]] self.signals = OrderedDict() # type: OrderedDict[str, SignalDef] self.inherits = None # type: Optional[str] - self.category = None # type: Optional[str] self.brief_description = None # type: Optional[str] self.description = None # type: Optional[str] self.theme_items = None # type: Optional[OrderedDict[str, List[ThemeItemDef]]] @@ -122,10 +121,6 @@ class State: if inherits is not None: class_def.inherits = inherits - category = class_root.get("category") - if category is not None: - class_def.category = category - brief_desc = class_root.find("brief_description") if brief_desc is not None and brief_desc.text: class_def.brief_description = brief_desc.text @@ -149,7 +144,7 @@ class State: getter = property.get("getter") or None default_value = property.get("default") or None if default_value is not None: - default_value = escape_rst(default_value) + default_value = '``{}``'.format(default_value) overridden = property.get("override") or False property_def = PropertyDef(property_name, type_name, setter, getter, property.text, default_value, overridden) @@ -881,6 +876,7 @@ def rstize_text(text, state): # type: (str, State) -> str inside_code = True elif cmd.startswith('enum '): tag_text = make_enum(cmd[5:], state) + escape_post = True else: tag_text = make_type(tag_text, state) escape_post = True |