~woffs/wcm

5e45010b7d8866b6279b6e6427abb9a0680aff6a — Frank Doepper 11 years ago 6c84374 20110520
default $menulevel=1 and fix empty <ul></ul>
1 files changed, 5 insertions(+), 5 deletions(-)

M index.pl
M index.pl => index.pl +5 -5
@@ 4,7 4,7 @@
# http://woffs.de/WCM
# <wcm@woffs.de>
#
# Version 20110507
# Version 20110520
# 
# © WofFS 2010
# License: CC-BY-SA 3.0


@@ 18,7 18,7 @@ eval "use Text::Markdown";

my $src='src';                 # source dir tree
my $template='template.html';  # HTML template
my $menulevel=0;               # how many menulevels to show
my $menulevel=1;               # how many menulevels to show

### that's it! below is for advanced users ###



@@ 41,8 41,7 @@ sub walktree ($$$) {
  my $indent=shift;
  my $hiddendir=shift;
  opendir (my $dh,$dir) or return '';
  my $lnavi.="\n"." "x$indent;        # nice indentation in HTML source
  $lnavi.="<ul>\n";
  my $lnavi='';
  my $hit;
  foreach my $file (sort readdir ($dh)) {
    next if $file=~/^\./;                  # skip special directories and hidden files


@@ 117,7 116,8 @@ sub walktree ($$$) {
    $lnavi.="</li>\n" unless $hidden or $hiddendir;
  }
  closedir $dh;
  $lnavi.=" "x$indent."</ul>";
  # nice indentation in HTML source
  $lnavi="\n"." "x$indent."<ul>\n".$lnavi." "x$indent."</ul>" if $lnavi;
  return ($hit or $indent <= $menulevel) ? $lnavi : undef;
}