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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 29 08:58:02 CDT 2008


Author: eliel
Date: Mon Sep 29 08:58:01 2008
New Revision: 145174

URL: http://svn.digium.com/view/asterisk?view=rev&rev=145174
Log:
Fix the output style.

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=145174&r1=145173&r2=145174
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Mon Sep 29 08:58:01 2008
@@ -3649,7 +3649,7 @@
 	ast_xml_attr *valname;
 	ast_xml_text *tmptext;
 	struct ast_str *cleanstr = NULL;
-	int ret = 0;
+	int ret = 0, printedpara=0;
 
 	if (!node || !node->AST_XML_CHILD) {
 		return ret;
@@ -3658,37 +3658,38 @@
 	tmp = node->AST_XML_CHILD;
 	while (tmp) {
 		if (xmldoc_parse_para(tmp, (ret ? tabs : ""), "\n", buffer)) {
+			printedpara = 1;
 			tmp = tmp->AST_XML_NEXT;
 			continue;
 		} else if (xmldoc_parse_specialtags(tmp, (ret ? tabs : ""), "\n", buffer)) {
+			printedpara = 1;
 			tmp = tmp->AST_XML_NEXT;
 			continue;
 		}
 
 		if (!strcasecmp((char *)tmp->AST_XML_NAME, "value")) {
-			/* We do this first just to know if there is any comment inside <value>
-			   and know how to print the name of the value. */
-			tmptext = ast_xml_get_text(tmp);
-
+			if (!printedpara) {
+				ast_str_append(buffer, 0, "\n");
+				printedpara = 1;
+			}
 			/* Parse each <value name='valuename'>desciption</value> */
 			valname = ast_xml_get_attribute(tmp, "name");
 			if (valname) {
-				if (!ret) {
-					ast_str_append(buffer, 0, "\n");
-				}
 				ret = 1;
-				ast_str_append(buffer, 0, "%s%s%c", tabs, valname, (tmptext ? ':' : '\n'));
+				ast_str_append(buffer, 0, "%s%s", tabs, valname);
 				ast_xml_free_attr(valname);
 			}
+			tmptext = ast_xml_get_text(tmp);
 			/* Check inside this node for any explanation about its meaning. */
 			if (tmptext) {
 				/* Cleanup text. */
 				xmldoc_string_cleanup(tmptext, &cleanstr);
 				ast_xml_free_text(tmptext);
-				if (cleanstr) {
-					ast_str_append(buffer, 0, " %s\n", cleanstr->str);
+				if (cleanstr && cleanstr->used > 0) {
+					ast_str_append(buffer, 0, ":%s", cleanstr->str);
 					ast_free(cleanstr);
 				}
+				ast_str_append(buffer, 0, "\n");
 			}
 		}
 		tmp = tmp->AST_XML_NEXT;




More information about the asterisk-commits mailing list