summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2010-04-27 14:11:03 -0500
committerShaun McCance <shaunm@gnome.org>2010-04-27 14:11:03 -0500
commit7ac0dfbc56a86a23db41181b19ccb60981377a0c (patch)
tree2f6218b87d0a734d56cd76dd96baf1827cce4c49
parente692616ad3ce74cd12c35e1d65609f8eedabd129 (diff)
downloadyelp-7ac0dfbc56a86a23db41181b19ccb60981377a0c.tar.gz
[info2html] Link trails in info documents
-rw-r--r--libyelp/yelp-info-parser.c13
-rw-r--r--stylesheets/info2html.xsl.in24
2 files changed, 34 insertions, 3 deletions
diff --git a/libyelp/yelp-info-parser.c b/libyelp/yelp-info-parser.c
index e6f58df7..cbca0e47 100644
--- a/libyelp/yelp-info-parser.c
+++ b/libyelp/yelp-info-parser.c
@@ -567,7 +567,7 @@ process_page (GtkTreeStore *tree, GHashTable *nodes2offsets,
}
/* by this point our parent and older sibling should be processed */
- if (!up || !g_ascii_strcasecmp (up, "(dir)") || !strcmp (up, "Top"))
+ if (!up || !g_ascii_strcasecmp (up, "(dir)"))
{
debug_print (DB_DEBUG, "\t> no parent\n");
if (!prev || !g_ascii_strcasecmp (prev, "(dir)"))
@@ -817,7 +817,7 @@ GtkTreeStore
static void
parse_tree_level (GtkTreeStore *tree, xmlNodePtr *node, GtkTreeIter iter)
{
- GtkTreeIter children;
+ GtkTreeIter children, parent;
xmlNodePtr newnode;
char *page_no = NULL;
@@ -857,6 +857,15 @@ parse_tree_level (GtkTreeStore *tree, xmlNodePtr *node, GtkTreeIter iter)
g_free (page_content);
page_content = NULL;
+ if (gtk_tree_model_iter_parent (GTK_TREE_MODEL (tree), &parent, &iter)) {
+ gchar *parent_id;
+ gtk_tree_model_get (GTK_TREE_MODEL (tree), &parent,
+ INFO_PARSER_COLUMN_PAGE_NO, &parent_id,
+ -1);
+ xmlNewProp (newnode, BAD_CAST "up", BAD_CAST parent_id);
+ g_free (parent_id);
+ }
+
xmlNewProp (newnode, BAD_CAST "id",
BAD_CAST page_no);
xmlNewProp (newnode, BAD_CAST "name",
diff --git a/stylesheets/info2html.xsl.in b/stylesheets/info2html.xsl.in
index fb5619f7..00704c71 100644
--- a/stylesheets/info2html.xsl.in
+++ b/stylesheets/info2html.xsl.in
@@ -12,6 +12,20 @@
<xsl:import href="@XSL_THEME_HTML@"/>
<xsl:include href="yelp-common.xsl"/>
+<xsl:template name="linktrails">
+ <xsl:param name="up" select="@up"/>
+ <xsl:variable name="upnode" select="/Info//Section[@id = $up]"/>
+ <xsl:if test="$upnode/@up">
+ <xsl:call-template name="linktrails">
+ <xsl:with-param name="up" select="$upnode/@up"/>
+ </xsl:call-template>
+ </xsl:if>
+ <a href="xref:{$upnode/@id}">
+ <xsl:value-of select="$upnode/@name"/>
+ </a>
+ <xsl:text>&#x00A0;ยป </xsl:text>
+</xsl:template>
+
<xsl:template match="/Info">
<xsl:apply-templates select="Section"/>
</xsl:template>
@@ -28,7 +42,15 @@
</style>
</head>
<body>
- <div class="head"/>
+ <div class="head">
+ <xsl:if test="@up">
+ <div class="trails">
+ <div class="trail">
+ <xsl:call-template name="linktrails"/>
+ </div>
+ </div>
+ </xsl:if>
+ </div>
<div class="body">
<xsl:apply-templates select="node()[not(self::Section)]"/>
</div>