3 # Author(s): Axel Beckert <blosxom@deuxchevaux.org>, http://noone.org/blog
5 # Licensing: GPL v2 or newer, http://www.gnu.org/licenses/gpl.txt
6 # Dept plugin web page: http://noone.org/blog?-tags=dept
7 # Dept plugin download: http://noone.org/blosxom/dept
8 # Blosxom web page: http://blosxom.ookee.com/
12 # This is a plugin for blosxom.
16 # Just drop it into your blosxoms plugin directory and it should start
17 # working. If you want, change some of the configuration variables
22 # It allows you to decorate Blosxom postings with "From the XYZ
23 # dept." like on Slashdot and other Slashsites.
27 # You can configure different texts based on regular expressions
28 # matched on the path. By default it looks if the path starts with
29 # and indicator for German or English language and uses and
30 # apropriate text in that language.
34 # Add an additional line after the title, starting with "Dept: ".
35 # Between this Dept line and the body text there should be a blank
36 # line. (This is in conformance with other Plugins, e.g. the one for
37 # meta tags, which work the same way.) After this keyword, the tags
38 # should be listed and separated by commata.
42 # The follwing two examples have the same effect.
45 # | Dept: Slashdot Fan Club
49 # Including the dept line into templates:
51 # Use $dept::deptline in your templates.
53 # Known bugs and other ugly obstacles:
59 # 0.01: Initial release, losely based on my tagging plugin.
71 '^/(Deutsch|de)($|/)' => 'Aus der <b>%s</b> Abteilung',
72 '^/(English|en)($|/)' => 'from the <b>%s</b> dept.',
73 '*' => 'From the <b>%s</b> dept.', # Default value. Keep it!
78 my $dept_re = qr/Dept:/i;
80 # Joining white space with:
85 my $dept_prefix = '<div class="dept">';
86 my $dept_suffix = '</div>';
88 # End of configuration.
102 my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
110 foreach (split /\n/, $$body_ref) {
119 if (/^$dept_re\s*(.+?)\s*$/) {
121 $dept =~ s/\s/$joinchar/gs;
122 my $fmtstr = $path2text{'*'};
123 foreach my $re (sort keys %path2text) {
125 if ($path =~ /$re/) {
126 $fmtstr = $path2text{$re};
132 sprintf($fmtstr, $dept).