This patch adds some options to wml::fmt::text as well as a switch to
use either the embedded code copy of txt2html or the installed
external version plus documentation about that.

Index: wml/wml_include/fmt/text.src
===================================================================
--- wml.orig/wml_include/fmt/text.src	2010-04-05 16:23:04.000000000 +0200
+++ wml/wml_include/fmt/text.src	2010-04-05 16:24:18.000000000 +0200
@@ -14,15 +14,11 @@
     local (*FP);
 
     #   read the txt2html result
-    open(FP, "$(WML_LOC_LIBDIR)/exec/wml_aux_txt2html $arg->{FILE}|");
+    open(FP, '-|', "$(WML_LOC_LIBDIR)/exec/wml_aux_txt2html $arg->{OPTIONS} --extract $arg->{FILE} < /dev/null");
     local ($/) = undef;
     $buf = <FP>;
     close(FP);
 
-    #   cut out the body
-    $buf =~ s|^.*<BODY>||is;
-    $buf =~ s|</BODY>.*$||is;
-
     #   give headlines a more typographically strong look
     if (not $arg->{NOTYPO}) {
         $buf =~ s|^(<A NAME=".+?"><H([1-6])>)(.+?)(</H\2></A>)|$1<font face=\"Arial,Helvetica\">$3</font>$4|isg;
@@ -34,13 +30,15 @@
 </protect>
 
 <define-tag text endtag=required>
-<preserve notypo />
+<preserve notypo options />
 <set-var notypo=* />
+<set-var options=''  />
 <set-var %attributes />
 <perl>
 {
     my $tmpfile = "$(WML_TMPDIR)/wml.txt2html.$$.tmp";
     my $notypo = (qq|<get-var notypo />| eq '' ? 1 : 0);
+    my $options = q{<get-var options />};
 
     my $buf;
     <perl:assign:sq $buf>%body</perl:assign:sq>
@@ -52,12 +50,12 @@
     close(TXT);
 
     <perl:print:
-         "&wml_fmt_text({ FILE => $tmpfile, NOTYPO => $notypo })" />
+         "&wml_fmt_text({ FILE => $tmpfile, NOTYPO => $notypo, OPTIONS => $options })" />
 
     unlink($tmpfile);
 }
 </perl>
-<restore notypo />
+<restore notypo options />
 </define-tag>
 
 
@@ -72,9 +70,9 @@
 
  #use wml::fmt::text
 
- <: print &wml_fmt_text({ FILE => $file, ...}); :>
+ <: print &wml_fmt_text({ FILE => $file, OPTIONS => '--xhtml', ...}); :>
 
- <text>
+ <text notypo>
  FOO
  ===
 
@@ -89,12 +87,37 @@
 
 The usage is simple: Surround the text with the C<E<lt>textE<gt>> container
 tag and then just write plain ASCII text inside it. The corresponding HTML
-code is created via F<wml_aux_txt2html>(1), a filter which gives the ASCII
+code is created via F<wml_aux_txt2html>(3), a filter which gives the ASCII
 text nice formatting semantic which control the HTML result.
 
+If B<OPTIONS> field is specified, a newer F<txt2html>(1) filter is called
+instead of F<wml_aux_txt2html>, which is dead upstream.  This allows for
+instance generation of XGTML markup.
+
 The core conversion function is wml_fmt_text() which also can be used by other
 include files. 
 
+=head1 ATTRIBUTES
+
+These attributes can be used both in the C<E<lt>textE<gt>> tag (in
+lowercase letters) and in C<wml_fmt_text> arguments, as shown in
+examples above.
+
+=over 4
+
+=item C<NOTYPO>
+
+By default, font commands are added to headings to highlight them.
+This attribute prevents alteration of F<wml_aux_txt2html> output.
+
+=item C<OPTIONS=I<str>>
+
+This attribute performs two actions: select F<txt2html> filter instead of
+F<wml_aux_txt2html>, and I<str> arguments are passed literally on the
+command line of F<txt2html>.
+
+=back
+
 =head1 AUTHOR
 
  Ralf S. Engelschall
@@ -106,9 +129,9 @@
  Internal: P1, P2, P3, wml_aux_txt2html (WML)
  External: --
 
-=head1 SEEALSO
+=head1 SEE ALSO
 
-wml_aux_txt2html(1)
+txt2html(1), wml_aux_txt2html(3)
 
 =cut
 
