174
// FIXME: bad naming -> unclear concept!
176
itemset_to_xml (nodePtr node)
171
htmlview_get_item_direction(itemPtr item)
179
xmlNodePtr itemSetNode;
181
doc = xmlNewDoc ("1.0");
182
itemSetNode = xmlNewDocNode (doc, NULL, "itemset", NULL);
184
xmlDocSetRootElement (doc, itemSetNode);
186
xmlNewTextChild (itemSetNode, NULL, "favicon", node_get_favicon_file (node));
187
xmlNewTextChild (itemSetNode, NULL, "title", node_get_title (node));
189
if (node->subscription) {
190
if (subscription_get_source (node->subscription))
191
xmlNewTextChild (itemSetNode, NULL, "source", subscription_get_source (node->subscription));
193
if (subscription_get_homepage (node->subscription))
194
xmlNewTextChild (itemSetNode, NULL, "link", subscription_get_homepage (node->subscription));
173
if (item_get_title (item))
174
return (common_get_text_direction (item_get_title (item)));
176
if (item_get_description (item))
177
return (common_get_text_direction (item_get_description (item)));
179
/* what can we do? */
203
186
gboolean summaryMode)
205
188
renderParamPtr params;
206
gchar *output = NULL, *baseUrl;
189
gchar *output = NULL, *baseUrl = NULL;
193
const gchar *text_direction = NULL;
210
195
debug_enter ("htmlview_render_item");
212
197
/* don't use node from htmlView_priv as this would be
213
198
wrong for folders and other merged item sets */
214
199
node = node_from_id (item->nodeId);
215
baseUrl = common_uri_escape (node_get_base_url (node));
217
201
/* do the XML serialization */
218
doc = itemset_to_xml (node);
202
doc = xmlNewDoc ("1.0");
203
xmlNode = xmlNewDocNode (doc, NULL, "itemset", NULL);
204
xmlDocSetRootElement (doc, xmlNode);
220
206
item_to_xml(item, xmlDocGetRootElement (doc));
208
text_direction = htmlview_get_item_direction (item);
222
210
if (IS_FEED (node)) {
224
feed = xmlNewChild(xmlDocGetRootElement(doc), NULL, "feed", NULL);
225
feed_to_xml(node, feed);
212
feed = xmlNewChild (xmlDocGetRootElement (doc), NULL, "feed", NULL);
213
feed_to_xml (node, feed);
228
216
/* do the XSLT rendering */
229
217
params = render_parameter_new ();
230
render_parameter_add (params, "pixmapsDir='file://" PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "'");
231
render_parameter_add (params, "baseUrl='%s'", baseUrl);
219
if (NULL != node_get_base_url (node)) {
220
baseUrl = common_uri_escape (node_get_base_url (node));
221
render_parameter_add (params, "baseUrl='%s'", baseUrl);
232
224
render_parameter_add (params, "summary='%d'", summaryMode?1:0);
233
225
render_parameter_add (params, "single='%d'", (viewMode == ITEMVIEW_SINGLE_ITEM)?1:0);
226
render_parameter_add (params, "txtDirection='%s'", text_direction);
227
render_parameter_add (params, "appDirection='%s'", common_get_app_direction ());
234
228
output = render_xml (doc, "item", params);
236
230
/* For debugging use: xmlSaveFormatFile("/tmp/test.xml", doc, 1); */