"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "wml_include/fmt/text.src" between
wml-2.28.0.tar.xz and wml-2.30.0.tar.xz

About: WML (Website META Language) is an extensible Webdesigner’s off-line HTML generation toolkit.

text.src  (wml-2.28.0.tar.xz):text.src  (wml-2.30.0.tar.xz)
skipping to change at line 13 skipping to change at line 13
## Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved. ## Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved.
## ##
#use wml::std::tags #use wml::std::tags
<protect pass=2> <protect pass=2>
<: <:
# the conversion function # the conversion function
sub wml_fmt_text { sub wml_fmt_text {
my ($arg) = @_; my ($arg) = @_;
my ($buf); my ($FP);
local (*FP);
# read the txt2html result # read the txt2html result
open(FP, "txt2html $arg->{FILE}|"); open($FP, '-|', "txt2html $arg->{OPTIONS} --extract $arg->{FILE} < /dev/null
local ($/) = undef; ");
$buf = <FP>; local $/ = undef;
close(FP); my $buf = <$FP>;
close($FP);
# cut out the body
$buf =~ s|^.*<BODY>||is;
$buf =~ s|</BODY>.*$||is;
# give headlines a more typographically strong look # give headlines a more typographically strong look
if (not $arg->{NOTYPO}) { if (not $arg->{NOTYPO}) {
$buf =~ s|^(<A NAME=".+?"><H([1-6])>)(.+?)(</H\2></A>)|$1<font face=\"Ar ial,Helvetica\">$3</font>$4|isg; $buf =~ s|^(<A NAME=".+?"><H([1-6])>)(.+?)(</H\2></A>)|$1<font face=\"Ar ial,Helvetica\">$3</font>$4|isg;
} }
return $buf; return $buf;
} }
:> :>
</protect> </protect>
<define-tag text endtag=required> <define-tag text endtag=required>
<preserve notypo /> <preserve notypo options />
<set-var notypo=* /> <set-var notypo=* />
<set-var options='' />
<set-var %attributes /> <set-var %attributes />
<perl> <perl>
{ {
use Path::Tiny qw/ path tempdir tempfile cwd /; use Path::Tiny qw/ path tempdir tempfile cwd /;
my $tmpfile = tempfile(); my $tmpfile = tempfile();
my $notypo = (qq|<get-var notypo />| eq '' ? 1 : 0); my $notypo = (qq|<get-var notypo />| eq '' ? 1 : 0);
my $options = q{<get-var options />};
my $buf; my $buf;
<perl:assign:sq $buf>%body</perl:assign:sq> <perl:assign:sq $buf>%body</perl:assign:sq>
# there is no reason to nest <text> tags, so the <perl:print> # there is no reason to nest <text> tags, so the <perl:print>
# statement is unnecessary # statement is unnecessary
open(TXT, ">", $tmpfile); $tmpfile->spew_raw($buf);
print TXT $buf;
close(TXT);
<perl:print: <perl:print:
"&wml_fmt_text({ FILE => $tmpfile, NOTYPO => $notypo })" /> "&wml_fmt_text({ FILE => $tmpfile, NOTYPO => $notypo, OPTIONS => $optio ns })" />
unlink($tmpfile); unlink($tmpfile);
} }
</perl> </perl>
<restore notypo /> <restore notypo options />
</define-tag> </define-tag>
##EOF## ##EOF##
__END__ __END__
=head1 NAME =head1 NAME
wml::fmt::text - Plain ASCII with Special Formatting Semantic wml::fmt::text - Plain ASCII with Special Formatting Semantic
=head1 SYNOPSIS =head1 SYNOPSIS
#use wml::fmt::text #use wml::fmt::text
<: print &wml_fmt_text({ FILE => $file, ...}); :> <: print &wml_fmt_text({ FILE => $file, OPTIONS => '--xhtml', ...}); :>
<text> <text notypo>
FOO FOO
=== ===
1. bar 1. bar
2. quux 2. quux
a. baz a. baz
b. foo b. foo
... ...
</text> </text>
=head1 DESCRIPTION =head1 DESCRIPTION
The usage is simple: Surround the text with the C<E<lt>textE<gt>> container 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 tag and then just write plain ASCII text inside it. The corresponding HTML
code is created via F<txt2html>(1), a filter which gives the ASCII code is created via F<txt2html>(3), a filter which gives the ASCII
text nice formatting semantic which control the HTML result. 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 XHTML markup.
The core conversion function is wml_fmt_text() which also can be used by other The core conversion function is wml_fmt_text() which also can be used by other
include files. 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>'s arguments, as shown in
the 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>'s output.
=item C<OPTIONS=I<str>>
This attribute performs two actions: select F<txt2html> as a filter instead of
F<wml_aux_txt2html>, and make I<str> arguments be passed literally on the
command line of F<txt2html>.
=back
=head1 AUTHOR =head1 AUTHOR
Ralf S. Engelschall Ralf S. Engelschall
rse@engelschall.com rse@engelschall.com
www.engelschall.com www.engelschall.com
=head1 REQUIRES =head1 REQUIRES
Internal: P1, P2, P3, txt2html (WML) Internal: P1, P2, P3, txt2html (WML)
External: -- External: --
=head1 SEEALSO =head1 SEE ALSO
txt2html(1) txt2html(1)
=cut =cut
 End of changes. 14 change blocks. 
20 lines changed or deleted 41 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)