aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2019-12-06 13:17:39 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2019-12-06 13:17:39 +0000
commit317d3eeb963a515e15a63fa356d8ebcda7041a51 (patch)
tree0e8a60fb009c820cb11f56ddfedfafa03ecbaa9a /tools
parent7381b9bfadd31c4c9e9a10b5bb5032f9189d4352 (diff)
downloadkeycodemapdb-317d3eeb963a515e15a63fa356d8ebcda7041a51.zip
keycodemapdb-317d3eeb963a515e15a63fa356d8ebcda7041a51.tar.gz
keycodemapdb-317d3eeb963a515e15a63fa356d8ebcda7041a51.tar.bz2
Add support for generating RST formatted docs pages
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/keymap-gen58
1 files changed, 58 insertions, 0 deletions
diff --git a/tools/keymap-gen b/tools/keymap-gen
index 33a4bb9..0185d26 100755
--- a/tools/keymap-gen
+++ b/tools/keymap-gen
@@ -916,6 +916,63 @@ class PodLanguageGenerator(LanguageDocGenerator):
print("Key name %s" % name)
print("")
+class RSTLanguageGenerator(LanguageDocGenerator):
+
+ def _boilerplate(self, lines):
+ print("..")
+ for line in lines:
+ print(" %s" % line)
+ print("")
+
+ def _array_start_name_doc(self, title, subtitle, namemap):
+ print("=" * len(title))
+ print(title)
+ print("=" * len(title))
+ print("")
+ print("-" * len(subtitle))
+ print(subtitle)
+ print("-" * len(subtitle))
+ print("")
+ print(":Manual section: 7")
+ print(":Manual group: Virtualization Support")
+ print("")
+ print("DESCRIPTION")
+ print("===========")
+ print("List of %s key code names, with corresponding key code values" % namemap)
+ print("")
+
+ def _array_start_code_doc(self, title, subtitle, codemap, namemap):
+ print("=" * len(title))
+ print(title)
+ print("=" * len(title))
+ print("")
+ print("-" * len(subtitle))
+ print(subtitle)
+ print("-" * len(subtitle))
+ print("")
+ print(":Manual section: 7")
+ print(":Manual group: Virtualization Support")
+ print("")
+ print("DESCRIPTION")
+ print("===========")
+ print("List of %s key code values, with corresponding %s key code names" % (codemap, namemap))
+ print("")
+
+ def _array_end(self):
+ print("")
+
+ def _array_name_entry(self, value, name):
+ print("* %s" % name)
+ print("")
+ print(" Key value %d (0x%x)" % (value, value))
+ print("")
+
+ def _array_code_entry(self, value, name):
+ print("* %d (0x%x)" % (value, value))
+ print("")
+ print(" Key name %s" % name)
+ print("")
+
SRC_GENERATORS = {
"stdc": StdCLanguageGenerator(),
"stdc-header": StdCHeaderLanguageGenerator(),
@@ -930,6 +987,7 @@ SRC_GENERATORS = {
}
DOC_GENERATORS = {
"pod": PodLanguageGenerator(),
+ "rst": RSTLanguageGenerator(),
}
def code_map(args):