The R Project SVN R

Rev

Rev 6098 | Rev 6351 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6098 Rev 6348
Line 11... Line 11...
11
# Routines for HTML to RTF
11
# Routines for HTML to RTF
12
#
12
#
13
# Steve Atkins, Nov '97
13
# Steve Atkins, Nov '97
14
 
14
 
15
$Font{"P"} = "\\f0\\fs22";
15
$Font{"P"} = "\\f0\\fs22";
16
$Font{"H1"} = "\\f0\\fs48";
16
$Font{"H1"} = "\\f0\\fs48\\cf13";
17
$Font{"H2"} = "\\f0\\fs36\\cf1";
17
$Font{"H2"} = "\\f0\\fs36\\cf1";
18
$Font{"H3"} = "\\f0\\fs30";
18
$Font{"H3"} = "\\f0\\fs30\\cf14";
19
$Font{"H4"} = "\\f0\\fs26";
19
$Font{"H4"} = "\\f0\\fs26";
20
$Font{"H5"} = "\\f0\\fs20";
20
$Font{"H5"} = "\\f0\\fs20";
21
$Font{"H6"} = "\\f0\\fs18";
21
$Font{"H6"} = "\\f0\\fs18";
22
$Font{"PRE"} = "\\f1\\fs20";
22
$Font{"PRE"} = "\\f1\\fs20";
23
$Font{"BLOCKQUOTE"} = "\\f0\\fs20\\li720";
23
$Font{"BLOCKQUOTE"} = "\\f0\\fs20\\li720";
Line 93... Line 93...
93
$End{"H6"} = "end_header";
93
$End{"H6"} = "end_header";
94
 
94
 
95
sub begin_header {
95
sub begin_header {
96
    local ($element, $tag, %attributes) = @_;
96
    local ($element, $tag, %attributes) = @_;
97
    print RTF $Font{$element}, " ";
97
    print RTF $Font{$element}, " ";
-
 
98
    $inheader = 1;
98
    if($attributes{"align"} eq "center") {
99
    if($attributes{"align"} eq "center") {
99
	print RTF "\\qc "
100
	print RTF "\\qc "
100
    }
101
    }
101
}
102
}
102
 
103
 
103
sub end_header {
104
sub end_header {
104
    local ($element) = @_;
105
    local ($element) = @_;
105
    print RTF "\\sa240\\par\\ql\\pard\\plain\n";
106
    print RTF "\\sa240\\par\\ql\\pard\\plain\n";
-
 
107
    $inheader = 0;
106
}
108
}
107
 
109
 
108
$Begin{"BR"} = "line_break";
110
$Begin{"BR"} = "line_break";
109
 
111
 
110
sub line_break {
112
sub line_break {
Line 291... Line 293...
291
    print RTF "\\b0 ";
293
    print RTF "\\b0 ";
292
}
294
}
293
 
295
 
294
sub begin_tt {
296
sub begin_tt {
295
    local ($element, $tag) = @_;
297
    local ($element, $tag) = @_;
-
 
298
    if($inheader > 0) {
-
 
299
	print RTF "\\f1\\b", " ";
-
 
300
    } else {
296
    print RTF $Font{"PRE"}, " ";
301
	print RTF $Font{"PRE"}, " ";
-
 
302
    }
297
}
303
}
298
 
304
 
299
sub end_tt {
305
sub end_tt {
300
    local ($element) = @_;
306
    local ($element) = @_;
-
 
307
    if($inheader > 0) {
-
 
308
	print RTF "\\f0\\b0", " ";
-
 
309
    } else {
301
    print RTF $Font{"P"}, " ";
310
	print RTF $Font{"P"}, " ";
-
 
311
    }
302
}
312
}
303
 
313
 
304
 
314
 
305
## List environments
315
## List environments
306
 
316