[yelp/wip/amigadave/webkit2-port: 49/53] yelp-uri: Set docuri and fulluri also when resolving an info full path
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/wip/amigadave/webkit2-port: 49/53] yelp-uri: Set docuri and fulluri also when resolving an info full path
- Date: Mon, 22 Jun 2015 14:01:24 +0000 (UTC)
commit f98d8b525be1adda4c5747aebdc5d86814a77a6b
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jun 16 11:09:22 2015 +0200
yelp-uri: Set docuri and fulluri also when resolving an info full path
This way the canonical uri will info:doc#section instead of file://.
libyelp/yelp-uri.c | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index 84108d3..f63b52a 100644
--- a/libyelp/yelp-uri.c
+++ b/libyelp/yelp-uri.c
@@ -1060,12 +1060,43 @@ resolve_info_uri (YelpUri *uri)
gint infopath_i, suffix_i;
if (g_str_has_prefix (priv->res_arg, "info:/")) {
- gchar *newuri;
+ gchar *newuri, *basename;
+ const gchar *hash;
+
priv->tmptype = YELP_URI_DOCUMENT_TYPE_INFO;
newuri = g_strdup_printf ("file:%s", priv->res_arg + 5);
g_free (priv->res_arg);
priv->res_arg = newuri;
+ basename = g_path_get_basename (newuri + 5);
+ hash = g_strrstr (basename, "#");
+ if (hash) {
+ name = g_strndup (basename, hash - basename);
+ sect = g_strdup (hash + 1);
+ } else {
+ name = g_strdup (basename);
+ sect = NULL;
+ }
+ g_free (basename);
+ for (suffix_i = 0; infosuffix[suffix_i]; suffix_i++) {
+ if (g_str_has_suffix (name, infosuffix[suffix_i])) {
+ name[strlen (name) - strlen (infosuffix[suffix_i])] = '\0';
+ break;
+ }
+ }
+
+ priv->docuri = g_strconcat ("info:", name, NULL);
+ if (sect) {
+ priv->fulluri = g_strconcat ("info:", name, "#", sect, NULL);
+ priv->page_id = g_strdup (sect);
+ priv->frag_id = sect;
+ sect = NULL; /* steal memory */
+ } else {
+ priv->fulluri = g_strdup (priv->docuri);
+ }
resolve_file_uri (uri);
+
+ g_free (name);
+ g_free (sect);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]