Esempio n. 1
0
static gchar *
htmlview_render_item (itemPtr item, 
                      guint viewMode,
                      gboolean summaryMode) 
{
	renderParamPtr	params;
	gchar		*output = NULL, *baseUrl = NULL;
	nodePtr		node;
	xmlDocPtr 	doc;
	xmlNodePtr 	xmlNode;
	const gchar     *text_direction = NULL;
	gboolean	isMergedItemset;

	debug_enter ("htmlview_render_item");

	/* don't use node from htmlView_priv as this would be
	   wrong for folders and other merged item sets */
	node = node_from_id (item->nodeId);
	
	isMergedItemset = (node != htmlView_priv.node);

	/* do the XML serialization */
	doc = xmlNewDoc ("1.0");
	xmlNode = xmlNewDocNode (doc, NULL, "itemset", NULL);
	xmlDocSetRootElement (doc, xmlNode);
				
	item_to_xml(item, xmlDocGetRootElement (doc));

	text_direction = htmlview_get_item_direction (item);
			
	if (IS_FEED (node)) {
		xmlNodePtr feed;
		feed = xmlNewChild (xmlDocGetRootElement (doc), NULL, "feed", NULL);
		feed_to_xml (node, feed);
	}
	
	/* do the XSLT rendering */
	params = render_parameter_new ();
	
	if (NULL != node_get_base_url (node)) {
		baseUrl = common_uri_escape (node_get_base_url (node));
		render_parameter_add (params, "baseUrl='%s'", baseUrl);
	}

	render_parameter_add (params, "summary='%d'", summaryMode?1:0);
	render_parameter_add (params, "showFeedName='%d'", isMergedItemset?1:0);
	render_parameter_add (params, "single='%d'", (viewMode == ITEMVIEW_SINGLE_ITEM)?1:0);
	render_parameter_add (params, "txtDirection='%s'", text_direction);
	render_parameter_add (params, "appDirection='%s'", common_get_app_direction ());
	output = render_xml (doc, "item", params);
	
	/* For debugging use: xmlSaveFormatFile("/tmp/test.xml", doc, 1); */
	xmlFreeDoc (doc);
	g_free (baseUrl);
	
	debug_exit ("htmlview_render_item");

	return output;
}
Esempio n. 2
0
gchar *
node_default_render (nodePtr node)
{
	gchar		*result;
	xmlDocPtr	doc;

	doc = node_to_xml (node);
	result = render_xml (doc, NODE_TYPE(node)->id, NULL);
	xmlFreeDoc (doc);

	return result;
}