[yelp/yelp-3-0] [yelp-view.c] Drop frag IDs when possible for DocBook, don't scroll past link trail
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/yelp-3-0] [yelp-view.c] Drop frag IDs when possible for DocBook, don't scroll past link trail
- Date: Wed, 31 Mar 2010 23:34:10 +0000 (UTC)
commit 3a6895ca84ef15e630d6ae168e9200bfff676685
Author: Shaun McCance <shaunm gnome org>
Date: Wed Mar 31 13:10:54 2010 -0500
[yelp-view.c] Drop frag IDs when possible for DocBook, don't scroll past link trail
libyelp/yelp-view.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 725bafd..24a1220 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -32,6 +32,7 @@
#include <webkit/webkitwebresource.h>
#include "yelp-debug.h"
+#include "yelp-docbook-document.h"
#include "yelp-error.h"
#include "yelp-types.h"
#include "yelp-view.h"
@@ -705,6 +706,21 @@ document_callback (YelpDocument *document,
contents = yelp_document_read_contents (document, page_id);
frag_id = yelp_uri_get_frag_id (priv->uri);
g_free (priv->bogus_uri);
+ /* We don't have actual page and frag IDs for DocBook. We just map IDs
+ of block elements. The result is that we get xref:someid#someid.
+ If someid is really the page ID, we just drop the frag reference.
+ Otherwise, normal page views scroll past the link trail.
+ */
+ if (frag_id != NULL) {
+ if (YELP_IS_DOCBOOK_DOCUMENT (document)) {
+ gchar *real_id = yelp_document_get_page_id (document, page_id);
+ if (g_str_equal (real_id, frag_id)) {
+ g_free (frag_id);
+ frag_id = NULL;
+ }
+ g_free (real_id);
+ }
+ }
/* We have to give WebKit a URI in a scheme it understands, otherwise we
won't get the resource-request-starting signal. So we can't use the
canonical URI, because it might be something like ghelp. We also have
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]