[svn-commits] mjordan: branch mjordan/manager-events r368275 - in /team/mjordan/manager-eve...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 1 16:21:08 CDT 2012


Author: mjordan
Date: Fri Jun  1 16:21:03 2012
New Revision: 368275

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368275
Log:
Check-in documentation improvements for the weekend

Updated Makefile with -full option; finished updates for the
configure script.  Updates python scripts as well.

Started looking at xmldoc.

Modified:
    team/mjordan/manager-events/Makefile
    team/mjordan/manager-events/build_tools/get_documentation.py
    team/mjordan/manager-events/build_tools/post_process_documentation.py
    team/mjordan/manager-events/doc/appdocsxml.dtd
    team/mjordan/manager-events/main/xmldoc.c

Modified: team/mjordan/manager-events/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/Makefile?view=diff&rev=368275&r1=368274&r2=368275
==============================================================================
--- team/mjordan/manager-events/Makefile (original)
+++ team/mjordan/manager-events/Makefile Fri Jun  1 16:21:03 2012
@@ -429,6 +429,8 @@
 	rm -f defaults.h
 	rm -f include/asterisk/build.h
 	rm -f main/version.c
+	rm -f doc/core-en_US.xml
+	rm -f doc/core-full-en_US.xml
 	@$(MAKE) -C menuselect clean
 	cp -f .cleancount .lastclean
 
@@ -468,6 +470,7 @@
 	$(MAKE) -C sounds install
 
 doc/core-en_US.xml: $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+	
 	@printf "Building Documentation For: "
 	@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
 	@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@@ -482,6 +485,11 @@
 	@echo "</docs>" >> $@
 
 doc/core-full-en_US.xml: $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+ifeq ($(PYTHON),:)
+	@echo "--------------------------------------------------------------------------"
+	@echo "---        Please install python to build full documentation           ---"
+	@echo "--------------------------------------------------------------------------"
+else
 	@printf "Building Documentation For: "
 	@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
 	@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@@ -494,19 +502,7 @@
 	done
 	@echo
 	@echo "</docs>" >> $@
-	$(PYTHON) build_tools/post_process_documentation.py -i $@ -o "doc/core-en_US.xml"
-
-validate-docs-full: doc/core-full-en_US.xml
-ifeq ($(XMLSTARLET)$(XMLLINT),::)
-	@echo "--------------------------------------------------------------------------"
-	@echo "--- Please install xmllint or xmlstarlet to validate the documentation ---"
-	@echo "--------------------------------------------------------------------------"
-else
-  ifneq ($(XMLLINT),:)
-	$(XMLLINT) --dtdvalid doc/appdocsxml.dtd --noout $<
-  else
-	$(XMLSTARLET) val -d doc/appdocsxml.dtd $<
-  endif
+#	@$(PYTHON) build_tools/post_process_documentation.py -i $@ -o "doc/core-en_US.xml"
 endif
 
 validate-docs: doc/core-en_US.xml

Modified: team/mjordan/manager-events/build_tools/get_documentation.py
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/build_tools/get_documentation.py?view=diff&rev=368275&r1=368274&r2=368275
==============================================================================
--- team/mjordan/manager-events/build_tools/get_documentation.py (original)
+++ team/mjordan/manager-events/build_tools/get_documentation.py Fri Jun  1 16:21:03 2012
@@ -70,7 +70,8 @@
     parameter_tokens = event_parameters.replace("\"", "").split('\\r\\n')
 
     # Build the top level XML element information
-    xml_fragment.insert(0, "<managerEvent name=\"%s\">" % event_type.strip().replace("\"",""))
+    xml_fragment.insert(0, "<managerEvent language=\"%s\" name=\"%s\">" %
+                        ('en_US', event_type.strip().replace("\"","")))
     xml_fragment[1] = "<managerEventInstance class=\"%s\">" % (class_level)
     xml_fragment.insert(len(xml_fragment), "</managerEvent>")
 
@@ -126,15 +127,13 @@
             if not xml_fragment:
                 # Nothing read, move along
                 continue
-            try:
-                if "<managerEventInstance>" in xml_fragment[0]:
-                    xml.append(parse_manager_event_instance(xml_fragment))
-                else:
-                    xml.append(''.join(xml_fragment))
-                xml_fragment = []
-            except:
-                print "Failed to parse XML near line: %d" % line_number
-                return 1
+
+            if "<managerEventInstance>" in xml_fragment[0]:
+                xml.append(parse_manager_event_instance(xml_fragment))
+            else:
+                xml.append(''.join(xml_fragment))
+
+            xml_fragment = []
         elif (in_doc == True):
             xml_fragment.append("%s\n" % line)
 

Modified: team/mjordan/manager-events/build_tools/post_process_documentation.py
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/build_tools/post_process_documentation.py?view=diff&rev=368275&r1=368274&r2=368275
==============================================================================
--- team/mjordan/manager-events/build_tools/post_process_documentation.py (original)
+++ team/mjordan/manager-events/build_tools/post_process_documentation.py Fri Jun  1 16:21:03 2012
@@ -10,6 +10,7 @@
 
 import sys
 import os
+import optparse
 import xml.dom.minidom
 
 from xml.dom.minidom import Element, parse
@@ -66,11 +67,18 @@
     if argv is None:
         argv = sys.argv
 
-    
+    parser = optparse.OptionParser()
+    parser.add_option('-i', '--input', dest = 'input_file',
+                      default='doc/core-full-en_US.xml',
+                      help='The XML file to process')
+    parser.add_option('-o', '--output', dest = 'output_file',
+                      default='doc/core-en_US.xml',
+                      help='The XML file to create')
+    (options, args) = parser.parse_args(argv)
 
-    dom = parse(inputFile)
+    dom = parse(options.input_file)
 
-    datasource = open("doc/core-en_US.xml", 'w')
+    datasource = open(options.output_file, 'w')
     docs = dom.getElementsByTagName("docs")[0]
     managerEvents = dom.getElementsByTagName("managerEvent")
     if (managerEvents):

Modified: team/mjordan/manager-events/doc/appdocsxml.dtd
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/doc/appdocsxml.dtd?view=diff&rev=368275&r1=368274&r2=368275
==============================================================================
--- team/mjordan/manager-events/doc/appdocsxml.dtd (original)
+++ team/mjordan/manager-events/doc/appdocsxml.dtd Fri Jun  1 16:21:03 2012
@@ -1,4 +1,4 @@
-  <!ELEMENT docs (application|function|agi|manager)*>
+  <!ELEMENT docs (application|function|agi|manager|managerEvent)*>
   <!ATTLIST docs xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude">
 
   <!ELEMENT xi:include (xi:fallback?) >
@@ -29,6 +29,13 @@
   <!ATTLIST manager name CDATA #REQUIRED>
   <!ATTLIST manager language CDATA #REQUIRED>
 
+  <!ELEMENT managerEvent (managerEventInstance+)>
+  <!ATTLIST managerEvent name CDATA #REQUIRED>
+  <!ATTLIST managerEvent language CDATA #REQUIRED>
+
+  <!ELEMENT managerEventInstance (reason,syntax?,see-also?,xi:include?)*>
+  <!ATTLIST managerEventInstance class CDATA #REQUIRED>
+
   <!ELEMENT see-also (ref|xi:include)*>
 
   <!ELEMENT ref (#PCDATA)>
@@ -38,6 +45,8 @@
 
   <!ELEMENT syntax (parameter|xi:include)*>
   <!ATTLIST syntax argsep CDATA ",">
+
+  <!ELEMENT reason (#PCDATA)>
 
   <!ELEMENT description (para|note|warning|variablelist|enumlist|xi:include)*>
 

Modified: team/mjordan/manager-events/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/main/xmldoc.c?view=diff&rev=368275&r1=368274&r2=368275
==============================================================================
--- team/mjordan/manager-events/main/xmldoc.c (original)
+++ team/mjordan/manager-events/main/xmldoc.c Fri Jun  1 16:21:03 2012
@@ -1098,6 +1098,7 @@
 enum syntaxtype {
 	FUNCTION_SYNTAX,
 	MANAGER_SYNTAX,
+	MANAGER_EVENT_SYNTAX,
 	COMMAND_SYNTAX
 };
 
@@ -1106,10 +1107,11 @@
 	const char *type;
 	enum syntaxtype stxtype;
 } stxtype[] = {
-	{ "function",		FUNCTION_SYNTAX	},
-	{ "application",	FUNCTION_SYNTAX	},
-	{ "manager",		MANAGER_SYNTAX  },
-	{ "agi",		COMMAND_SYNTAX	}
+	{ "function",		FUNCTION_SYNTAX			},
+	{ "application",	FUNCTION_SYNTAX			},
+	{ "manager",		MANAGER_SYNTAX  		},
+	{ "managerEvent",	MANAGER_EVENT_SYNTAX	},
+	{ "agi",			COMMAND_SYNTAX			}
 };
 
 /*! \internal




More information about the svn-commits mailing list