[yelp/wip/amigadave/webkit2-port: 51/53] yelp-uri: Set docuri and fulluri also when resolving a man full path
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/wip/amigadave/webkit2-port: 51/53] yelp-uri: Set docuri and fulluri also when resolving a man full path
- Date: Mon, 22 Jun 2015 14:01:34 +0000 (UTC)
commit 73b47e275ab57e29e86af4d34964e024bf5d404f
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jun 16 12:00:26 2015 +0200
yelp-uri: Set docuri and fulluri also when resolving a man full path
This way the canonical uri will man:doc.section instead of file://.
libyelp/yelp-uri.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index f63b52a..9147959 100644
--- a/libyelp/yelp-uri.c
+++ b/libyelp/yelp-uri.c
@@ -999,10 +999,24 @@ resolve_man_uri (YelpUri *uri)
0, &match_info)) {
/* The regexp didn't match, so treat as a file name. */
gchar *newuri;
+ guint i;
+ static const char *man_suffixes[] = { "gz", "bz2", "lzma", NULL };
+
priv->tmptype = YELP_URI_DOCUMENT_TYPE_MAN;
newuri = g_strdup_printf ("file:%s", priv->res_arg + 4);
g_free (priv->res_arg);
priv->res_arg = newuri;
+ name = g_path_get_basename (newuri + 5);
+ for (i = 0; i < G_N_ELEMENTS (man_suffixes); i++) {
+ if (is_man_path (name, man_suffixes[i])) {
+ if (man_suffixes[i])
+ name[strlen (name) - strlen (man_suffixes[i]) - 1] = '\0';
+ break;
+ }
+ }
+ priv->docuri = g_strdup ("man:");
+ priv->fulluri = g_strconcat ("man:", name, NULL);
+ priv->page_id = name;
resolve_file_uri (uri);
}
else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]