File: makeChangelog.pl

package info (click to toggle)
emboss 6.6.0%2Bdfsg-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 571,584 kB
  • sloc: ansic: 460,579; java: 29,383; perl: 13,573; sh: 12,753; makefile: 3,294; csh: 706; asm: 351; xml: 239; pascal: 237; modula3: 8
file content (150 lines) | stat: -rwxr-xr-x 2,718 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/perl -w

# This is a utility to convert the ChangeLog file to HTML

###################################################################
#
# Some useful definitions
#
###################################################################

# where the CVS tree ChangeLog file is
my $cvsfile = "$ENV{HOME}/devemboss/ChangeLog";

# where the web page file is
my $htmlfile = "$ENV{HOME}/sfdoc/developers/changelog.html";


my @headings;	# list of heading titles
my $line;
my $i;
my $count;
my $pre_flag;

open (IN, "< $cvsfile") || die "Can't open $cvsfile\n";
open (OUT, "> $htmlfile") || die "Can't open $htmlfile\n";


# start HTML
print OUT qq|<HTML>

|;

# write warning note
print OUT qq|<!-- 

***                         DO NOT EDIT THIS FILE                        ***
*** IT IS AUTOMATICALLY PRODUCED BY THE EMBOSS SCRIPT 'makeChangelog.pl' ***

-->

|;


# write header stuff
print OUT qq|
<HEAD>
  <TITLE>
  EMBOSS: Change Log
  </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" text="#000000">

<table align=center border=0 cellspacing=0 cellpadding=0>
<tr><td valign=top>
<A HREF="/index.html" ONMOUSEOVER="self.status='Go to the EMBOSS home page';return true"><img border=0 src="/images/emboss_icon.jpg" alt="" width=150 height=48></a>
</td>
<td align=left valign=middle>
<b><font size="+6">

Change Log

</font></b>
</td></tr>
</table>
<br>&nbsp;
<p>

|;

# parse source for headings
@headings = ();
while ($line = <IN>) {
    if ($line !~ /^\s/) {
	push @headings, $line
    }
}

# write contents list
print OUT qq|<H2>Contents</H2>
<UL>
|;
$count = 0;
foreach $i (@headings) {
    print OUT qq|<LI><A HREF="#$count">$i</A></LI>|;
    $count++;
}
print OUT qq|</UL>
|;

# parse source for text
seek IN, 0, 0;	# go back to start of file

$count = 0;
$pre_flag = 0;
while ($line = <IN>) {

# heading found
    if ($line !~ /^\s/) {
	if ($pre_flag) {
            print OUT qq|</PRE>|;
            $pre_flag = 0;
        }
	print OUT qq|<H2><A NAME="$count">$line</A></H2>|;
        $count++;
        next;
    }

# blank line is a paragraph end
    if ($line =~ /^\s*$/ || $line =~ /^\t*$/) {
	if ($pre_flag) {
            print OUT qq|</PRE>|;
            $pre_flag = 0;
        }
	print OUT qq|<P>|;
        next;
    }

# indent of more than a TAB is the start of a <PRE> block
    if ($line =~ /^\t\s+/ || $line =~ /^\t\t+/) {
        if (! $pre_flag) {
            $pre_flag = 1;
            print OUT qq|<PRE>|;
        }
        print OUT qq|$line|;
        next;
    }

# else just print the line
    if ($pre_flag) {
        print OUT qq|</PRE>|;
        $pre_flag = 0;
    }
    print OUT qq|$line|;

}



# end HTML
print OUT qq|</BODY>
</HTML>
|;

close (OUT);
close (IN);



print "Done.\n";