1 # Blosxom Plugin: seemore -*- perl -*-
2 # Author: Todd Larason (jtl@molehill.org)
4 # Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
5 # SeeMore plugin Home/Docs/Licensing:
6 # http://molelog.molehill.org/blox/Computers/Internet/Web/Blosxom/SeeMore/
10 # --- Configuration Variables ---
11 # regular expression to split on
12 $seemore_split ||= qr/\f|<!-- more -->/;
14 # show the whole artcile on individual article pages? Good for summaries,
15 # not so good for spoiler protection
16 $more_on_article = 1 unless defined $more_on_article;
18 $debug_level = 1 unless defined $debug_level;
19 # ----------------------------------------------------------------------
23 my $package = 'seemore';
26 my ($level, @msg) = @_;
28 if ($debug_level >= $level) {
29 print STDERR "$package debug $level: @msg\n";
35 return $blosxom::template->('', "$package.$bit", $blosxom::flavour);
39 my ($bit, $path, $fn) = @_;
41 my $f = load_template($bit);
42 $f =~ s/((\$[\w:]+)|(\$\{[\w:]+\}))/$1 . "||''"/gee;
47 return 1 if $more_on_article and $blosxom::path_info =~ m:\.:;
48 return 1 if (CGI::param("seemore"));
49 # XXX return 1 if google/&c spider?
54 debug(1, "start() called, enabled");
56 last if /^(__END__)?$/;
57 my ($flavour, $comp, $txt) = split ' ',$_,3;
59 $blosxom::template{$flavour}{"$package.$comp"} = $txt;
65 my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
67 debug(2, "story() called");
69 ($$body_ref, $more) = split $seemore_split, $$body_ref, 2;
71 debug(2, "story() found more");
73 $$body_ref .= report('divider', $path, $filename) . $more;
75 $$body_ref .= report('showmore', $path, $filename);
82 error divider <hr class="seemore">\n
83 error showmore <p><a href="$blosxom::url$path/$fn.$blosxom::flavour?seemore=y" class="seemore">See more ...</a></p>\n
84 rss showmore <p><a href="$blosxom::url$path/$fn.$blosxom::default_flavour?seemore=y" class="seemore">See more ...</a></p>\n
89 Blosxom Plug-in: seemore
93 Purpose: Allows for long or spoiler-y posts to be split, with a "See more..." link
103 Todd Larason <jtl@molehill.org>, http://molelog.molehill.org/
105 This plugin is now maintained by the Blosxom Sourceforge Team,
106 <blosxom-devel@lists.sourceforge.net>.
110 None known; please send bug reports and feedback to the Blosxom
111 development mailing list <blosxom-devel@lists.sourceforge.net>.
115 =head2 Configuration variables
117 C<$seemore_split> is the regular expression used to find where to
118 split stories; the default matches either a form-feed character (as in
119 0+1i) or the string "<!-- more -->" (recommended for most peoples'
122 C<$more_on_article> controls whether the full article is shown on
123 individual article pages, or only on pages with the special 'seemore'
124 argument; it defaults to on (0+3i: this is a change of behavior from
125 previous versions). Turning this on makes sense if you're using seemore
126 to put summaries on a main index paage, but probably not if you're using it
127 for spoiler protection.
129 C<$debug_level> can be set to a value between 0 and 5; 0 will output
130 no debug information, while 5 will be very verbose. The default is 1,
131 and should be changed after you've verified the plugin is working
134 =head2 Classes for CSS control
136 There's a class used, available for CSS customization.
138 * C<seemore> -- the <hr> dividing the short version of the story
139 from the rest, in the full-story view, and the <a> for the "See
140 more ..." link in the short view.
142 =head2 Flavour-style files
144 If you want a format change that can't be made by CSS, you can
145 override the HTML generated by creating files similar to Blosxom's
146 flavour files. They should be named seemore.I<bit>.I<flavour>; for
147 available I<bit>s and their default meanings, see the C<__DATA__>
148 section in the plugin.
153 Copyright 2003, Todd Larason
155 (This license is the same as Blosxom's)
157 Permission is hereby granted, free of charge, to any person obtaining a
158 copy of this software and associated documentation files (the "Software"),
159 to deal in the Software without restriction, including without limitation
160 the rights to use, copy, modify, merge, publish, distribute, sublicense,
161 and/or sell copies of the Software, and to permit persons to whom the
162 Software is furnished to do so, subject to the following conditions:
164 The above copyright notice and this permission notice shall be included
165 in all copies or substantial portions of the Software.
167 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
168 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
169 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
170 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
171 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
172 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
173 OTHER DEALINGS IN THE SOFTWARE.