2 # Author: Fletcher T. Penney
4 # Exclude functions copied from exclude plugin
8 # --- Configurable variables ----
10 # HTML code to insert before the menu
11 $menustart=qq%<span class="menu">%;
13 # HTML code to insert between items
14 $menuseparator=qq% :: %;
16 # HTML code to insert after menu
19 # These serve the same purpose as above, but for the root menu
20 $rootmenustart = $menustart;
21 $rootmenuseparator=qq%<br>%;
22 $rootmenuend=$menuend;
24 $pretty=1; # Enable "prettying" up category names
26 # -------------------------------
34 $ign_file = $exclude::ign_file;
35 $hide_file = $hide::ign_file;
41 $ign_fp = "$blosxom::datadir";
42 $ign_fn = "$ign_fp/$ign_file";
43 if (open(EXCLUDE, "< $ign_fn")) {
46 push(@excludes, "$_") if $_;
52 # Now do the same for hide
54 $ign_fp = "$blosxom::datadir";
55 $ign_fn = "$ign_fp/$hide_file";
56 if (open(EXCLUDE, "< $ign_fn")) {
59 push(@excludes, "$_") if $_;
65 $path_noflavour = $blosxom::path_info;
66 if ($path_noflavour !~ s/\.[^\.]*$//) {
67 $path_noflavour =~ s/\/$//;
68 $path_noflavour .= "\/index";
69 $path_noflavour =~ s/^([^\/])/$1/;
71 $path_noflavour =~ s/^\/*//;
76 my ($pkg, $files) = @_;
78 @files_list = sort keys %$files;
79 @rootlist = @files_list;
81 $myroot = $blosxom::datadir ."/" . $blosxom::path_info;
82 $myurl = $blosxom::url ."/" . $blosxom::path_info;
91 foreach (@files_list) {
92 if ($_ =~ s/$myroot//) {
93 # These are subdirectories of the current directory
94 $_ =~ s/^\/?([^\/]+)\/.*/$1/;
95 $_ =~ s/\/?[^\/]+\.txt//;
96 if ($_ and ($lastdir ne $_)) {
103 foreach (@rootlist) {
105 # $rootmenu.="$_ <br>";
106 if ($_ =~ s/$blosxom::datadir\///) {
107 $_ =~ s/^\/?([^\/]+)\/.*/$1/;
108 $_ =~ s/\/?[^\/]+\.txt//;
109 if ($_ and ($lastroot ne $_)) {
117 @rootdirs = @dirs if ($blosxom::path_info eq "");
120 for ($i=0;$i<scalar(@dirs)-1;$i++) {
122 $pretty =~ s/^(.)/\u$1/;
123 $pretty =~ s/[_-](.)/ \u$1/g;
124 $pretty =~ s/ojh/OJH/gi;
126 $menu.= "<a href=\"$myurl/$dirs[$i]/\">" . $pretty . "</a>" .$menuseparator;
129 for (;$i<scalar(@dirs);$i++) {
131 $pretty =~ s/^(.)/\u$1/;
132 $pretty =~ s/[_-](.)/ \u$1/g;
133 $pretty =~ s/ojh/OJH/gi;
135 $menu.= "<a href=\"$myurl/$dirs[$i]/\">" . $pretty . "</a>" ;
141 $rootmenu .= $rootmenustart;
142 for ($i=0;$i<scalar(@rootdirs);$i++) {
144 foreach $exclude (@excludes) {
145 foreach $ign_cf (@files_list) {
146 $use = 0 if ($rootdirs[$i] =~ m/^$exclude/) ;
149 $sepholder = $rootmenuseparator if ($rootmenu ne $rootmenustart);
151 $pretty = $rootdirs[$i];
152 $pretty =~ s/^(.)/\u$1/;
153 $pretty =~ s/[_-](.)/ \u$1/g;
154 $pretty =~ s/ojh/OJH/gi;
156 $rootmenu.= $sepholder . "<a href=\"$blosxom::url/$rootdirs[$i]/\">" . $pretty . "</a>" if $use;
159 $rootmenu.=$rootmenuend;
165 my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
167 $pretty_path = $path;
168 $pretty_path =~ s/^\/?(.)/\u$1/;
169 $pretty_path =~ s/[_-](.)/ \u$1/g;
170 $pretty_path =~ s/\/(.)/ :: \u$1/g;
175 my ($pkg, $date_ref, $mtime, $dw,$mo,$mo_num,$da,$ti,$yr) = @_;
177 $pretty_path = $blosxom::path;
178 $pretty_path =~ s/^\/?(.)/\u$1/;
179 $pretty_path =~ s/[_-](.)/ \u$1/g;
180 $pretty_path =~ s/\/(.)/ :: \u$1/g;
191 Blosxom Plug-in: menu
195 This creates a menu ($menu::menu)showing the available subdirectories from your current position. A subdirectory, or one of its "descendents" must have a story in it in order to be shown in the menu (ie, it does not lead down "blind alleys"). Additionally, it abides by the excluded sections if the exclude plug-in is enabled.
197 The default configuration settings at the begin lead to a sort of reversal of the breadcrumbs plug-in.
199 Additionally, the $menu::rootmenu variable contains the top level directories, regardless of the current page.
203 None known; please send bug reports and feedback to the Blosxom
204 development mailing list <blosxom-devel@lists.sourceforge.net>.
208 Fletcher T. Penney - http://fletcher.freeshell.org
210 This plugin is now maintained by the Blosxom Sourceforge Team,
211 <blosxom-devel@lists.sourceforge.net>.
215 This source is submitted to the public domain. Feel free to use and modify it. If you like, a comment in your modified source attributing credit to myself for my work would be appreciated.
217 THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND. USE AT YOUR OWN RISK!