1 # Blosxom Plugin: google_highlight
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc google_highlight
5 # Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
7 package google_highlight;
9 # --- Configurable variables -----
11 # none, null, nada, nothing, zip, zero, zilch
13 # --------------------------------
18 my $referer = $ENV{'HTTP_REFERER'};
20 ($query) = $referer =~ m#^http://(?:www\.)?google.*q=([^\&]+)#i or return 0;
22 $query = join '|', split /[\s,\+\.]+/, $query;
28 my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
30 $$body_ref =~ s#(?<=>)([^<]+)?\b($query)\b#$1<span class="highlight">$2</span>#gis;
39 Blosxom Plug-in: google_highlight
43 Highlights any Google search terms used to find your weblog.
45 An adaptation of Dean Allen's [http://www.textism.com/] Google
46 Hilite [http://www.textism.com/tools/google_hilite/].
54 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
56 This plugin is now maintained by the Blosxom Sourceforge Team,
57 <blosxom-devel@lists.sourceforge.net>.
61 Drop the interpolate_fancy plug-in into your Blosxom plugins folder.
63 Add a "highlight" style to your document or CSS style sheet, e.g.:
68 .highlight { background-color: #FF9; }
78 Search Google for something that'll lead you to your weblog. Follow
79 the Google link and notice the terms used in your search are highlighted
84 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
86 Blosxom Plugin User Docs:
87 http://blosxom.sourceforge.net/documentation/users/plugins.html
89 Blosxom Plugin Developer Docs:
90 http://blosxom.sourceforge.net/documentation/developers/plugins.html
92 Dean Allen's Textism [http://www.textism.com/]
93 Dean Allen's Google Hilite [http://www.textism.com/tools/google_hilite/]
97 None known; please send bug reports and feedback to the Blosxom
98 development mailing list <blosxom-devel@lists.sourceforge.net>.
102 Blosxom and this Blosxom Plug-in
103 Copyright 2003, Rael Dornfest
105 Permission is hereby granted, free of charge, to any person obtaining a
106 copy of this software and associated documentation files (the "Software"),
107 to deal in the Software without restriction, including without limitation
108 the rights to use, copy, modify, merge, publish, distribute, sublicense,
109 and/or sell copies of the Software, and to permit persons to whom the
110 Software is furnished to do so, subject to the following conditions:
112 The above copyright notice and this permission notice shall be included
113 in all copies or substantial portions of the Software.
115 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
118 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
119 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
120 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
121 OTHER DEALINGS IN THE SOFTWARE.