BIND 10 trac2157_merge, updated. e5e511b58b6ad59b3d79f19c2f7d18b0a6843273 [2157] update docbook example in test script
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Feb 13 07:35:19 UTC 2013
The branch, trac2157_merge has been updated
via e5e511b58b6ad59b3d79f19c2f7d18b0a6843273 (commit)
via 0147b8cb625f27bf57438b9e1af25bbd9f597f01 (commit)
via bd35b30808c5093ee41aea3f8289f691befb8219 (commit)
from 5a6d38e1f78650477176b1cd8424227382621c7a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e5e511b58b6ad59b3d79f19c2f7d18b0a6843273
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date: Wed Feb 13 12:54:06 2013 +0900
[2157] update docbook example in test script
commit 0147b8cb625f27bf57438b9e1af25bbd9f597f01
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Feb 12 19:41:51 2013 -0800
[2157] some minor editorial fixes
commit bd35b30808c5093ee41aea3f8289f691befb8219
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date: Wed Feb 13 10:44:52 2013 +0900
[2157] remove dependency on xml.dom.minidom
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/gen-statisticsitems.py.pre.in | 43 ++++++++++++------------
src/bin/auth/tests/gen-statisticsitems_test.py | 24 +++++--------
2 files changed, 30 insertions(+), 37 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/gen-statisticsitems.py.pre.in b/src/bin/auth/gen-statisticsitems.py.pre.in
index 027101d..e2d1623 100755
--- a/src/bin/auth/gen-statisticsitems.py.pre.in
+++ b/src/bin/auth/gen-statisticsitems.py.pre.in
@@ -24,7 +24,6 @@ import re
import sys
import json
from xml.etree import ElementTree
-from xml.dom.minidom import parseString
item_list = []
localstatedir = '@@LOCALSTATEDIR@@'
@@ -194,14 +193,10 @@ def generate_docfile(docfile, def_mtime):
Build XML tree from items.
<varlistentry>
<term>##item_full_name##</term>
- <listitem>
- <simpara>
- ##item_description##
- </simpara>
- </listitem>
- <varlistentry>
- xmldocument_command_name in item_description is surrounded with
- <command>.
+ <listitem><simpara>##item_description##</simpara></listitem>
+ </varlistentry>
+ xmldocument_command_name in item_description is put inside <command>
+ element.
'''
for item in items:
full_item_name = prefix + item['name']
@@ -220,18 +215,19 @@ def generate_docfile(docfile, def_mtime):
command = ElementTree.SubElement(sim_para, 'command')
command.text = word
# at this point command.tail is None
- # append empty string as trailing text for the next
- # word so it can be concatinated with trailing words
- command.tail = ''
+ # append a space as trailing text for the next word
+ # so it can be concatenated with trailing words
+ command.tail = ' '
prev = command
else:
if prev is None:
sim_para.text += word + ' '
else:
prev.tail += word + ' '
- # remove extra trailing whitespaces
- sim_para.text = sim_para.text.rstrip()
- if prev is not None:
+ # remove trailing whitespaces at the end of the description
+ if prev is None:
+ sim_para.text = sim_para.text.rstrip()
+ else:
prev.tail = prev.tail.rstrip()
else:
# the item is a branch node: call myself for child nodes
@@ -247,14 +243,19 @@ def generate_docfile(docfile, def_mtime):
variable_tree = ElementTree.Element('variablelist')
convert_list(item_list, variable_tree)
+ pretty_xml = ElementTree.tostring(variable_tree)
+ if not isinstance(pretty_xml, str):
+ pretty_xml = pretty_xml.decode('utf-8')
+ # put newline around <variablelist> and <varlistentry> element
+ pretty_xml = \
+ re.sub(r'(</?var(?:iablelist|listentry)>)', r'\1\n', pretty_xml)
+ # indent <term> and <listitem>
pretty_xml = \
- parseString(ElementTree.tostring(variable_tree)).toprettyxml()
- # remove XML declaration
- pretty_xml = re.sub('<\?xml[^?]+\?>', '', pretty_xml)
- # remove extra whitespaces inside <command> and <term>
+ re.sub(r'(<(?:term|listitem)>)', r' \1', pretty_xml)
+ # put newline after </term> and </listitem>
pretty_xml = \
- re.sub(r'<(command|term)>\s+([^<\s]+)\s+</\1>', r'<\1>\2</\1>',
- pretty_xml)
+ re.sub(r'(</(?:term|listitem)>)', r'\1\n', pretty_xml)
+
with open(builddir+os.sep+docfile, 'w') as doc:
doc.write(doc_pre_xml.replace(
'<!-- ### STATISTICS DATA PLACEHOLDER ### -->',
diff --git a/src/bin/auth/tests/gen-statisticsitems_test.py b/src/bin/auth/tests/gen-statisticsitems_test.py
index 26587db..256b1ae 100644
--- a/src/bin/auth/tests/gen-statisticsitems_test.py
+++ b/src/bin/auth/tests/gen-statisticsitems_test.py
@@ -43,22 +43,14 @@ Example:
<refsect1>
<title>STATISTICS DATA</title>
<variablelist>
- <varlistentry>
- <term>item1</term>
- <listitem>
- <simpara>
- statistics item
- </simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>item2</term>
- <listitem>
- <simpara>
- another statistics item
- </simpara>
- </listitem>
- </varlistentry>
+ <varlistentry>
+ <term>item1</term>
+ <listitem><simpara>statistics item</simpara></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>item2</term>
+ <listitem><simpara>another statistics item</simpara></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
"""
More information about the bind10-changes
mailing list