summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2015-06-16 12:00:26 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2015-06-16 12:47:20 +0200
commit34e3b1ec74bee3b9acc48ee08a8a50d853eeca7b (patch)
treedfcd7c4dbc3cdd378480292de1eb06a0b457e1ff
parent459aa3dd052cf6d2e0441127ff8c1a7c4ed6f7ca (diff)
downloadyelp-34e3b1ec74bee3b9acc48ee08a8a50d853eeca7b.tar.gz
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://.
-rw-r--r--libyelp/yelp-uri.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index f63b52a3..91479593 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 {