41 |
); |
); |
42 |
|
|
43 |
$path =~ s{^$recepies/*(.*?[^/]+)$}{$1} || next; |
$path =~ s{^$recepies/*(.*?[^/]+)$}{$1} || next; |
44 |
|
warn "## path = $path\n"; |
45 |
return '' |
return '' |
46 |
. qq|<ul class=changes>$changes</ul>| |
. qq|<ul class=changes>$changes</ul>| |
47 |
. ( $path =~ m{(\.sh|Makefile|\.conf|\.pl)$}i || -e $path ? qq|<a class="path" href="$svn/view/recepies/$path">$path</a>| : '' ) |
. ( $path =~ m{(\.sh|Makefile|\.conf|\.pl)$}i || -x "$recepies/$path" ? qq|<a class="path" href="$svn/view/recepies/$path">$path</a>| : '' ) |
48 |
. qq|<pre class=content>$content</pre>| |
. qq|<pre class=content>$content</pre>| |
49 |
; |
; |
50 |
} |
} |
54 |
push @names, $_ unless m{/\.} || m{^\.}; |
push @names, $_ unless m{/\.} || m{^\.}; |
55 |
}}, $recepies ); |
}}, $recepies ); |
56 |
|
|
57 |
my $last_level = 0; |
warn "## names = ",dump( @names ); |
58 |
my $toc_html = ''; |
|
59 |
|
our $last_level = 0; |
60 |
|
our $toc_html = ''; |
61 |
sub header { |
sub header { |
62 |
my ($level, $name) = @_; |
my ($level, $name, $full_name) = @_; |
63 |
|
$full_name ||= $name; |
64 |
|
$full_name =~ s{recepies/}{}; |
65 |
|
warn "## header $level $name [$full_name]\n"; |
66 |
|
|
67 |
my $display = $name; |
my $display = $name; |
68 |
$display =~ s{^\d+[\.-]}{}; |
$display =~ s{^\d+[\.-]}{}; |
69 |
$display =~ s{-}{ }g; |
$display =~ s{-}{ }g; |
70 |
$display =~ s{\.\w+$}{}; |
$display =~ s{\.\w+$}{}; |
71 |
|
|
72 |
my $anchor = $name; |
my $anchor = $full_name; |
73 |
$anchor =~ s{</?[^>]+>}{}g; |
$anchor =~ s{</?[^>]+>}{}g; |
74 |
$anchor =~ s{\W+}{_}g; |
$anchor =~ s{\W+}{_}g; |
75 |
|
|
78 |
|
|
79 |
if ( $last_level > $level ) { |
if ( $last_level > $level ) { |
80 |
$toc_html .= "</ul>"; |
$toc_html .= "</ul>"; |
81 |
|
warn "## $last_level > $level toc /ul"; |
82 |
} elsif ( $last_level < $level ) { |
} elsif ( $last_level < $level ) { |
83 |
$toc_html .= "<ul>"; |
$toc_html .= "<ul>"; |
84 |
|
warn "## $last_level < $level toc ul"; |
85 |
} |
} |
86 |
$toc_html .= qq|<li><a href="#$anchor">$display</li>|; |
$toc_html .= qq|<li><a href="#$anchor">$display</li>|; |
87 |
$last_level = $level; |
$last_level = $level; |
132 |
|
|
133 |
foreach my $path ( sort @names ) { |
foreach my $path ( sort @names ) { |
134 |
|
|
135 |
next if ( -d $path && ! -e "$path/.svn" ); |
next if ( -d $path && -e "$path/.svn" ); |
136 |
|
|
137 |
my $name = $path; |
my $name = $path; |
138 |
# $name =~ s{^$recepies.*?([^/]+)$}{$1} || next; |
# $name =~ s{^$recepies.*?([^/]+)$}{$1} || next; |
141 |
my @just_path = split m{/}, $path; |
my @just_path = split m{/}, $path; |
142 |
@just_path = splice @just_path, 1, -1; |
@just_path = splice @just_path, 1, -1; |
143 |
|
|
144 |
|
warn "## ?? $path"; |
145 |
|
|
146 |
if ( -d $path ) { |
if ( -d $path ) { |
147 |
add_item( splice(@item,0) ); |
add_item( splice(@item,0) ); |
148 |
my $h1 = join(' ',@just_path); |
my $h1 = join(' ',@just_path); |
155 |
$to_path = " " . readlink $path; |
$to_path = " " . readlink $path; |
156 |
next; |
next; |
157 |
} else { |
} else { |
158 |
header 2, $name . $to_path; |
header 2, $name . $to_path, $path; |
159 |
$to_path = ''; |
$to_path = ''; |
160 |
my $content = file $path; |
my $content = file $path; |
161 |
html $content; |
html $content; |