summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Smith <bmsmith@src.gnome.org>2006-05-29 19:32:29 +0000
committerBrent Smith <bmsmith@src.gnome.org>2006-05-29 19:32:29 +0000
commitd811fb694d25f340016803af0550432c91002c9e (patch)
tree66bc3ef959c62c6d99e6594b164f9b8c8d8bcdc6
parent3b26a2b7c6550dfa5c705899e47e99b7a91a741f (diff)
downloadyelp-d811fb694d25f340016803af0550432c91002c9e.tar.gz
Backports from HEAD fix the applyto element for the use_caret gconf key
Backports from HEAD * data/yelp.schemas.in: fix the applyto element for the use_caret gconf key * src/yelp-man-parser.c: (macro_reference_handler), (parser_append_given_text_handle_escapes): When a man page uses the .so macro to include another file, just provide a link to the file; Only works for man pages that have .so as the first and only macro; sort of fixes #340173 * src/yelp-toc-pager.c: (process_mandir_pending): Only write a mansect element when we have a non empty linked list of directories (Backports from HEAD)
-rw-r--r--ChangeLog16
-rw-r--r--data/yelp.schemas.in2
-rw-r--r--src/yelp-man-parser.c46
-rw-r--r--src/yelp-toc-pager.c19
4 files changed, 72 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 118cf2ca..ab405783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-05-29 Brent Smith <gnome@nextreality.net>
+
+ * data/yelp.schemas.in: fix the applyto element for the use_caret
+ gconf key
+ * src/yelp-man-parser.c: (macro_reference_handler),
+ (parser_append_given_text_handle_escapes):
+ When a man page uses the .so macro to include another file, just
+ provide a link to the file; Only works for man pages that have
+ .so as the first and only macro; sort of fixes #340173
+ * src/yelp-toc-pager.c: (process_mandir_pending):
+ Only write a mansect element when we have a non empty linked list of
+ directories
+ (Backports from HEAD)
+
+==================== 2.14.1 ====================
+
2006-04-09 Brent Smith <gnome@nextreality.net>
* NEWS:
diff --git a/data/yelp.schemas.in b/data/yelp.schemas.in
index 8803bf65..3c257c8d 100644
--- a/data/yelp.schemas.in
+++ b/data/yelp.schemas.in
@@ -3,7 +3,7 @@
<schemalist>
<schema>
<key>/schemas/apps/yelp/use_caret</key>
- <applyto>/apps/yelp/use_system_fonts</applyto>
+ <applyto>/apps/yelp/use_caret</applyto>
<owner>yelp</owner>
<type>bool</type>
<default>true</default>
diff --git a/src/yelp-man-parser.c b/src/yelp-man-parser.c
index 019ce85d..dc678850 100644
--- a/src/yelp-man-parser.c
+++ b/src/yelp-man-parser.c
@@ -676,6 +676,48 @@ macro_verbatim_handler (YelpManParser *parser, gchar *macro, GSList *args)
}
}
+static void
+macro_reference_handler (YelpManParser *parser, gchar *macro, GSList *args)
+{
+ if (g_str_equal (macro, "so")) {
+ gchar *basename = NULL;
+ gchar *link = NULL;
+
+ if (args && args->data) {
+ basename = g_strrstr((const gchar *)args->data, "/");
+
+ basename++;
+
+ if (basename)
+ link = g_strdup_printf ("man:%s", basename);
+ else {
+ link = g_strdup_printf ("man:%s", (const gchar *)args->data);
+ basename = (gchar *)args->data;
+ }
+
+ parser->ins = parser_append_node (parser, "TH");
+ parser->ins = parser_append_node (parser, "Title");
+ parser_append_given_text (parser, "REFERENCE");
+ parser->ins = parser->ins->parent;
+ parser->ins = parser->ins->parent;
+
+ parser->ins = parser_append_node_attr (parser, "SH", "id", "9999");
+ parser_append_given_text (parser, "REFERENCE");
+ parser->ins = parser->ins->parent;
+
+ parser_append_given_text (parser, "See ");
+ parser->ins = parser_append_node (parser, "UR");
+ parser->ins = parser_append_node (parser, "URI");
+ parser_append_given_text (parser, link);
+ parser->ins = parser->ins->parent;
+ parser_append_given_text (parser, basename);
+ parser->ins = parser->ins->parent;
+
+ g_free (link);
+ }
+ }
+}
+
/* many mandoc macros have their arguments parsed so that other
* macros can be called to operate on their arguments. This table
* indicates which macros are _parsed_ for other callable macros,
@@ -961,7 +1003,7 @@ struct MacroHandler macro_handlers[] = {
{ "SH", macro_section_header_handler }, /* man: unnumbered section heading */
{ "Sh", macro_section_header_handler }, /* man: unnumbered section heading */
{ "SM", macro_bold_small_italic_handler }, /* man: set font size one SMaller */
- { "so", macro_ignore_handler }, /* groff: include file */
+ { "so", macro_reference_handler }, /* groff: include file */
{ "sp", macro_spacing_handler }, /* groff: */
{ "SS", macro_section_header_handler }, /* man: unnumbered subsection heading */
{ "Ss", macro_section_header_handler }, /* man: unnumbered subsection heading */
@@ -1400,7 +1442,7 @@ parser_append_given_text_handle_escapes (YelpManParser *parser, gchar *text, gbo
g_free (str);
}
- anc = ++ptr;
+ anc = ptr;
break;
case 'e':
anc = ++ptr;
diff --git a/src/yelp-toc-pager.c b/src/yelp-toc-pager.c
index d2ad901b..334d1d6f 100644
--- a/src/yelp-toc-pager.c
+++ b/src/yelp-toc-pager.c
@@ -887,7 +887,7 @@ process_mandir_pending (YelpTocPager *pager)
/* check for the existence of the xml cache file in ~/.gnome2/yelp.d/
* if it exists, use it as the source for man pages instead of
* searching the hard disk for them - should make startup much faster */
- if (g_file_test (index_file, G_FILE_TEST_EXISTS) &&
+ if (g_file_test (index_file, G_FILE_TEST_IS_REGULAR) &&
create_toc_from_index (pager, index_file)) {
/* we are done.. */
@@ -940,13 +940,6 @@ process_mandir_pending (YelpTocPager *pager)
/* iterate through our previously created linked lists and create the
* table of contents from them */
else {
- if (!priv->man_manhash) {
- priv->man_manhash = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, NULL);
-
- priv->ins = xmlNewChild (priv->root, NULL, BAD_CAST "mansect", NULL);
- xmlAddChild (priv->ins, xmlNewText (BAD_CAST "\n "));
- }
if (priv->mandir_langpath && priv->mandir_langpath->data) {
dirname = priv->mandir_langpath->data;
@@ -958,6 +951,16 @@ process_mandir_pending (YelpTocPager *pager)
if (g_stat (dirname, &buf) < 0)
g_warning ("Unable to stat dir: \"%s\"\n", dirname);
+ /* check to see if we need create a new hash table */
+ if (!priv->man_manhash) {
+ priv->man_manhash =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, NULL);
+
+ priv->ins = xmlNewChild (priv->root, NULL, BAD_CAST "mansect", NULL);
+ xmlAddChild (priv->ins, xmlNewText (BAD_CAST "\n "));
+ }
+
g_snprintf (mtime_str, 20, "%u", (guint) buf.st_mtime);
priv->ins = xmlNewChild (priv->ins, NULL, BAD_CAST "dir", NULL);