diff options
author | Ali Abdin <aliabdin@aucegypt.edu> | 2000-08-05 18:02:09 +0000 |
---|---|---|
committer | Ali Abdin <rakholh@src.gnome.org> | 2000-08-05 18:02:09 +0000 |
commit | 598ae456e3289673300fa4c4109554d7ffd847c0 (patch) | |
tree | 755078bcf0b463bb7df517dcf2e75588b5549ad4 /components | |
parent | a8fab69bf572aa67b7308008f5b135147138d4bf (diff) | |
download | nautilus-598ae456e3289673300fa4c4109554d7ffd847c0.tar.gz |
In summary, get Docbook XML working. Support JPEG images. Make PNG default
2000-08-05 Ali Abdin <aliabdin@aucegypt.edu>
In summary, get Docbook XML working. Support JPEG images. Make PNG
default image. Fix the GUIMENU/GUISUBMENU tags.
* components/help/help-method.c:
(help_uri_to_string),
(convert_file_to_uri):
Support text/xml as a possible help file (Docbook XML). Also if we
don't recognize the help file, mark it as 'UNKNOWN_FILE' and handle it
gracefully (should now not reach g_assert_not_reached in the code)
* components/help/converters/gnome-db2html2/gdb3html.h,
* components/help/converters/gnome-db2html2/sect-elements.c,
* components/help/converters/gnome-db2html2/toc-elements.c:
Add the "articleinfo" tag to act just like the "artheader" tag (the
former is Docbook XML and the latter is Docbook SGML).
* components/help/converters/gnome-db2html2/sect-elements.c:
(sect_graphic_start_element): Small fix to match Eazel style
guidelines. Add support for JPEG/JPG image types. Make PNG the default
image type if the 'format' attribute in the graphic element is not
found.
(sect_b_arrow_end_element): New function.
Also - removed MENUCHOICE tag, and made GUIMENU and GUISUBMENU use
sect_b_arrow_end_element.
Diffstat (limited to 'components')
6 files changed, 49 insertions, 21 deletions
diff --git a/components/help/converters/gnome-db2html2/gdb3html.h b/components/help/converters/gnome-db2html2/gdb3html.h index 79fde4f57..ba1fafe4b 100644 --- a/components/help/converters/gnome-db2html2/gdb3html.h +++ b/components/help/converters/gnome-db2html2/gdb3html.h @@ -19,73 +19,73 @@ typedef enum ElementIndex { FORMALPARA, BOOKINFO, /* 10 */ ARTHEADER, + ARTICLEINFO, AUTHORGROUP, AUTHOR, FIRSTNAME, - OTHERNAME, /* 15 */ + OTHERNAME, /* 16 */ SURNAME, AFFILIATION, EMAIL, ORGNAME, - ADDRESS, /* 20 */ + ADDRESS, /* 21 */ COPYRIGHT, YEAR, HOLDER, TITLE, - SUBTITLE, /* 25 */ + SUBTITLE, /* 26 */ ULINK, XREF, FOOTNOTE, FIGURE, - GRAPHIC, /* 30 */ + GRAPHIC, /* 31 */ CITETITLE, APPLICATION, FILENAME, ITEMIZEDLIST, - ORDEREDLIST, /* 35 */ + ORDEREDLIST, /* 36 */ VARIABLELIST, LISTITEM, PROGRAMLISTING, SGMLTAG, - EMPHASIS, /* 40 */ + EMPHASIS, /* 41 */ TIP, WARNING, IMPORTANT, NOTE, - CDATA, /* 45 */ + CDATA, /* 46 */ SCREEN, SCREENSHOT, SCREENINFO, COMMAND, - REPLACEABLE, /* 50 */ + REPLACEABLE, /* 51 */ FUNCTION, GUIBUTTON, GUIICON, GUILABEL, - GUIMENU, /* 55 */ + GUIMENU, /* 56 */ GUIMENUITEM, HARDWARE, KEYCAP, KEYCODE, - KEYSYM, /* 60 */ + KEYSYM, /* 61 */ LITERAL, PARAMETER, PROMPT, SYMBOL, - USERINPUT, /* 65 */ + USERINPUT, /* 66 */ CAUTION, LEGALPARA, FIRSTTERM, STRUCTNAME, - STRUCTFIELD, /* 70 */ + STRUCTFIELD, /* 71 */ FUNCSYNOPSIS, FUNCPROTOTYPE, FUNCDEF, FUNCPARAMS, - PARAMDEF, /* 75 */ + PARAMDEF, /* 76 */ VOID, GUISUBMENU, - MENUCHOICE, UNDEFINED /* 79 */ } ElementIndex; diff --git a/components/help/converters/gnome-db2html2/sect-elements.c b/components/help/converters/gnome-db2html2/sect-elements.c index 4c7c6e483..6dd42731b 100644 --- a/components/help/converters/gnome-db2html2/sect-elements.c +++ b/components/help/converters/gnome-db2html2/sect-elements.c @@ -17,6 +17,7 @@ ElementInfo sect_elements[] = { { FORMALPARA, "formalpara", (startElementSAXFunc) sect_formalpara_start_element, (endElementSAXFunc) sect_formalpara_end_element, NULL }, { BOOKINFO, "bookinfo", NULL, NULL, NULL}, { ARTHEADER, "artheader", NULL, NULL, NULL}, //(startElementSAXFunc) artheader_start_element, (endElementSAXFunc) sect_artheader_end_element, NULL}, + { ARTICLEINFO, "articleinfo", NULL, NULL, NULL}, { AUTHORGROUP, "authorgroup", NULL, NULL, NULL}, { AUTHOR, "author", (startElementSAXFunc) sect_author_start_element, NULL, NULL}, { FIRSTNAME, "firstname", NULL, NULL, (charactersSAXFunc) sect_author_characters }, @@ -60,7 +61,7 @@ ElementInfo sect_elements[] = { { GUIBUTTON, "guibutton", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_end_element, (charactersSAXFunc) sect_write_characters}, { GUIICON, "guiicon", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_end_element, (charactersSAXFunc) sect_write_characters}, { GUILABEL, "guilabel", (startElementSAXFunc) sect_btt_start_element, (endElementSAXFunc) sect_btt_end_element, (charactersSAXFunc) sect_write_characters}, - { GUIMENU, "guimenu", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_end_element, (charactersSAXFunc) sect_write_characters}, + { GUIMENU, "guimenu", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_arrow_end_element, (charactersSAXFunc) sect_write_characters}, { GUIMENUITEM, "guimenuitem", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_end_element, (charactersSAXFunc) sect_write_characters}, { HARDWARE, "hardware", (startElementSAXFunc) sect_btt_start_element, (endElementSAXFunc) sect_btt_end_element, (charactersSAXFunc) sect_write_characters}, { KEYCAP, "keycap", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_end_element, (charactersSAXFunc) sect_write_characters}, @@ -82,8 +83,7 @@ ElementInfo sect_elements[] = { { FUNCPARAMS, "funcparams", (startElementSAXFunc) sect_funcparams_start_element, (endElementSAXFunc) sect_funcparams_end_element, (charactersSAXFunc) sect_write_characters}, { PARAMDEF, "paramdef", (startElementSAXFunc) sect_paramdef_start_element, NULL, (charactersSAXFunc) sect_write_characters}, { VOID, "void", (startElementSAXFunc) sect_void_start_element, NULL, NULL }, - { GUISUBMENU, "guisubmenu", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_end_element, (charactersSAXFunc) sect_write_characters}, - { MENUCHOICE, "menuchoice", NULL, NULL, NULL}, + { GUISUBMENU, "guisubmenu", (startElementSAXFunc) sect_b_start_element, (endElementSAXFunc) sect_b_arrow_end_element, (charactersSAXFunc) sect_write_characters}, { UNDEFINED, NULL, NULL, NULL, NULL} }; @@ -842,6 +842,7 @@ sect_graphic_start_element (Context *context, gchar **atrs_ptr; gchar *format = NULL; gchar *fileref = NULL; + gchar *lowcaseformat = NULL; SectContext *sect_context = (SectContext *)context->data; if (!IS_IN_SECT (context)) @@ -871,10 +872,18 @@ sect_graphic_start_element (Context *context, if (fileref == NULL) return; - if (format == NULL || (!g_strcasecmp (format, "gif"))) + if (g_strcasecmp (format, "gif") == 0) { sect_context->figure->img = g_strdup_printf ("%s.gif", fileref); - else + } else if ((g_strcasecmp (format, "jpg") == 0) || + (g_strcasecmp (format, "jpeg") == 0)) { + /* Some people decide to use .jpg, others use .jpeg */ + lowcaseformat = g_strdup (format); + g_strdown (lowcaseformat); + sect_context->figure->img = g_strdup_printf ("%s.%s", fileref, lowcaseformat); + g_free (lowcaseformat); + } else { sect_context->figure->img = g_strdup_printf ("%s.png", fileref); + } } void @@ -940,6 +949,15 @@ sect_b_end_element (Context *context, sect_print (context, "</B>"); } +void sect_b_arrow_end_element (Context *context, + const gchar *name) +{ + if (!IS_IN_SECT (context)) + return; + + sect_print (context, "-></B>"); +} + void sect_tti_start_element (Context *context, const gchar *name, diff --git a/components/help/converters/gnome-db2html2/sect-elements.h b/components/help/converters/gnome-db2html2/sect-elements.h index 472a2895a..c9bebcbf4 100644 --- a/components/help/converters/gnome-db2html2/sect-elements.h +++ b/components/help/converters/gnome-db2html2/sect-elements.h @@ -65,6 +65,7 @@ void sect_tt_start_element (Context *context, const gchar *name, const xmlChar * void sect_tt_end_element (Context *context, const gchar *name); void sect_b_start_element (Context *context, const gchar *name, const xmlChar **atrs); void sect_b_end_element (Context *context, const gchar *name); +void sect_b_arrow_end_element (Context *context, const gchar *name); void sect_tti_start_element (Context *context, const gchar *name, const xmlChar **atrs); void sect_tti_end_element (Context *context, const gchar *name); void sect_btt_start_element (Context *context, const gchar *name, const xmlChar **atrs); diff --git a/components/help/converters/gnome-db2html2/sect-preparse.c b/components/help/converters/gnome-db2html2/sect-preparse.c index 18b3cf442..c2820d93d 100644 --- a/components/help/converters/gnome-db2html2/sect-preparse.c +++ b/components/help/converters/gnome-db2html2/sect-preparse.c @@ -20,6 +20,7 @@ ElementInfo sect_preparse[] = { { FORMALPARA, "formalpara", NULL, NULL, NULL}, { BOOKINFO, "bookinfo", NULL, NULL, NULL}, { ARTHEADER, "artheader", NULL, NULL, NULL}, + { ARTICLEINFO, "articleinfo", NULL, NULL, NULL}, { AUTHORGROUP, "authorgroup", NULL, NULL, NULL}, { AUTHOR, "author", NULL, NULL, NULL}, { FIRSTNAME, "firstname", NULL, NULL, NULL}, diff --git a/components/help/converters/gnome-db2html2/toc-elements.c b/components/help/converters/gnome-db2html2/toc-elements.c index 403040fa1..cb005b746 100644 --- a/components/help/converters/gnome-db2html2/toc-elements.c +++ b/components/help/converters/gnome-db2html2/toc-elements.c @@ -32,6 +32,7 @@ ElementInfo toc_elements[] = { { FORMALPARA, "formalpara", NULL, NULL, NULL}, { BOOKINFO, "bookinfo", (startElementSAXFunc) artheader_start_element, (endElementSAXFunc) toc_artheader_end_element, NULL}, { ARTHEADER, "artheader", (startElementSAXFunc) artheader_start_element, (endElementSAXFunc) toc_artheader_end_element, NULL}, + { ARTICLEINFO, "articleinfo", (startElementSAXFunc) artheader_start_element, (endElementSAXFunc) toc_artheader_end_element, NULL}, { AUTHORGROUP, "authorgroup", NULL, NULL, NULL}, { AUTHOR, "author", (startElementSAXFunc) toc_author_start_element, NULL, NULL}, { FIRSTNAME, "firstname", NULL, NULL, (charactersSAXFunc) toc_author_characters }, diff --git a/components/help/help-method.c b/components/help/help-method.c index 201f16dff..e4e3f55b6 100644 --- a/components/help/help-method.c +++ b/components/help/help-method.c @@ -45,6 +45,7 @@ typedef enum { MAN_FILE, INFO_FILE, HTML_FILE, + XML_FILE, UNKNOWN_FILE } HelpFileTypes; @@ -80,7 +81,7 @@ help_uri_to_string (HelpURI *help_uri) after_scheme = NULL; switch (help_uri->type) { - case SGML_FILE: + case SGML_FILE: case XML_FILE: if (help_uri->section != NULL) { after_scheme = g_strdup_printf ("gnome-db2html2 %s?%s;mime-type=text/html", @@ -112,6 +113,8 @@ help_uri_to_string (HelpURI *help_uri) after_scheme = g_strdup (help_uri->file); } break; + case UNKNOWN_FILE: + return NULL; default: /* FIXME: An assert at runtime may be a bit harsh. * We'd like behavior more like g_return_if_fail. @@ -166,6 +169,8 @@ convert_file_to_uri (HelpURI *help_uri, char *file) if (g_strcasecmp (mime_type, "text/sgml") == 0) { help_uri->type = SGML_FILE; + } else if (g_strcasecmp (mime_type, "text/xml") == 0) { + help_uri->type = XML_FILE; } else if (g_strcasecmp (mime_type, "text/html") == 0) { help_uri->type = HTML_FILE; } else if (g_strcasecmp (mime_type, "application/x-troff-man") == 0) { @@ -176,6 +181,8 @@ convert_file_to_uri (HelpURI *help_uri, char *file) help_uri->type = MAN_FILE; } else if (file_in_info_path (file)) { help_uri->type = INFO_FILE; + } else { + help_uri->type = UNKNOWN_FILE; } return TRUE; @@ -339,7 +346,7 @@ help_do_transform (GnomeVFSTransform *transform, } else { help_uri = transform_relative_file (old_uri); } - + if (help_uri == NULL) { return GNOME_VFS_ERROR_NOT_FOUND; } |