1 # Blosxom Plugin: absolute
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc readme
8 # --- Configurable variables -----
10 # What's the URL of your images directory?
12 # e.g. http://www.example/images
14 # What's the URL of your $datadir, if publicly-accessible?
16 # e.g. http://www.example/blosxom
18 # --------------------------------
20 $image_url =~ s!/$!!; $datadir_url =~ s!/$!!;
27 my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
29 $$body_ref =~ s!(<a.+?href\s*=\s*(["']))(/.+?)\2(.*?)>!$1$blosxom::url$3$2$4>!sig;
31 $image_url and $$body_ref =~ s!(<img.+?src=(["']))(/.+?)\2(.*?)>!$1$image_url$3$2$4>!sig;
33 $datadir_url and $$body_ref =~ s!(<img.+?src=(["']))([^\/]+?)\2(.*?)>!$1$datadir_url$path/$3$2$4>!sig;
44 Blosxom Plug-in: absolute
48 Replaces <a href="/relative/path/to/something.html"> with the fully-qualified/
49 absolute <a href="$blosxom::url/relative/path/to/something.html">, especially
50 important for RSS feeds, since most RSS readers don't make these absolute
53 Optionally replaces <img src="/relative/path/to/image.gif"> with the
54 fully-qualified/absolute <img src="$image_url/relative/path/to/image.gif">.
56 For those who have their $datadir publicly-available (i.e. under their
57 Web server's document root), also optionally adds fully-qualified/absolute
58 paths to images. So mention of <img src="something.gif"> in
59 /relative/path/to/something.txt will be replaced with
60 <img src="$datadir_url/relative/path/to/something.gif">.
62 The plug-in also should preserve any attributes included in the <a /> or
69 Version number coincides with the version of Blosxom with which the
70 current version was first bundled.
74 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
78 Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
80 Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
84 Address bug reports and comments to the Blosxom mailing list
85 [http://www.yahoogroups.com/group/blosxom].
89 Blosxom and this Blosxom Plug-in
90 Copyright 2003, Rael Dornfest
92 Permission is hereby granted, free of charge, to any person obtaining a
93 copy of this software and associated documentation files (the "Software"),
94 to deal in the Software without restriction, including without limitation
95 the rights to use, copy, modify, merge, publish, distribute, sublicense,
96 and/or sell copies of the Software, and to permit persons to whom the
97 Software is furnished to do so, subject to the following conditions:
99 The above copyright notice and this permission notice shall be included
100 in all copies or substantial portions of the Software.
102 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
103 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
105 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
106 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
107 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
108 OTHER DEALINGS IN THE SOFTWARE.