[svn-commits] eliel: branch group/appdocsxml r135595 - /team/group/appdocsxml/main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 4 18:23:37 CDT 2008


Author: eliel
Date: Mon Aug  4 18:23:36 2008
New Revision: 135595

URL: http://svn.digium.com/view/asterisk?view=rev&rev=135595
Log:
Implement ast_xml_doc_get_formatted() to understand the <para> elements
inside a description,synopsis, or other tag with text content.


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=135595&r1=135594&r2=135595
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Mon Aug  4 18:23:36 2008
@@ -2858,6 +2858,38 @@
 }
 #endif /* if 0 */
 
+/* \brief Return the string within a node formatted with <para> elements. 
+ * \param node Parent node where content resides.
+ * \retval NULL on error
+ * \retval Node content on success.
+ */
+static char *ast_xml_doc_get_formatted(ast_xml_node *node)
+{
+	ast_xml_node *tmp;
+	char *ret = NULL, *tmptext;
+	int len = 0;
+
+	if (!node) {
+		return NULL;
+	}
+
+	tmp = node->AST_XML_CHILD;
+	while (tmp) {
+		if (!strcasecmp((char *)tmp->AST_XML_NAME, "para")) {
+			tmptext = ast_xml_get_text(documentation_tree, tmp);
+			if (tmptext) {
+				ret = ast_realloc(ret, len + strlen(tmptext) + 1);
+				len += sprintf(ret + len, "%s\n", tmptext);
+				ast_xml_free_text(tmptext);
+			}
+		}
+		tmp = tmp->AST_XML_NEXT;
+	}
+	
+	return ret;
+}
+
+/*! \brief TODO: complete doc. */
 static char *ast_xml_doc_get_field(const char *type, const char *name, const char *var)
 {
 	ast_xml_node *node, *ret = NULL;
@@ -2909,7 +2941,7 @@
 		return NULL;
 	}
 
-	return ast_xml_get_text(documentation_tree, ret);
+	return ast_xml_doc_get_formatted(ret);
 }
 #endif /* XML_DOCUMENTATION */
 




More information about the svn-commits mailing list