diff options
author | Don Scorgie <dscorgie@src.gnome.org> | 2007-03-25 20:36:28 +0000 |
---|---|---|
committer | Don Scorgie <dscorgie@src.gnome.org> | 2007-03-25 20:36:28 +0000 |
commit | 65c3ceb070c1a360fb27079c15675aecd6b89871 (patch) | |
tree | 5500f78427373a57ff99473437c38a3ef80be70c | |
parent | 4c923474fe76c17ae79966d7b4f4faa2129ea2b4 (diff) | |
download | yelp-65c3ceb070c1a360fb27079c15675aecd6b89871.tar.gz |
First pass at spoon integration TOC correctly displayed, replacing all sk
* stylesheets/toc2html.xsl:
* src/yelp-toc-pager.c:
First pass at spoon integration
TOC correctly displayed, replacing all sk code
with spoon_for_each_in_category()
svn path=/branches/yelp-spoon/; revision=2792
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/yelp-toc-pager.c | 28 | ||||
-rw-r--r-- | stylesheets/toc2html.xsl | 2 |
3 files changed, 26 insertions, 10 deletions
@@ -1,5 +1,11 @@ 2007-03-25 Don Scorgie <dscorgie@cvs.gnome.org> + * stylesheets/toc2html.xsl: + * src/yelp-toc-pager.c: + First pass at spoon integration + TOC correctly displayed, replacing all sk code + with spoon_for_each_in_category() + * src/yelp-toc-pager.c: * configure.in: First work on Spoon integration diff --git a/src/yelp-toc-pager.c b/src/yelp-toc-pager.c index c1fafd0e..72587779 100644 --- a/src/yelp-toc-pager.c +++ b/src/yelp-toc-pager.c @@ -463,7 +463,7 @@ toc_process_pending (YelpTocPager *pager) YelpTocPagerPriv *priv = pager->priv; static ProcessFunction process_funcs[] = { process_read_menu, - process_omf_pending, + /*process_omf_pending,*/ #ifdef ENABLE_MAN process_mandir_pending, #endif @@ -1799,13 +1799,20 @@ process_info_pending (YelpTocPager *pager) #endif /* ENABLE_INFO */ static int -SpoonPrint( void *reg, void * data) +spoon_add_document (void *reg, void * user_data) { + xmlNodePtr node = (xmlNodePtr) user_data; SpoonReg *r = (SpoonReg *) reg; - - g_print ("Name: %s\n", r->name); + xmlNodePtr new; + gchar tmp[10]; - return TRUE; + new = xmlNewChild (node, NULL, BAD_CAST "doc", NULL); + xmlNewNsProp (new, NULL, BAD_CAST "href", BAD_CAST r->uri); + xmlNewTextChild (new, NULL, BAD_CAST "title", BAD_CAST r->name); + xmlNewTextChild (new, NULL, BAD_CAST "description", BAD_CAST r->comment); + g_sprintf (&tmp, "%d", r->weight); + xmlNewNsProp (new, NULL, BAD_CAST "weight", BAD_CAST tmp); + return FALSE; } static gboolean @@ -1818,9 +1825,7 @@ process_read_menu (YelpTocPager *pager) gint i, ret; YelpTocPagerPriv *priv = pager->priv; - g_print ("for_eaching\n"); - spoon_for_each (SpoonPrint, NULL); - g_print ("Ended\n"); + priv->toc_doc = xmlCtxtReadFile (priv->parser, DATADIR "/yelp/toc.xml", NULL, XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOENT | XML_PARSE_NOERROR | @@ -1922,9 +1927,12 @@ process_read_menu (YelpTocPager *pager) BAD_CAST "subject")) { xmlChar *cat = xmlTextReaderGetAttribute (reader, BAD_CAST "category"); - g_hash_table_insert (priv->category_hash, + /*g_hash_table_insert (priv->category_hash, g_strdup ((gchar *) cat), - node); + node);*/ + spoon_for_each_in_category (spoon_add_document, + (char *) cat, + (void *) node); xmlFree (cat); } else if (!xmlStrcmp (xmlTextReaderConstLocalName (reader), diff --git a/stylesheets/toc2html.xsl b/stylesheets/toc2html.xsl index 5be5b544..0fa28cd7 100644 --- a/stylesheets/toc2html.xsl +++ b/stylesheets/toc2html.xsl @@ -151,6 +151,8 @@ <div class="docs"> <dl> <xsl:for-each select="doc"> + <xsl:sort order="ascending" data-type="number" + select="normalize-space(@weight)"/> <xsl:sort select="normalize-space(title)"/> <dt class="doc"> <a href="{@href}" title="{@href}"> |