2007-09-21 Gaius Mulley * doc/Makefile.in: added -P-V switch to the production of html files. Removed background colour switch when generating pic.html. * src/devices/grohtml/grohtml.man: documented -V option now generates a HTML-4.01 validator or XHTML validator. * src/devices/grohtml/html-text.cpp: suppress , and tags if we are inside a
 block.
	* src/devices/grohtml/post-html.cpp:  handle_valid_flag now
	  has a parameter to indicate whether it needs to generate a
	  paragraph block. It now generates HTML-4.01 or XHTML blue
	  validator button.


--- groff-cvs/doc/Makefile.in	2006-01-03 23:57:03.000000000 +0000
+++ groff-html/doc/Makefile.in	2007-09-21 17:59:20.000000000 +0100
@@ -81,7 +81,7 @@
 
 imagedir=img
 
-.SUFFIXES: .me .ms .ps .html .txt .texinfo .dvi .pdf
+.SUFFIXES: .me .ms .ps .html .txt .texinfo .dvi .pdf .xhtml
 .PHONY: all prepare_examples clean distclean realclean extraclean
 
 # For simplicity, we always call grn and eqn.
@@ -92,7 +92,7 @@
 
 .ms.html:
 	$(GROFF) -P-p -P-b -P-I`basename $< | sed -e 's|.ms$$||'` \
-		 -P-D$(imagedir) -Thtml -ms >$@
+		 -P-D$(imagedir) -P-V -Thtml -ms >$@
 .ms.txt:
 	$(GROFF) -Tascii -ms -mwww >$@
 .ms.ps:
@@ -122,9 +122,9 @@
 	xpmtoppm $(srcdir)/gnu.xpm | pnmdepth 15 | pnmtopng >$@
 
 pic.html: pic.ms
-	$(GROFF) -P-p -P-b -P-I`basename $< | sed -e 's|.ms$$||'` \
+	$(GROFF) -P-p -P-I`basename $< | sed -e 's|.ms$$||'` \
                  -P-D$(imagedir) -P-j`basename $< | sed -e 's|.ms$$||'` \
-                 -Thtml -ms >$@
+                 -Thtml -P-V -ms >$@
 
 webpage.html: webpage.ms gnu.png gnu.eps groff.css
 	$(GROFF) -P-j`basename $< | sed -e 's|.ms$$||'` \
@@ -141,7 +141,7 @@
 	-rm -f *.aux *.dvi *.pdf *.log *.toc texput.log
 	-rm -f *.cp *.cps *.cv *.cn *.es *.ess *.fn *.fns *.ky *.kys \
                *.ma *.mas *.op *.ops *.pg *.pgs *.rq *.rqs *.st *.sts \
-               *.tp *.tps *.tr *.vr *.vrs
+               *.tp *.tps *.tr *.vr *.vrs *.xhtml
 	-rm -rf img
 
 distclean: clean
--- groff-cvs/src/devices/grohtml/grohtml.man	2007-09-19 15:55:55.000000000 +0100
+++ groff-html/src/devices/grohtml/grohtml.man	2007-09-21 16:48:16.000000000 +0100
@@ -262,7 +262,7 @@
 .
 .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
--- groff-cvs/src/devices/grohtml/html-text.cpp	2007-09-19 15:55:55.000000000 +0100
+++ groff-html/src/devices/grohtml/html-text.cpp	2007-09-21 16:40:42.000000000 +0100
@@ -166,13 +166,15 @@
 		     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("");
                    break;
-  case BIG_TAG:    if (dialect != xhtml || (! is_in_pre ()))
+  case BIG_TAG:    if (! is_in_pre ())
                      out->put_string("");
                    break;
-  case COLOR_TAG:  out->put_string(""); break;
+  case COLOR_TAG:  if (! is_in_pre ())
+                     out->put_string("");
+                   break;
 
   default:
     error("unrecognised tag");
@@ -265,14 +267,16 @@
 		     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("arg1);
                    break;
-  case BIG_TAG:    if (dialect != xhtml || (! is_in_pre ()))
+  case BIG_TAG:    if (! is_in_pre ())
                      issue_tag("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");
--- groff-cvs/src/devices/grohtml/post-html.cpp	2007-09-19 15:55:55.000000000 +0100
+++ groff-html/src/devices/grohtml/post-html.cpp	2007-09-21 19:07:21.000000000 +0100
@@ -2103,7 +2103,7 @@
   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 @@
 	    "frame=\"void\" cellspacing=\"1\" cellpadding=\"0\">\n"
 	    "\n"
 	    "", stdout);
+    handle_valid_flag(FALSE);
     fputs("[ ", stdout);
     if ((strcmp(prev.contents(), "") != 0) && prev != top && prev != current) {
       emit_link(prev, "prev");
@@ -4947,7 +4948,6 @@
       emit_link(top, "top");
     }
     fputs(" ]\n", stdout);
-    handle_valid_flag();
 
     if (groff_sig) {
       fputs(""
@@ -5047,13 +5047,13 @@
   else {
     current_paragraph->done_para();
     write_rule();
-    if (valid_flag && dialect == xhtml) {
+    if (valid_flag) {
       if (groff_sig)
 	fputs("\n\n\n"
 	      "\n"
 	      "
", stdout); - handle_valid_flag(); + handle_valid_flag(TRUE); if (groff_sig) { fputs("" "This document was produced using " @@ -5426,18 +5426,28 @@ } /* - * 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("

" - "\n" - "

\n", stdout); + if (valid_flag) { + if (needs_para) + fputs("

", stdout); + if (dialect == xhtml) + fputs("\n", + stdout); + else + fputs("\n", + stdout); + if (needs_para) + fputs("

", stdout); + } } int main(int argc, char **argv)