Add <option> tags to options in autogenerateconfig

By marking options as <option>option_name</option>, we get
more flexibility in how to handle them.

In particular, currently these thousands of automatically generated
options are polluting the translation's common resource.
Marking these strings as <option> might allow us to
say "don't translate this".

Change-Id: I0282545d1a2c3ca3d14a5c411c2f5457fbd09780
This commit is contained in:
Tom Fifield 2014-12-31 15:15:06 +08:00
parent 796c237dd4
commit a2970b1d39
2 changed files with 13 additions and 6 deletions

View File

@ -406,7 +406,9 @@ def write_docbook(package_name, options, target, verbose=0):
tbody.append(tr)
td = etree.Element('td')
td.text = "%s = %s" % (option.dest, default)
td.text = ("<option>%s</option> = "
"<replaceable>%s</replaceable>"
) % (option.dest, default)
tr.append(td)
td = etree.Element('td')
@ -489,7 +491,9 @@ def write_docbook_rootwrap(package_name, repo, target, verbose=0):
tbody.append(tr)
td = etree.Element('td')
td.text = "%s = %s" % (optname, default)
td.text = ("<option>%s</option> = "
"<replaceable>%s</replaceable>"
) % (optname, default)
tr.append(td)
td = etree.Element('td')

View File

@ -90,8 +90,7 @@ def get_existing_options(optfiles):
for tr in trlist:
try:
col1, col2 = tr.findall(DBK_NS + "td")
optentry = col1.text
option = optentry.split('=', 1)[0].strip()
option = col1.find(DBK_NS + "option").text
helptext = col2.text
except IndexError:
continue
@ -186,7 +185,11 @@ def write_docbook(options, manuals_repo):
tbody.append(tr)
td = etree.Element('td')
td.text = "%s = %s" % (oslo_opt.name, oslo_opt.default)
option_xml = etree.SubElement(td, 'option')
option_xml.text = "%s" % oslo_opt.name
option_xml.tail = " = "
replaceable_xml = etree.SubElement(td, 'replaceable')
replaceable_xml.text = "%s" % oslo_opt.default
tr.append(td)
td = etree.Element('td')
@ -245,7 +248,7 @@ def read_options(swift_repo, manuals_repo, verbose):
else:
option_desc = 'No help text available for this option.'
if verbose > 0:
print(parsed_line[0] + "has no help text")
print(parsed_line[0] + " has no help text")
# \xa0 is a non-breacking space
name = parsed_line[0]