diff options
-rw-r--r-- | src/yelp-html.cpp | 11 | ||||
-rw-r--r-- | src/yelp-window.c | 9 | ||||
-rw-r--r-- | stylesheets/db2html.xsl.in | 2 | ||||
-rw-r--r-- | stylesheets/mal2html.xsl.in | 4 |
4 files changed, 21 insertions, 5 deletions
diff --git a/src/yelp-html.cpp b/src/yelp-html.cpp index edd87888..aa9371da 100644 --- a/src/yelp-html.cpp +++ b/src/yelp-html.cpp @@ -24,6 +24,8 @@ #include <mozilla-config.h> #include <config.h> +#include <string.h> + #include "yelp-gecko-services.h" #include "yelp-gecko-utils.h" #include "yelp-marshal.h" @@ -90,13 +92,20 @@ static gint html_open_uri (GtkMozEmbed *embed, const gchar *uri) { YelpHtml *html = YELP_HTML (embed); - gboolean block_load; + gboolean block_load = FALSE; g_return_val_if_fail (uri != NULL, FALSE); debug_print (DB_FUNCTION, "entering\n"); debug_print (DB_ARG, " uri = \"%s\"\n", uri); + if (g_str_equal (html->priv->base_uri, uri)) { + /* As of xulrunner 1.6.2, open_uri is called in response + to the base URI we pass in. + */ + return FALSE; + } + if (!html->priv->frames_enabled) { g_signal_emit (html, signals[URI_SELECTED], 0, uri, FALSE); block_load = TRUE; diff --git a/src/yelp-window.c b/src/yelp-window.c index d436f24e..401e0599 100644 --- a/src/yelp-window.c +++ b/src/yelp-window.c @@ -1849,14 +1849,21 @@ html_uri_selected_cb (YelpHtml *html, gboolean handled, gpointer user_data) { + gchar *new_uri = uri; YelpWindow *window = YELP_WINDOW (user_data); debug_print (DB_FUNCTION, "entering\n"); debug_print (DB_ARG, " uri = \"%s\"\n", uri); + if (g_str_has_prefix (uri, "xref:")) + new_uri = g_strconcat (window->priv->base_uri, "#", uri + 5, NULL); + if (!handled) { - yelp_window_load (window, uri); + yelp_window_load (window, new_uri); } + + if (new_uri != uri) + g_free (new_uri); } static gboolean diff --git a/stylesheets/db2html.xsl.in b/stylesheets/db2html.xsl.in index 1ebf44ea..b68f153a 100644 --- a/stylesheets/db2html.xsl.in +++ b/stylesheets/db2html.xsl.in @@ -68,7 +68,7 @@ FIXME: yelp:cache no longer works <!-- == db.xref.target == --> <xsl:template name="db.xref.target"> <xsl:param name="linkend"/> - <xsl:value-of select="concat('#', $linkend)"/> + <xsl:value-of select="concat('xref:', $linkend)"/> </xsl:template> <!-- == db2html.css.custom == --> diff --git a/stylesheets/mal2html.xsl.in b/stylesheets/mal2html.xsl.in index 37560a71..9a55fccc 100644 --- a/stylesheets/mal2html.xsl.in +++ b/stylesheets/mal2html.xsl.in @@ -44,10 +44,10 @@ <xsl:when test="contains($xref, '#')"> <xsl:variable name="pageid" select="substring-before($xref, '#')"/> <xsl:variable name="sectionid" select="substring-after($xref, '#')"/> - <xsl:value-of select="concat('#', $pageid, '/', $sectionid)"/> + <xsl:value-of select="concat('xref:', $pageid, '/', $sectionid)"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat('#', $xref)"/> + <xsl:value-of select="concat('xref:', $xref)"/> </xsl:otherwise> </xsl:choose> </xsl:template> |