1 # Blosxom Plugin: seemore -*- perl -*-
2 # Author: Todd Larason (jtl@molehill.org)
4 # Blosxom Home/Docs/Licensing: http://www.raelity.org/blosxom
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/
107 None known; address bug reports and comments to me or to the Blosxom
108 mailing list [http://www.yahoogroups.com/groups.blosxom].
112 =head2 Configuration variables
114 C<$seemore_split> is the regular expression used to find where to
115 split stories; the default matches either a form-feed character (as in
116 0+1i) or the string "<!-- more -->" (recommended for most peoples'
119 C<$more_on_article> controls whether the full article is shown on
120 individual article pages, or only on pages with the special 'seemore'
121 argument; it defaults to on (0+3i: this is a change of behavior from
122 previous versions). Turning this on makes sense if you're using seemore
123 to put summaries on a main index paage, but probably not if you're using it
124 for spoiler protection.
126 C<$debug_level> can be set to a value between 0 and 5; 0 will output
127 no debug information, while 5 will be very verbose. The default is 1,
128 and should be changed after you've verified the plugin is working
131 =head2 Classes for CSS control
133 There's a class used, available for CSS customization.
135 * C<seemore> -- the <hr> dividing the short version of the story
136 from the rest, in the full-story view, and the <a> for the "See
137 more ..." link in the short view.
139 =head2 Flavour-style files
141 If you want a format change that can't be made by CSS, you can
142 override the HTML generated by creating files similar to Blosxom's
143 flavour files. They should be named seemore.I<bit>.I<flavour>; for
144 available I<bit>s and their default meanings, see the C<__DATA__>
145 section in the plugin.
150 Copyright 2003, Todd Larason
152 (This license is the same as Blosxom's)
154 Permission is hereby granted, free of charge, to any person obtaining a
155 copy of this software and associated documentation files (the "Software"),
156 to deal in the Software without restriction, including without limitation
157 the rights to use, copy, modify, merge, publish, distribute, sublicense,
158 and/or sell copies of the Software, and to permit persons to whom the
159 Software is furnished to do so, subject to the following conditions:
161 The above copyright notice and this permission notice shall be included
162 in all copies or substantial portions of the Software.
164 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
165 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
166 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
167 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
168 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
169 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
170 OTHER DEALINGS IN THE SOFTWARE.