Commit fede6612 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford
Browse files

started program listing. doubting SAX's strictness big time.

2000-02-08  Jonathan Blandford  <jrb@redhat.com>

	* gnome-db2html2/sect-elements.c: started program listing.
	doubting SAX's strictness big time.
parent 5e59837c
2000-02-08 Jonathan Blandford <jrb@redhat.com>
* gnome-db2html2/sect-elements.c: started program listing.
doubting SAX's strictness big time.
2000-02-08 Elliot Lee <sopwith@redhat.com>
* gnome-man2html2/gnome-man2html.c, gnome-man2html2/Makefile.am:
......
......@@ -74,6 +74,36 @@ ulink_end_element (Context *context, const gchar *name)
}
}
void
html_em_start_element (Context *context,
const gchar *name,
const xmlChar **atrs)
{
g_print ("<EM>");
}
void
html_em_end_element (Context *context,
const gchar *name)
{
g_print ("</EM>");
}
void
html_tt_start_element (Context *context,
const gchar *name,
const xmlChar **atrs)
{
g_print ("<TT>");
}
void
html_tt_end_element (Context *context,
const gchar *name)
{
g_print ("</TT>");
}
void
artheader_start_element (Context *context, const gchar *name, const xmlChar **atrs)
{
......@@ -89,12 +119,17 @@ write_characters (Context *context,
GSList *list;
ElementIndex index;
/* EVIL EVIL EVIL HACK UNTIL I FIGURE OUT ENTITIES */
if (*chars == '<') {
g_print ("&lt;");
return;
}
list = g_slist_prepend (NULL, GINT_TO_POINTER (FOOTNOTE));
index = find_first_parent (context, list);
if (index == UNDEFINED) {
temp = g_strndup (chars, len);
g_print ("%s\n", temp);
g_print ("%s", temp);
g_free (temp);
} else {
GString *footnote;
......@@ -160,6 +195,7 @@ get_entity (Context *context, const gchar *name)
#ifdef ERROR_OUTPUT
g_print ("in getEntity:%s\n", name);
#endif
return xmlGetPredefinedEntity (name);
}
......
......@@ -37,7 +37,15 @@ typedef enum ElementIndex {
FOOTNOTE,
FIGURE,
GRAPHIC,
UNDEFINED /* 30 */
CITETITLE, /* 30 */
APPLICATION,
FILENAME,
ITEMIZED_LIST,
LISTITEM,
PROGRAMLISTING, /* 35 */
SGMLTAG,
EMPHASIS,
UNDEFINED /* 33 */
} ElementIndex;
typedef struct _ElementInfo ElementInfo;
......@@ -96,6 +104,10 @@ typedef struct HeaderInfo {
void article_start_element (Context *context, const gchar *name, const xmlChar **atrs);
void article_end_element (Context *context, const gchar *name);
void artheader_start_element (Context *context, const gchar *name, const xmlChar **atrs);
void html_em_start_element (Context *context, const gchar *name, const xmlChar **atrs);
void html_em_end_element (Context *context, const gchar *name);
void html_tt_start_element (Context *context, const gchar *name, const xmlChar **atrs);
void html_tt_end_element (Context *context, const gchar *name);
void para_start_element (Context *context, const gchar *name, const xmlChar **atrs);
void para_end_element (Context *context, const gchar *name);
void ulink_start_element (Context *context, const gchar *name, const xmlChar **atrs);
......
......@@ -20,6 +20,7 @@ struct _SectContext {
GList *footnotes;
};
static void sect_write_characters (Context *context, const gchar *chars, int len);
static void sect_sect_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_sect_end_element (Context *context, const gchar *name);
......@@ -36,7 +37,14 @@ static void sect_title_end_element (Context *context, const gchar *name);
static void sect_title_characters (Context *context, const gchar *chars, int len);
static void sect_ulink_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_ulink_end_element (Context *context, const gchar *name);
static void sect_xref_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_footnote_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_em_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_em_end_element (Context *context, const gchar *name);
static void sect_tt_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_tt_end_element (Context *context, const gchar *name);
static void sect_programlisting_start_element (Context *context, const gchar *name, const xmlChar **atrs);
static void sect_programlisting_end_element (Context *context, const gchar *name);
ElementInfo sect_elements[] = {
{ ARTICLE, "article", (startElementSAXFunc) article_start_element, (endElementSAXFunc) sect_article_end_element, NULL},
......@@ -65,10 +73,18 @@ ElementInfo sect_elements[] = {
{ TITLE, "title", (startElementSAXFunc) sect_title_start_element, (endElementSAXFunc) sect_title_end_element, (charactersSAXFunc) sect_title_characters },
{ SUBTITLE, "subtitle", (startElementSAXFunc) sect_title_start_element, (endElementSAXFunc) sect_title_end_element, (charactersSAXFunc) sect_title_characters },
{ ULINK, "ulink", (startElementSAXFunc) sect_ulink_start_element, (endElementSAXFunc) sect_ulink_end_element, (charactersSAXFunc) sect_write_characters},
{ XREF, "xref", NULL, NULL, NULL},
{ XREF, "xref", (startElementSAXFunc) sect_xref_start_element, NULL, NULL},
{ FOOTNOTE, "footnote", (startElementSAXFunc) sect_footnote_start_element, NULL, NULL},
{ FIGURE, "figure", NULL, NULL, NULL},
{ GRAPHIC, "graphic", NULL, NULL, NULL},
{ CITETITLE, "citetitle", (startElementSAXFunc) sect_em_start_element, (endElementSAXFunc) sect_em_end_element, (charactersSAXFunc) sect_write_characters},
{ APPLICATION, "application", (startElementSAXFunc) sect_tt_start_element, (endElementSAXFunc) sect_tt_end_element, (charactersSAXFunc) sect_write_characters},
{ FILENAME, "filename", NULL, NULL, NULL},
{ ITEMIZED_LIST, "itemized_list", NULL, NULL, NULL},
{ LISTITEM, "listitem", NULL, NULL, NULL},
{ PROGRAMLISTING, "programlisting", (startElementSAXFunc) sect_programlisting_start_element, (endElementSAXFunc) sect_programlisting_end_element, (charactersSAXFunc) sect_write_characters},
{ SGMLTAG, "sgmltag", (startElementSAXFunc) sect_tt_start_element, (endElementSAXFunc) sect_tt_end_element, (charactersSAXFunc) sect_write_characters},
{ EMPHASIS, "EMPHASIS", (startElementSAXFunc) sect_em_start_element, (endElementSAXFunc) sect_em_end_element, (charactersSAXFunc) sect_write_characters},
{ UNDEFINED, NULL, NULL, NULL, NULL}
};
......@@ -616,6 +632,29 @@ sect_ulink_end_element (Context *context, const gchar *name)
ulink_end_element (context, name);
}
static void
sect_xref_start_element (Context *context,
const gchar *name,
const xmlChar **atrs)
{
gchar **atrs_ptr;
if (!IS_IN_SECT (context))
return;
g_print ("<A HREF=\"%s?", context->base_file);
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
if (!strcasecmp (*atrs_ptr, "linkend")) {
atrs_ptr++;
g_print ("%s", *atrs_ptr);
break;
}
atrs_ptr += 2;
}
g_print ("\">the section here</A>");
}
static void
sect_footnote_start_element (Context *context, const gchar *name, const xmlChar **atrs)
{
......@@ -631,3 +670,67 @@ sect_footnote_start_element (Context *context, const gchar *name, const xmlChar
g_print ("<A NAME=\"HEADNOTE%d\" HREF=\"#FOOTNOTE%d\">[%d]</A>", i, i, i);
}
static void
sect_em_start_element (Context *context,
const gchar *name,
const xmlChar **atrs)
{
if (!IS_IN_SECT (context))
return;
g_print ("<EM>");
}
static void
sect_em_end_element (Context *context,
const gchar *name)
{
if (!IS_IN_SECT (context))
return;
g_print ("</EM>");
}
static void
sect_tt_start_element (Context *context,
const gchar *name,
const xmlChar **atrs)
{
if (!IS_IN_SECT (context))
return;
g_print ("<TT>");
}
static void
sect_tt_end_element (Context *context,
const gchar *name)
{
if (!IS_IN_SECT (context))
return;
g_print ("</TT>");
}
static void
sect_programlisting_start_element (Context *context,
const gchar *name,
const xmlChar **atrs)
{
if (!IS_IN_SECT (context))
return;
g_print ("<table border=\"0\" bgcolor=\"#E0E0E0\" width=\"100%%\">\n<tr><td>\n<pre>\n");
}
static void
sect_programlisting_end_element (Context *context,
const gchar *name)
{
if (!IS_IN_SECT (context))
return;
g_print ("</pre>\n</td></tr>\n</table>\n");
}
......@@ -49,6 +49,14 @@ ElementInfo toc_elements[] = {
{ FOOTNOTE, "footnote", NULL, NULL, NULL},
{ FIGURE, "figure", NULL, NULL, NULL},
{ GRAPHIC, "graphic", NULL, NULL, NULL},
{ CITETITLE, "citetitle", (startElementSAXFunc) html_em_start_element, (endElementSAXFunc) html_em_end_element, (charactersSAXFunc) write_characters},
{ APPLICATION, "application", (startElementSAXFunc) html_tt_start_element, (endElementSAXFunc) html_tt_end_element, (charactersSAXFunc) write_characters},
{ FILENAME, "filename", NULL, NULL, NULL},
{ ITEMIZED_LIST, "itemized_list", NULL, NULL, NULL},
{ LISTITEM, "listitem", NULL, NULL, NULL},
{ PROGRAMLISTING, "programlisting", NULL, NULL, NULL},
{ SGMLTAG, "sgmltag", NULL, NULL, NULL},
{ EMPHASIS, "emphasis", NULL, NULL, NULL},
{ UNDEFINED, NULL, NULL, NULL, NULL}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment