"""
This module contains an extension to Blosxom file entries to support
breadcrumbs.
(Note: This is in no way associated with the breadcrumbs.py that, although
listed all over the pyblosxom site, is not anywhere to be found.)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You can find a copy of the GNU General Public License
at http://www.gnu.org/copyleft/gpl.html or by writing to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Author:
Sjan Evardsson
Version:
1.0 Revision 2: 2006-02-06
1.0 Revision 1: 2006-01-11
1.0 : Released 2006-01-10
CHANGELOG:
Rev 2:
Modified links to add rel="tag" and moved the directory seperator /
outside of the links - to add Technorati style tagging automatically
Rev 1:
Added license information
USE:
In your story.$flavor file add:
$breadcrumbs
In your CSS you can modify the appearance by setting the value of
.blosxomBreadCrumb
Output will look like:
/
development/
languages/
python/
"""
import os.path
__author__ = "Sjan Evardsson - sjan at evardsson dot com"
__version__ = "1.0"
__url__ = "http://www.evardsson.com/"
__description__ = "Creates a $breadcrumbs variable for better navigation."
def verify_installation(request):
return 1
def cb_story(args):
"""
This method gets called in the cb_story callback. Refer to
the documentation for that.
"""
entry = args["entry"]
if not entry.has_key("absolute_path"):
return
if not entry.has_key("base_url"):
return
link_part = entry["base_url"]
cake = entry["absolute_path"].split(os.sep)
breadcrumbs = '\n/\n' % (link_part)
for crumb in cake:
link_part += '/' + crumb
breadcrumbs += '%s/\n' % (link_part,crumb)
breadcrumbs += ''
entry["breadcrumbs"] = breadcrumbs