summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2010-03-31 13:10:54 -0500
committerShaun McCance <shaunm@gnome.org>2010-03-31 13:10:54 -0500
commit3a6895ca84ef15e630d6ae168e9200bfff676685 (patch)
tree3d9b325a883532b39b6ad0330c50c728af51e46e
parentadb9fe104bfbc7d99f7bc710c66140784b8c1af8 (diff)
downloadyelp-3a6895ca84ef15e630d6ae168e9200bfff676685.tar.gz
[yelp-view.c] Drop frag IDs when possible for DocBook, don't scroll past link trail
-rw-r--r--libyelp/yelp-view.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 725bafd9..24a1220c 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