summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorwl <wl>2007-09-25 15:16:23 +0000
committerwl <wl>2007-09-25 15:16:23 +0000
commit2d0479a8f3ac757356d678a550d45e29e36c7615 (patch)
treec46f9a708e84c674fd40f93d1b0e2c84143d07c3 /src/devices
parent005315f122db99c6f52d783bda2835caadc4cc43 (diff)
downloadgroff-2d0479a8f3ac757356d678a550d45e29e36c7615.tar.gz
* doc/Makefile.in, doc/Makefile.sub (.ms.html): Add -P-V switch to
the production of html files. (pic.html): Ditto. Remove background colour switch. (.SUFFIXES, clean): Handle *.xhtml files. * src/devices/grohtml/grohtml.man: Document that -V option now generates an HTML-4.01 validator or XHTML validator. * src/devices/grohtml/html-text.cpp (html_text::end_tag, html_text::start_tag): Suppress <small>, <big>, and <color> tags if we are inside a <pre> block. * src/devices/grohtml/post-html.cpp (html_printer::handle_valid_flag): Add a parameter to indicate whether it needs to generate a paragraph block. (html_printer::write_navigation): Updated. (html_printer::do_file_components): Generate an HTML-4.01 blue validator button also.
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/grohtml/grohtml.man2
-rw-r--r--src/devices/grohtml/html-text.cpp16
-rw-r--r--src/devices/grohtml/post-html.cpp36
3 files changed, 34 insertions, 20 deletions
diff --git a/src/devices/grohtml/grohtml.man b/src/devices/grohtml/grohtml.man
index d1c6d28c..f4ba9a49 100644
--- a/src/devices/grohtml/grohtml.man
+++ b/src/devices/grohtml/grohtml.man
@@ -262,7 +262,7 @@ Print the version number.
.
.TP
.B \-V
-Create an XHTML validator button at the bottom of each page of
+Create an XHTML or HTML validator button at the bottom of each page of
the document.
.
.TP
diff --git a/src/devices/grohtml/html-text.cpp b/src/devices/grohtml/html-text.cpp
index f2b36025..6d5333af 100644
--- a/src/devices/grohtml/html-text.cpp
+++ b/src/devices/grohtml/html-text.cpp
@@ -166,13 +166,15 @@ void html_text::end_tag (tag_definition *t)
delete t->indent;
t->indent = NULL;
break;
- case SMALL_TAG: if (dialect != xhtml || (! is_in_pre ()))
+ case SMALL_TAG: if (! is_in_pre ())
out->put_string("</small>");
break;
- case BIG_TAG: if (dialect != xhtml || (! is_in_pre ()))
+ case BIG_TAG: if (! is_in_pre ())
out->put_string("</big>");
break;
- case COLOR_TAG: out->put_string("</font>"); break;
+ case COLOR_TAG: if (! is_in_pre ())
+ out->put_string("</font>");
+ break;
default:
error("unrecognised tag");
@@ -265,14 +267,16 @@ void html_text::start_tag (tag_definition *t)
issue_tag("", (char *)t->arg1);
}
out->enable_newlines(FALSE); break;
- case SMALL_TAG: if (dialect != xhtml || (! is_in_pre ()))
+ case SMALL_TAG: if (! is_in_pre ())
issue_tag("<small", (char *)t->arg1);
break;
- case BIG_TAG: if (dialect != xhtml || (! is_in_pre ()))
+ case BIG_TAG: if (! is_in_pre ())
issue_tag("<big", (char *)t->arg1);
break;
case BREAK_TAG: break;
- case COLOR_TAG: issue_color_begin(&t->col); break;
+ case COLOR_TAG: if (! is_in_pre ())
+ issue_color_begin(&t->col);
+ break;
default:
error("unrecognised tag");
diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp
index 4a6e0cbc..6cdfd0cc 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -2103,7 +2103,7 @@ class html_printer : public printer {
int round_width (int x);
void handle_tag_within_title (text_glob *g);
void writeHeadMetaStyle (void);
- void handle_valid_flag (void);
+ void handle_valid_flag (int needs_para);
void do_math (text_glob *g);
void write_html_anchor (text_glob *h);
void write_xhtml_anchor (text_glob *h);
@@ -4930,6 +4930,7 @@ void html_printer::write_navigation (const string &top, const string &prev,
"frame=\"void\" cellspacing=\"1\" cellpadding=\"0\">\n"
"<colgroup><col class=\"left\"></col><col class=\"right\"></col></colgroup>\n"
"<tr><td class=\"left\">", stdout);
+ handle_valid_flag(FALSE);
fputs("[ ", stdout);
if ((strcmp(prev.contents(), "") != 0) && prev != top && prev != current) {
emit_link(prev, "prev");
@@ -4947,7 +4948,6 @@ void html_printer::write_navigation (const string &top, const string &prev,
emit_link(top, "top");
}
fputs(" ]\n", stdout);
- handle_valid_flag();
if (groff_sig) {
fputs("</td><td class=\"right\"><i><small>"
@@ -5047,13 +5047,13 @@ void html_printer::do_file_components (void)
else {
current_paragraph->done_para();
write_rule();
- if (valid_flag && dialect == xhtml) {
+ if (valid_flag) {
if (groff_sig)
fputs("\n\n<table width=\"100%\" border=\"0\" rules=\"none\"\n"
"frame=\"void\" cellspacing=\"1\" cellpadding=\"0\">\n"
"<colgroup><col class=\"left\"></col><col class=\"right\"></col></colgroup>\n"
"<tr><td class=\"left\">", stdout);
- handle_valid_flag();
+ handle_valid_flag(TRUE);
if (groff_sig) {
fputs("</td><td class=\"right\"><i><small>"
"This document was produced using "
@@ -5426,18 +5426,28 @@ int html_printer::round_width(int x)
}
/*
- * handle_valid_flag - emits a valid xhtml 1.1 button, provided -V and -x
- * were supplied on the command line.
+ * handle_valid_flag - emits a valid xhtml 1.1 or html-4.01 button, provided -V
+ * was supplied on the command line.
*/
-void html_printer::handle_valid_flag (void)
+void html_printer::handle_valid_flag (int needs_para)
{
- if (valid_flag && dialect == xhtml)
- fputs("<p>"
- "<a href=\"http://validator.w3.org/check?uri=referer\"><img "
- "src=\"http://www.w3.org/Icons/valid-xhtml11\" "
- "alt=\"Valid XHTML 1.1 Transitional\" height=\"31\" width=\"88\" /></a>\n"
- "</p>\n", stdout);
+ if (valid_flag) {
+ if (needs_para)
+ fputs("<p>", stdout);
+ if (dialect == xhtml)
+ fputs("<a href=\"http://validator.w3.org/check?uri=referer\"><img "
+ "src=\"http://www.w3.org/Icons/valid-xhtml11-blue\" "
+ "alt=\"Valid XHTML 1.1 Transitional\" height=\"31\" width=\"88\" /></a>\n",
+ stdout);
+ else
+ fputs("<a href=\"http://validator.w3.org/check?uri=referer\"><img "
+ "src=\"http://www.w3.org/Icons/valid-html401-blue\" "
+ "alt=\"Valid HTML 4.01 Transitional\" height=\"31\" width=\"88\"></a>\n",
+ stdout);
+ if (needs_para)
+ fputs("</p>", stdout);
+ }
}
int main(int argc, char **argv)