summaryrefslogtreecommitdiff
path: root/doc/tools/makerst.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tools/makerst.py')
-rwxr-xr-xdoc/tools/makerst.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 417fe59278..a14ef7c665 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -353,7 +353,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
class_name = class_def.name
if dry_run:
- f = open(os.devnull, "w")
+ f = open(os.devnull, "w", encoding="utf-8")
else:
f = open(os.path.join(output_dir, "class_" + class_name.lower() + ".rst"), "w", encoding="utf-8")
@@ -424,7 +424,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
type_rst = property_def.type_name.to_rst(state)
default = property_def.default_value
if property_def.overridden:
- ml.append((type_rst, property_def.name, "**O:** " + default))
+ ml.append((type_rst, property_def.name, default + " *(parent override)*"))
else:
ref = ":ref:`{0}<class_{1}_property_{0}>`".format(property_def.name, class_name)
ml.append((type_rst, ref, default))
@@ -901,6 +901,12 @@ def rstize_text(text, state): # type: (str, State) -> str
tag_text = "``"
tag_depth += 1
inside_code = True
+ elif cmd == "kbd":
+ tag_text = ":kbd:`"
+ tag_depth += 1
+ elif cmd == "/kbd":
+ tag_text = "`"
+ tag_depth -= 1
elif cmd.startswith("enum "):
tag_text = make_enum(cmd[5:], state)
escape_post = True
@@ -973,11 +979,14 @@ def format_table(f, data, remove_empty_columns=False): # type: (TextIO, Iterabl
f.write("\n")
-def make_type(t, state): # type: (str, State) -> str
- if t in state.classes:
- return ":ref:`{0}<class_{0}>`".format(t)
- print_error("Unresolved type '{}', file: {}".format(t, state.current_class), state)
- return t
+def make_type(klass, state): # type: (str, State) -> str
+ link_type = klass
+ if link_type.endswith("[]"): # Typed array, strip [] to link to contained type.
+ link_type = link_type[:-2]
+ if link_type in state.classes:
+ return ":ref:`{}<class_{}>`".format(klass, link_type)
+ print_error("Unresolved type '{}', file: {}".format(klass, state.current_class), state)
+ return klass
def make_enum(t, state): # type: (str, State) -> str