/[pub]/test/html-webhacc/WebHACC/Output.pm
Suika

Contents of /test/html-webhacc/WebHACC/Output.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Mon Jul 21 09:40:59 2008 UTC (18 years ago) by wakaba
Branch: MAIN
Changes since 1.4: +26 -0 lines
++ ChangeLog	21 Jul 2008 09:38:49 -0000
	* cc.cgi: Code clean-up.

2008-07-21  Wakaba  <wakaba@suika.fam.cx>

++ html/WebHACC/Language/ChangeLog	21 Jul 2008 09:40:52 -0000
	* DOM.pm (generate_table_section): Use hierarhical table
	number for tables in subdocuments.

2008-07-21  Wakaba  <wakaba@suika.fam.cx>

++ html/WebHACC/ChangeLog	21 Jul 2008 09:40:19 -0000
	* Input.pm (full_subdocument_index): New method, for the
	support of hierarchical subdocument numbers.
	(start_section): Use hierarhical subdocument numbers for
	section headings.

	* Output.pm (http_header, http_error, html_header): New methods.

2008-07-21  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 package WebHACC::Output;
2     use strict;
3 wakaba 1.3
4 wakaba 1.1 require IO::Handle;
5 wakaba 1.3 use Scalar::Util qw/refaddr/;
6 wakaba 1.1
7     my $htescape = sub ($) {
8     my $s = $_[0];
9     $s =~ s/&/&amp;/g;
10     $s =~ s/</&lt;/g;
11     $s =~ s/>/&gt;/g;
12     $s =~ s/"/&quot;/g;
13     $s =~ s{([\x00-\x09\x0B-\x1F\x7F-\xA0\x{FEFF}\x{FFFC}-\x{FFFF}])}{
14     sprintf '<var>U+%04X</var>', ord $1;
15     }ge;
16     return $s;
17     };
18    
19     sub new ($) {
20 wakaba 1.4 return bless {nav => [], section_rank => 1}, shift;
21 wakaba 1.1 } # new
22    
23     sub input ($;$) {
24     if (@_ > 1) {
25     if (defined $_[1]) {
26     $_[0]->{input} = $_[1];
27     } else {
28     delete $_[0]->{input};
29     }
30     }
31    
32     return $_[0]->{input};
33     } # input
34    
35     sub handle ($;$) {
36     if (@_ > 1) {
37     if (defined $_[1]) {
38     $_[0]->{handle} = $_[1];
39     } else {
40     delete $_[0]->{handle};
41     }
42     }
43    
44     return $_[0]->{handle};
45     } # handle
46    
47     sub set_utf8 ($) {
48     binmode shift->{handle}, ':utf8';
49     } # set_utf8
50    
51     sub set_flush ($) {
52     shift->{handle}->autoflush (1);
53     } # set_flush
54    
55     sub unset_flush ($) {
56     shift->{handle}->autoflush (0);
57