mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[trac1012] Adadpted the program to output DocBook XML
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
EXTRA_DIST = bind10-guide.css
|
EXTRA_DIST = bind10-guide.css
|
||||||
EXTRA_DIST += bind10-guide.html bind10-messages.html
|
EXTRA_DIST += bind10-guide.xml bind10-guide.html
|
||||||
EXTRA_DIST += bind10-guide.xml
|
EXTRA_DIST += bind10-messages.xml bind10-messages.html
|
||||||
|
|
||||||
# This is not a "man" manual, but reuse this for now for docbook.
|
# This is not a "man" manual, but reuse this for now for docbook.
|
||||||
if ENABLE_MAN
|
if ENABLE_MAN
|
||||||
|
|
||||||
.PHONY: bind10-messages.html
|
.PHONY: bind10-messages.xml
|
||||||
|
|
||||||
bind10-guide.html: bind10-guide.xml
|
bind10-guide.html: bind10-guide.xml
|
||||||
xsltproc --novalid --xinclude --nonet \
|
xsltproc --novalid --xinclude --nonet \
|
||||||
@@ -15,8 +15,16 @@ bind10-guide.html: bind10-guide.xml
|
|||||||
http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl \
|
http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl \
|
||||||
$(srcdir)/bind10-guide.xml
|
$(srcdir)/bind10-guide.xml
|
||||||
|
|
||||||
|
bind10-messages.html: bind10-messages.xml
|
||||||
|
xsltproc --novalid --xinclude --nonet \
|
||||||
|
--path $(top_builddir)/doc \
|
||||||
|
-o $@ \
|
||||||
|
--stringparam html.stylesheet $(srcdir)/bind10-guide.css \
|
||||||
|
http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl \
|
||||||
|
$(srcdir)/bind10-messages.xml
|
||||||
|
|
||||||
# So many dependencies that it's easiest just to regenerate it every time
|
# So many dependencies that it's easiest just to regenerate it every time
|
||||||
bind10-messages.html:
|
bind10-messages.xml:
|
||||||
$(PYTHON) $(top_srcdir)/tools/system_messages.py -o $@ $(top_srcdir)
|
$(PYTHON) $(top_srcdir)/tools/system_messages.py -o $@ $(top_srcdir)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@@ -1480,7 +1480,7 @@ then change those defaults with config set Resolver/forward_addresses[0]/address
|
|||||||
<listitem><para>
|
<listitem><para>
|
||||||
The message identification. Every message in BIND-10 has a unique
|
The message identification. Every message in BIND-10 has a unique
|
||||||
identification, which can be used as an index into the
|
identification, which can be used as an index into the
|
||||||
<ulink url="bind10-messages.html">BIND10 Messages Manual</ulink>
|
BIND10 Messages Manual
|
||||||
from which more information can be obtained.
|
from which more information can be obtained.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@@ -51,33 +51,91 @@ dictionary = {}
|
|||||||
# illustration to make the structure clearer.) The text of these section is:
|
# illustration to make the structure clearer.) The text of these section is:
|
||||||
|
|
||||||
# Header - this is output before anything else.
|
# Header - this is output before anything else.
|
||||||
SEC_HEADER = """<html>
|
SEC_HEADER="""<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<head>
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||||
<title>BIND 10 System Messages</title>
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
|
||||||
<link rel="stylesheet" href="./bind10-guide.css" type="text/css">
|
<!ENTITY mdash "—" >
|
||||||
</head>
|
<!ENTITY % version SYSTEM "version.ent">
|
||||||
<body>
|
%version;
|
||||||
<h1>BIND 10 System Messages</h1>
|
]>
|
||||||
<p/>
|
<book>
|
||||||
|
<?xml-stylesheet href="bind10-guide.css" type="text/css"?>
|
||||||
|
|
||||||
|
<bookinfo>
|
||||||
|
<title>BIND 10 Messages Manual</title>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
<year>2011</year><holder>Internet Systems Consortium, Inc.</holder>
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
<para>BIND 10 is a Domain Name System (DNS) suite managed by
|
||||||
|
Internet Systems Consortium (ISC). It includes DNS libraries
|
||||||
|
and modular components for controlling authoritative and
|
||||||
|
recursive DNS servers.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
This is the messages manual for BIND 10 version &__VERSION__;.
|
||||||
|
The most up-to-date version of this document, along with
|
||||||
|
other documents for BIND 10, can be found at
|
||||||
|
<ulink url="http://bind10.isc.org/docs"/>.
|
||||||
|
</para>
|
||||||
|
</abstract>
|
||||||
|
|
||||||
|
<releaseinfo>This is the messages manual for BIND 10 version
|
||||||
|
&__VERSION__;.</releaseinfo>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<chapter id="intro">
|
||||||
|
<title>Introduction</title>
|
||||||
|
<para>
|
||||||
|
This document lists each messages that can be logged by the
|
||||||
|
programs in the BIND 10 package. Each entry in this manual
|
||||||
|
is of the form:
|
||||||
|
<screen>IDENTIFICATION, message-text</screen>
|
||||||
|
... where "IDENTIFICATION" is the message identification included
|
||||||
|
in each message logged and "message-text" is the accompanying
|
||||||
|
message text. "message-text" may include placeholders of the
|
||||||
|
form "%1", "%2" etc.; these parameters are replaced by relevant
|
||||||
|
values when the message is logged.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Each entry is also accompanied by a description giving more
|
||||||
|
information about the circumstances that result in the message
|
||||||
|
being logged.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="messages">
|
||||||
|
<title>BIND 10 Messages</title>
|
||||||
|
<para>
|
||||||
|
<variablelist>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# This is output once for each message. The string contains substitution
|
# This is output once for each message. The string contains substitution
|
||||||
# tokens: $I is replaced by the message identification, $T by the message text,
|
# tokens: $I is replaced by the message identification, $T by the message text,
|
||||||
# and $D by the message description.
|
# and $D by the message description.
|
||||||
SEC_MESSAGE = """<b><a name="$I">$I</a></b>, $T<br/>
|
SEC_MESSAGE = """<varlistentry>
|
||||||
$D"""
|
<term>$I, $T</term>
|
||||||
|
<listitem><para>
|
||||||
|
$D
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>"""
|
||||||
|
|
||||||
# A description may contain blank lines intended to separate paragraphs. If so,
|
# A description may contain blank lines intended to separate paragraphs. If so,
|
||||||
# each blank line is replaced by the following.
|
# each blank line is replaced by the following.
|
||||||
SEC_BLANK = "<p/>"
|
SEC_BLANK = "</para><para>"
|
||||||
|
|
||||||
# The separator is copied to the output verbatim after each message except
|
# The separator is copied to the output verbatim after each message except
|
||||||
# the last.
|
# the last.
|
||||||
SEC_SEPARATOR = "<p/>"
|
SEC_SEPARATOR = ""
|
||||||
|
|
||||||
# The trailier is copied to the output verbatim after the last message.
|
# The trailier is copied to the output verbatim after the last message.
|
||||||
SEC_TRAILER = """</body>
|
SEC_TRAILER = """ </variablelist>
|
||||||
</html>"""
|
</para>
|
||||||
|
</chapter>
|
||||||
|
</book>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def reportError(filename, what):
|
def reportError(filename, what):
|
||||||
@@ -89,21 +147,14 @@ def reportError(filename, what):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Printing functions
|
def replaceTag(string):
|
||||||
def printHeader():
|
"""Replaces the '<' and '>' in text about to be inserted into the template
|
||||||
print(SEC_HEADER)
|
sections above with < and > to avoid problems with message text
|
||||||
|
being interpreted as XML text.
|
||||||
def printSeparator():
|
"""
|
||||||
print(SEC_SEPARATOR)
|
string1 = string.replace("<", "<")
|
||||||
|
string2 = string1.replace(">", ">")
|
||||||
def printMessage(msgid):
|
return string2
|
||||||
m1 = SEC_MESSAGE.replace("$I", msgid)
|
|
||||||
m2 = m1.replace("$T", dictionary[msgid]['text'])
|
|
||||||
m3 = m2.replace("$D", dictionary[msgid]['description'])
|
|
||||||
print(m3)
|
|
||||||
|
|
||||||
def printTrailer():
|
|
||||||
print(SEC_TRAILER)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -122,6 +173,38 @@ def replaceBlankLines(lines):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Printing functions
|
||||||
|
def printHeader():
|
||||||
|
print(SEC_HEADER)
|
||||||
|
|
||||||
|
def printSeparator():
|
||||||
|
print(SEC_SEPARATOR)
|
||||||
|
|
||||||
|
def printMessage(msgid):
|
||||||
|
# In the message ID, replace "<" and ">" with XML-safe versions and
|
||||||
|
# substitute into the data.
|
||||||
|
m1 = SEC_MESSAGE.replace("$I", replaceTag(msgid))
|
||||||
|
|
||||||
|
# Do the same for the message text.
|
||||||
|
m2 = m1.replace("$T", replaceTag(dictionary[msgid]['text']))
|
||||||
|
|
||||||
|
# Do the same for the description then replace blank lines with the
|
||||||
|
# specified separator. (We do this in that order to avoid replacing
|
||||||
|
# the "<" and ">" in the XML tags in the separator.)
|
||||||
|
desc1 = [replaceTag(l) for l in dictionary[msgid]['description']]
|
||||||
|
desc2 = replaceBlankLines(desc1)
|
||||||
|
|
||||||
|
# Join the lines together to form a single string and insert into
|
||||||
|
# current text.
|
||||||
|
m3 = m2.replace("$D", "\n".join(desc2))
|
||||||
|
|
||||||
|
print(m3)
|
||||||
|
|
||||||
|
def printTrailer():
|
||||||
|
print(SEC_TRAILER)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def removeEmptyLeadingTrailing(lines):
|
def removeEmptyLeadingTrailing(lines):
|
||||||
"""Removes leading and trailing empty lines.
|
"""Removes leading and trailing empty lines.
|
||||||
|
|
||||||
@@ -190,17 +273,12 @@ def addToDictionary(msgid, msgtext, desc, filename):
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
msgid = msgid + " (" + str(i) + ")"
|
msgid = msgid + " (" + str(i) + ")"
|
||||||
|
|
||||||
# Remove leading and trailing blank lines, and replace embedded blanks
|
# Remove leading and trailing blank lines in the description, then
|
||||||
# with the blank section element.
|
# add everything into a subdictionary which is then added to the main
|
||||||
modified_desc = replaceBlankLines(removeEmptyLeadingTrailing(desc))
|
# one.
|
||||||
|
|
||||||
# Put everything in a sub-dictionary that is added to the main one. At
|
|
||||||
# this point, for ease of subsequent processing the description lines are
|
|
||||||
# concatenated together to form a single string, the lines being separated
|
|
||||||
# by a newline.
|
|
||||||
details = {}
|
details = {}
|
||||||
details['text'] = msgtext
|
details['text'] = msgtext
|
||||||
details['description'] = "\n".join(modified_desc)
|
details['description'] = removeEmptyLeadingTrailing(desc)
|
||||||
details['filename'] = filename
|
details['filename'] = filename
|
||||||
dictionary[msgid] = details
|
dictionary[msgid] = details
|
||||||
|
|
||||||
@@ -261,8 +339,6 @@ def processFileContent(filename, lines):
|
|||||||
addToDictionary(msgid, msgtext, description, filename)
|
addToDictionary(msgid, msgtext, description, filename)
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# \param file Name of the file to process
|
|
||||||
|
|
||||||
def processFile(filename):
|
def processFile(filename):
|
||||||
"""Processes a file by reading it in and stripping out all comments and
|
"""Processes a file by reading it in and stripping out all comments and
|
||||||
@@ -323,7 +399,7 @@ if __name__ == "__main__":
|
|||||||
# Read the files and load the data
|
# Read the files and load the data
|
||||||
processAllFiles(args[0])
|
processAllFiles(args[0])
|
||||||
|
|
||||||
# Now just list the message IDs and text in the global dictionary
|
# Now just print out everything we've read (in alphabetical order).
|
||||||
count = 1
|
count = 1
|
||||||
printHeader()
|
printHeader()
|
||||||
for msgid in sorted(dictionary):
|
for msgid in sorted(dictionary):
|
||||||
|
Reference in New Issue
Block a user