Mercurial > forge
annotate admin/get_contents @ 12669:1c92b4b26ced octave-forge
releasePKG.m: exclude .hg* files of export as of bug #45669
author | jpicarbajal |
---|---|
date | Fri, 31 Jul 2015 19:49:28 +0000 |
parents | 185c49a73acc |
children |
rev | line source |
---|---|
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
1 #!/usr/bin/env perl |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
2 # |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
3 # Traverse the directory tree and look for files called 'CONTENTS'. |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
4 # Insert the text from these files into octave-forge documentation |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
5 # files such as the top-level README, and the developer's guide. |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
6 # Issues: |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
7 # - Entries in the README appear in the sort order of |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
8 # the directory names the CONTENTS files are in. This |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
9 # isn't necessarily the best sequence since some directories |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
10 # such as main/ should appear first. |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
11 # - At the moment the text in the CONTENTS files should be plain |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
12 # text. Planning to allow texinfo for layout control in .html |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
13 # files. |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
14 # |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
15 # Albert Danial Jan 2 2002 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
16 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
17 use strict; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
18 use File::Find; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
19 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
20 my $location = `pwd`; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
21 my $PATH = ""; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
22 if ($location =~ m{^(.*)/admin$}) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
23 chdir ".."; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
24 $PATH = "$1/"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
25 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
26 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
27 my @files = (); # to contain relative path names of each CONTENTS file |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
28 find(\&wanted, "."); # start here & descend recursively; populate @files |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
29 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
30 fill_README(@files); # creates 'README' from 'template.readme' |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
31 fill_developer_html(@files); # creates 'new_developer.html' from 'template.ndev' |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
32 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
33 # # # # # # # |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
34 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
35 sub fill_README { # {{{1 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
36 my (@files, ) = @_; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
37 my $template = "admin/template.readme"; # -> reads |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
38 my $RM = "README"; # -> writes |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
39 if (!-r $template) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
40 warn "Unable to read the file '$template'; cannot make README\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
41 return; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
42 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
43 open(IN, $template) or die "Unable to read $template: $!\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
44 my @template_data = <IN>; # slurp the entire file |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
45 close IN; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
46 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
47 my $added_contents = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
48 my $top_of_file = 1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
49 open(README, ">$RM") or die "Unable to write $RM: $!\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
50 foreach my $t (@template_data) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
51 if ($top_of_file) { # skip over warning lines in |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
52 next if $t =~ /^-> /; # template starting with '->' |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
53 $top_of_file = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
54 } elsif ($added_contents) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
55 print README $t; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
56 next; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
57 } elsif ($t =~ /^Project organization/) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
58 print README "$t\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
59 foreach (sort @files) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
60 open(CONTENTS, $_) or die "Cannot read $_: $!\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
61 my @c = <CONTENTS>; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
62 close CONTENTS; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
63 m{^(.*)/(.*?)$}; # match directory and file's basename |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
64 my $dir = $1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
65 my $file = $2; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
66 $dir =~ s{^\./}{}; # strip leading ./ |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
67 print README "$dir/\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
68 foreach my $line (@c) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
69 print README "\t$line"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
70 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
71 print README "\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
72 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
73 $added_contents = 1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
74 } else { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
75 print README $t; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
76 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
77 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
78 close README; |
3967 | 79 warn "Use 'svn diff ${PATH}${RM}' to determine if updates are needed.\n"; |
80 warn "Use 'svn commit ${PATH}${RM}' to update README.\n"; | |
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
81 } # 1}}} |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
82 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
83 # # # # # # # |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
84 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
85 sub fill_developer_html { # {{{1 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
86 my (@files, ) = @_; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
87 my $template = "admin/template.ndev"; # <- reads |
3037
3e10bc83ccbf
Rearrange the html build, isolating all scripts in admin/ and all docs in doc/.
adb014
parents:
2697
diff
changeset
|
88 my $RM = "doc/htdocs/developers.in"; # <- writes |
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
89 if (!-r $template) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
90 warn "Unable to read the file '$template'; cannot make README\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
91 return; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
92 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
93 open(IN, $template) or die "Unable to read $template: $!\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
94 my @template_data = <IN>; # slurp the entire file |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
95 close IN; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
96 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
97 my $added_contents = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
98 my $top_of_file = 1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
99 open(README, ">$RM") or die "Unable to write $RM: $!\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
100 foreach my $t (@template_data) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
101 if ($top_of_file) { # skip over warning lines in |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
102 next if $t =~ /^-> /; # template starting with '->' |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
103 $top_of_file = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
104 } elsif ($added_contents) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
105 print README $t; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
106 next; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
107 } elsif ($t =~ /^>>>INSERT CONTENTS HERE<<</) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
108 foreach (sort @files) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
109 open(CONTENTS, $_) or die "Cannot read $_: $!\n"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
110 my @c = <CONTENTS>; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
111 close CONTENTS; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
112 text_bullet_list_to_HTML(\@c); |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
113 m{^(.*)/(.*?)$}; # match directory and file's basename |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
114 my $dir = $1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
115 my $file = $2; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
116 $dir =~ s{^\./}{}; # strip leading ./ |
2683 | 117 print README "\t<li> <b><tt>$dir/</tt></b><br/>\n"; |
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
118 foreach my $line (@c) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
119 # use fixed font for words that end with / |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
120 # (ie, directory names). |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
121 $line =~ s{\s(\S+/)([.,\s])}{ <tt>$1</tt>$2}g; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
122 print README "\t$line"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
123 } |
2683 | 124 print README "</li>\n"; |
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
125 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
126 $added_contents = 1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
127 } else { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
128 print README $t; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
129 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
130 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
131 close README; |
1524 | 132 warn "Use 'scp ${PATH}${RM} \$OFHOME' to update the web.\n"; |
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
133 } # 1}}} |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
134 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
135 # # # # # # # |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
136 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
137 sub text_bullet_list_to_HTML { # {{{1 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
138 # Takes an array of plain text lines and embeds <ul>, <li>, and </ul> |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
139 # tags as appropriate to turn a text bullet list (denoted by *) into |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
140 # an html equivalent. |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
141 # Can only handle a single bullet list. |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
142 my ($ra_contents, ) = @_; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
143 my $found_list = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
144 foreach my $l (@{$ra_contents}) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
145 if ($l =~ /^\s*\*/) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
146 $found_list = 1; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
147 last; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
148 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
149 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
150 return unless $found_list; # bail if no list found |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
151 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
152 # find the first and last lines of the bullet list |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
153 my $start_line = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
154 for (my $i = 0; $i < scalar @{$ra_contents}; $i++) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
155 if ($ra_contents->[$i] =~ /^\s*\*/) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
156 $start_line = $i; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
157 last; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
158 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
159 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
160 my $end_line = 0; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
161 for (my $i = scalar @{$ra_contents} - 1; $i >= 0; $i--) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
162 if ($ra_contents->[$i] =~ /^\s*\*/) { |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
163 $end_line = $i; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
164 last; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
165 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
166 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
167 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
168 # finally, insert the HTML |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
169 for (my $i = 0; $i < scalar @{$ra_contents}; $i++) { |
2697 | 170 if ($i == $start_line) { |
171 $ra_contents->[$i] =~ s{^(\s*)\*}{$1 <li>}; | |
172 $ra_contents->[$i] = "<ul> " . $ra_contents->[$i]; | |
173 } else { | |
174 $ra_contents->[$i] =~ s{^(\s*)\*}{$1 </li>\n$1 <li>}; | |
175 if ($i == $end_line) { | |
176 $ra_contents->[$i] = $ra_contents->[$i] . "</li></ul>"; | |
177 } | |
178 } | |
102
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
179 } |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
180 } # 1}}} |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
181 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
182 # # # # # # # |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
183 |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
184 sub wanted { # populates global array @files |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
185 return unless -f and /^CONTENTS$/; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
186 push @files, "$File::Find::dir/$_"; |
b79437b29c68
Moving get_authors, get_contents, template.readme from top level dir to
alnd
parents:
diff
changeset
|
187 } |