Browse Source

[trac3516] adding section (checkpoint)

Francis Dupont 10 years ago
parent
commit
97abcc443a
2 changed files with 47 additions and 35 deletions
  1. 23 17
      tools/kt_system_messages.cc
  2. 24 18
      tools/system_messages.py

+ 23 - 17
tools/kt_system_messages.cc

@@ -56,20 +56,26 @@ dictionary_type dictionary;
 // The structure of the output page is:
 // The structure of the output page is:
 //
 //
 //        header
 //        header
-//           message
-//        separator
-//           message
-//        separator
-//          :
-//        separator
-//           message
+//           section header
+//                 message
+//              separator
+//                 message
+//              separator
+//                :
+//              separator
+//                 message
+//           section trailer
+//           separator
+//           section header
+//             :
+//           section trailer
 //        trailer
 //        trailer
 //
 //
 // (Indentation is not relevant - it has only been added to the above
 // (Indentation is not relevant - it has only been added to the above
 // 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.
-const std::string SEC_HEADER =
+const std::string FILE_HEADER =
 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
 <!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"\n\
 <!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"\n\
 \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n\
 \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n\
@@ -96,8 +102,8 @@ const std::string SEC_HEADER =
     <abstract>\n\
     <abstract>\n\
       <para>\n\
       <para>\n\
         This is the messages manual for Kea version &__VERSION__;.\n\
         This is the messages manual for Kea version &__VERSION__;.\n\
-\t    The most up-to-date version of this document, along with\n\
-\t    other documents for Kea, can be found at\n\
+            The most up-to-date version of this document, along with\n\
+            other documents for Kea, can be found at\n\
         <ulink url=\"http://kea.isc.org/docs\"/>.\n\
         <ulink url=\"http://kea.isc.org/docs\"/>.\n\
       </para>\n\
       </para>\n\
     </abstract>\n\
     </abstract>\n\
@@ -138,7 +144,7 @@ const std::string SEC_HEADER =
 // This is output once for each message.  The string contains
 // This is output once for each message.  The string contains
 // substitution tokens: $I is replaced by the message identification,
 // substitution tokens: $I is replaced by the message identification,
 // $T by the message text, and $D by the message description.
 // $T by the message text, and $D by the message description.
-const std::string SEC_MESSAGE =
+const std::string ID_MESSAGE =
 "<varlistentry id=\"$I\">\n\
 "<varlistentry id=\"$I\">\n\
 <term>$I $T</term>\n\
 <term>$I $T</term>\n\
 <listitem><para>\n\
 <listitem><para>\n\
@@ -151,10 +157,10 @@ const std::string 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.
-const std::string SEC_SEPARATOR = "";
+const std::string 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.
-const std::string SEC_TRAILER =
+const std::string FILE_TRAILER =
 "      </variablelist>\n\
 "      </variablelist>\n\
     </para>\n\
     </para>\n\
   </chapter>\n\
   </chapter>\n\
@@ -229,18 +235,18 @@ lines_type replaceBlankLines(const lines_type lines)
 
 
 /// Printing functions
 /// Printing functions
 void printHeader() {
 void printHeader() {
-    std::cout << SEC_HEADER << "\n";
+    std::cout << FILE_HEADER << "\n";
 }
 }
 
 
 void printSeparator() {
 void printSeparator() {
-    std::cout << SEC_SEPARATOR << "\n";
+    std::cout << SEPARATOR << "\n";
 }
 }
 
 
 void printMessage(const std::string& msgid)
 void printMessage(const std::string& msgid)
 {
 {
     //In the message ID, replace "<" and ">" with XML-safe versions and
     //In the message ID, replace "<" and ">" with XML-safe versions and
     // substitute into the data.
     // substitute into the data.
-    const std::string m0 = SEC_MESSAGE;
+    const std::string m0 = ID_MESSAGE;
     const std::string m1 = replaceShell(m0, 'I', replaceTag(msgid));
     const std::string m1 = replaceShell(m0, 'I', replaceTag(msgid));
 
 
     // Do the same for the message text.
     // Do the same for the message text.
@@ -269,7 +275,7 @@ void printMessage(const std::string& msgid)
 }
 }
 
 
 void printTrailer() {
 void printTrailer() {
-    std::cout << SEC_TRAILER << "\n";
+    std::cout << FILE_TRAILER << "\n";
 }
 }
 
 
 
 

+ 24 - 18
tools/system_messages.py

@@ -1,4 +1,4 @@
-# Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2011, 2015  Internet Systems Consortium, Inc. ("ISC")
 #
 #
 # Permission to use, copy, modify, and/or distribute this software for any
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
 # purpose with or without fee is hereby granted, provided that the above
@@ -38,20 +38,26 @@ dictionary = {}
 # The structure of the output page is:
 # The structure of the output page is:
 #
 #
 #        header
 #        header
-#           message
-#        separator
-#           message
-#        separator
-#          :
-#        separator
-#           message
+#           section header
+#                 message
+#              separator
+#                 message
+#              separator
+#                :
+#              separator
+#                 message
+#           section trailer
+#           separator
+#           section header
+#             :
+#           section trailer
 #        trailer
 #        trailer
 #
 #
 # (Indentation is not relevant - it has only been added to the above
 # (Indentation is not relevant - it has only been added to the above
 # 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="""<?xml version="1.0" encoding="UTF-8"?>
+FILE_HEADER="""<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
 <!ENTITY mdash  "&#x2014;" >
 <!ENTITY mdash  "&#x2014;" >
@@ -77,8 +83,8 @@ SEC_HEADER="""<?xml version="1.0" encoding="UTF-8"?>
     <abstract>
     <abstract>
       <para>
       <para>
         This is the messages manual for Kea version &__VERSION__;.
         This is the messages manual for Kea version &__VERSION__;.
-	    The most up-to-date version of this document, along with
-	    other documents for Kea, can be found at
+            The most up-to-date version of this document, along with
+            other documents for Kea, can be found at
         <ulink url="http://kea.isc.org/docs"/>.
         <ulink url="http://kea.isc.org/docs"/>.
       </para>
       </para>
     </abstract>
     </abstract>
@@ -120,7 +126,7 @@ SEC_HEADER="""<?xml version="1.0" encoding="UTF-8"?>
 # 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 = """<varlistentry id="$I">
+ID_MESSAGE = """<varlistentry id="$I">
 <term>$I $T</term>
 <term>$I $T</term>
 <listitem><para>
 <listitem><para>
 $D
 $D
@@ -133,10 +139,10 @@ 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 = ""
+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 = """      </variablelist>
+FILE_TRAILER = """      </variablelist>
     </para>
     </para>
   </chapter>
   </chapter>
 </book>"""
 </book>"""
@@ -179,15 +185,15 @@ def replaceBlankLines(lines):
 
 
 # Printing functions
 # Printing functions
 def printHeader():
 def printHeader():
-    print(SEC_HEADER)
+    print(FILE_HEADER)
 
 
 def printSeparator():
 def printSeparator():
-    print(SEC_SEPARATOR)
+    print(SEPARATOR)
 
 
 def printMessage(msgid):
 def printMessage(msgid):
     # In the message ID, replace "<" and ">" with XML-safe versions and
     # In the message ID, replace "<" and ">" with XML-safe versions and
     # substitute into the data.
     # substitute into the data.
-    m1 = SEC_MESSAGE.replace("$I", replaceTag(msgid))
+    m1 = ID_MESSAGE.replace("$I", replaceTag(msgid))
 
 
     # Do the same for the message text.
     # Do the same for the message text.
     m2 = m1.replace("$T", replaceTag(dictionary[msgid]['text']))
     m2 = m1.replace("$T", replaceTag(dictionary[msgid]['text']))
@@ -205,7 +211,7 @@ def printMessage(msgid):
     print(m3)
     print(m3)
 
 
 def printTrailer():
 def printTrailer():
-    print(SEC_TRAILER)
+    print(FILE_TRAILER)