2
# ----------------------------------------------------------------------------
3
# "THE BEER-WARE LICENSE" (Revision 42):
4
# <joerg@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5
# can do whatever you want with this stuff. If we meet some day, and you think
6
# this stuff is worth it, you can buy me a beer in return. Joerg Wunsch
7
# ----------------------------------------------------------------------------
9
# Parse the generated tree.js file, and insert a <noscript> tree into the
12
# $Id: unjs.pl,v 1.2 2003/01/20 21:05:19 joerg_wunsch Exp $
15
die "usage: unjs tree.js tree.html index.html" unless $#ARGV == 2;
19
$indexhtml = $ARGV[2];
21
parsejs($treejs) || exit 1;
23
open(HTML, $treehtml) || die "Cannot open $treehtml: $!\n";
24
open(NEW, ">${treehtml}.new") ||
25
die "Cannot create ${treehtml}.new: $!\n";
30
print NEW "<noscript>\n";
32
print NEW "</noscript>\n";
37
rename($treehtml, "${treehtml}.bak") &&
38
rename("${treehtml}.new", $treehtml);
40
open(HTML, $indexhtml) || die "Cannot open $indexhtml: $!\n";
41
open(NEW, ">${indexhtml}.new") ||
42
die "Cannot create ${indexhtml}.new: $!\n";
46
if (/^<\/frameset>$/) {
47
print NEW "<noframes>\n";
49
print NEW "</noframes>\n";
54
rename($indexhtml, "${indexhtml}.bak") &&
55
rename("${indexhtml}.new", $indexhtml);
63
open(JS, $f) || die "Cannot open $f: $!\n";
72
if ($l =~ /^([A-Za-z][A-Za-z0-9]*)\s*=\s*/) {
92
if ($line !~ /^([A-Za-z]+)[(](.*)[)]$/) {
93
warn "item ignored: $line\n";
98
if ($fun ne "gFld" && $fun ne "gLnk" &&
99
$fun ne "insFld" && $fun ne "insDoc") {
100
warn "function $fun unknown\n";
103
if ($fun =~ /^ins(.*)/) {
104
parseins($1, $arg) || return 0;
105
} elsif ($fun =~ /^g(.*)/) {
106
parseg($1, $arg) || return 0;
114
my ($name, $line) = @_;
116
if ($line !~ /^["](.*)["],\s*["](.*)["],\s*["](.*)["]/) {
117
warn "arglist expected: $line\n";
124
if ($name eq "Fld") {
126
$nojs .= "<a href=\"$lnk\" target=\"basefrm\"><b>$text</b></a><br>\n";
128
$nojs .= "$text<br>\n";
133
$nojs .= "<a href=\"$lnk\" target=\"basefrm\">$text</a><br>\n";
135
# Huh, link without target?
136
$nojs .= "$text<br>\n";
143
my ($name, $line) = @_;
145
if ($line !~ /^([A-Za-z][A-Za-z0-9]*),\s*/) {
146
warn "variable expected: $line\n";
151
parsefun($') || return 0;