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
6 package google_highlight;
8 # --- Configurable variables -----
10 # none, null, nada, nothing, zip, zero, zilch
12 # --------------------------------
17 my $referer = $ENV{'HTTP_REFERER'};
19 ($query) = $referer =~ m#^http://(?:www\.)?google.*q=([^\&]+)#i or return 0;
21 $query = join '|', split /[\s,\+\.]+/, $query;
27 my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
29 $$body_ref =~ s#(?<=>)([^<]+)?\b($query)\b#$1<span class="highlight">$2</span>#gis;
38 Blosxom Plug-in: google_highlight
42 Highlights any Google search terms used to find your weblog.
44 An adaptation of Dean Allen's [http://www.textism.com/] Google
45 Hilite [http://www.textism.com/tools/google_hilite/].
53 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
57 Drop the interpolate_fancy plug-in into your Blosxom plugins folder.
59 Add a "highlight" style to your document or CSS style sheet, e.g.:
64 .highlight { background-color: #FF9; }
74 Search Google for something that'll lead you to your weblog. Follow
75 the Google link and notice the terms used in your search are highlighted
80 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
82 Blosxom Plugin User Docs:
83 http://blosxom.sourceforge.net/documentation/users/plugins.html
84 Blosxom Plugin Developer Docs:
85 http://blosxom.sourceforge.net/documentation/developers/plugins.html
87 Dean Allen's Textism [http://www.textism.com/]
88 Dean Allen's Google Hilite [http://www.textism.com/tools/google_hilite/]
92 Address bug reports and comments to the Blosxom mailing list
93 [http://www.yahoogroups.com/group/blosxom].
97 Blosxom and this Blosxom Plug-in
98 Copyright 2003, Rael Dornfest
100 Permission is hereby granted, free of charge, to any person obtaining a
101 copy of this software and associated documentation files (the "Software"),
102 to deal in the Software without restriction, including without limitation
103 the rights to use, copy, modify, merge, publish, distribute, sublicense,
104 and/or sell copies of the Software, and to permit persons to whom the
105 Software is furnished to do so, subject to the following conditions:
107 The above copyright notice and this permission notice shall be included
108 in all copies or substantial portions of the Software.
110 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
111 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
112 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
113 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
114 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
115 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
116 OTHER DEALINGS IN THE SOFTWARE.