[asterisk-commits] eliel: branch group/appdocsxml r145189 - /team/group/appdocsxml/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 30 11:02:42 CDT 2008


Author: eliel
Date: Tue Sep 30 11:02:41 2008
New Revision: 145189

URL: http://svn.digium.com/view/asterisk?view=rev&rev=145189
Log:
Fix arguments in a parameter documentation output

Modified:
    team/group/appdocsxml/main/pbx.c

Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=145189&r1=145188&r2=145189
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Tue Sep 30 11:02:41 2008
@@ -3611,12 +3611,14 @@
 /*! \internal
  *  \brief Parse an <argument> element from the xml documentation.
  *  \param fixnode Pointer to the 'argument' xml node.
+ *  \param insideparameter If we are parsing an <argument> inside a <parameter>.
+ *  \param paramtabs pre tabs if we are inside a parameter element.
  *  \param tabs What to be printed before the argument name.
  *  \param buffer Output buffer to put values found inside the <argument> element.
  *  \retval 1 If there is content inside the argument.
  *  \retval 0 If the argument element is not parsed, or there is no content inside it.
  */
-static int xmldoc_parse_argument(ast_xml_node *fixnode, const char *tabs, struct ast_str **buffer)
+static int xmldoc_parse_argument(ast_xml_node *fixnode, int insideparameter, const char *paramtabs, const char *tabs, struct ast_str **buffer)
 {
 	ast_xml_node *node = fixnode;
 	ast_xml_attr *argname;
@@ -3629,26 +3631,37 @@
 	/* Print the argument names */
 	argname = ast_xml_get_attribute(node, "name");
 	if (argname) {
-		ast_str_append(buffer, 0, "%s%s", tabs, argname);
+		ast_str_append(buffer, 0, "%s%s%s", tabs, argname, (insideparameter ? "\n" : ""));
 		ast_xml_free_attr(argname);
 
 		node = node->AST_XML_CHILD;
 		while (node) {
 			if (count > 0) {
-				if (xmldoc_parse_para(node, tabs, "\n", buffer) == 2) {
+				if (xmldoc_parse_para(node, (insideparameter ? paramtabs : tabs), "\n", buffer) == 2) {
 					count++;
 					ret = 1;
-				} else if (xmldoc_parse_specialtags(node, tabs, "\n", buffer) == 2) {
+				} else if (xmldoc_parse_specialtags(node, (insideparameter ? paramtabs : tabs), "\n", buffer) == 2) {
 					count++;
 					ret = 1;
 				}
 			} else {
-				if (xmldoc_parse_para(node, " - ", "\n", buffer) == 2) {
-					count++;
-					ret = 1;
-				} else if (xmldoc_parse_specialtags(node, " - ", "\n", buffer) == 2) {
-					count++;
-					ret = 1;
+				/* for output style purpose, there is no other difference. */
+				if (insideparameter) {
+					if (xmldoc_parse_para(node, paramtabs, "\n", buffer) == 2) {
+						count++;
+						ret = 1;
+					} else if (xmldoc_parse_specialtags(node, paramtabs, "\n", buffer) == 2) {
+						count++;
+						ret = 1;
+					}
+				} else {
+					if (xmldoc_parse_para(node, " - ", "\n", buffer) == 2) {
+						count++;
+						ret = 1;
+					} else if (xmldoc_parse_specialtags(node, " - ", "\n", buffer) == 2) {
+						count++;
+						ret = 1;
+					}
 				}
 			}
 			node = node->AST_XML_NEXT;
@@ -3806,7 +3819,7 @@
 				/* print \n */
 				ast_str_append(buffer, 0, "\n");
 			}
-			if (xmldoc_parse_argument(node, "        ", buffer)) {
+			if (xmldoc_parse_argument(node, 0, NULL, "        ", buffer)) {
 				ret = 1;
 			}
 			node = node->AST_XML_NEXT;
@@ -3910,7 +3923,7 @@
 		if (!strcasecmp((char *)node->AST_XML_NAME, "optionlist")) {
 			xmldoc_parse_optionlist(node, buffer);
 		} else if (!strcasecmp((char *)node->AST_XML_NAME, "argument")) {
-			xmldoc_parse_argument(node, (hasarguments ? "" : "        "), buffer);
+			xmldoc_parse_argument(node, 1, "    ", (!hasarguments ? "        " : ""), buffer);
 		} else if (!strcasecmp((char *)node->AST_XML_NAME, "para")) {
 			if (!printed) {
 				if (paramname) {




More information about the asterisk-commits mailing list