/usr/share/pyshared/Pyblosxom/plugins/entrytitle.py is in pyblosxom 1.5.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #######################################################################
# This file is part of Pyblosxom.
#
# Copyright (C) 2010, 2011 by the Pyblosxom team. See AUTHORS.
#
# Pyblosxom is distributed under the MIT license. See the file
# LICENSE for distribution details.
#######################################################################
"""
Summary
=======
If Pyblosxom is rendering a single entry (i.e. entry_list has 1 item in it),
then this populates the ``entry_title`` variable for the header template.
Install
=======
This plugin comes with Pyblosxom. To install, do the following:
1. Add ``Pyblosxom.plugins.entrytitle`` to the ``load_plugins`` list
of your ``config.py`` file.
2. Configure as documented below.
Configuration
=============
To use, add the ``entry_title`` variable to your header template in
the ``<title>`` area.
Example::
<title>$(blog_title)$(entry_title)</title>
The default ``$(entry_title)`` starts with a ``::`` and ends with the
title of the entry. For example::
:: Guess what happened today
You can set the entry title template in the configuration properties
with the ``entry_title_template`` variable::
config["entry_title_template"] = ":: %(title)s"
.. Note::
``%(title)s`` is a Python string formatter that gets filled in with
the entry title.
"""
__author__ = "Will Kahn-Greene"
__email__ = "willg at bluesock dot org"
__version__ = "2011-10-22"
__url__ = "http://pyblosxom.github.com/"
__description__ = "Puts entry title in page title."
__category__ = "date"
__license__ = "MIT"
__registrytags__ = "1.4, 1.5, core"
def verify_installation(request):
# This needs no verification.
return True
def cb_head(args):
req = args["request"]
entry = args["entry"]
data = req.get_data()
entry_list = data.get("entry_list", [])
if len(entry_list) == 1:
config = req.get_configuration()
tmpl = config.get("entry_title_template", ":: %(title)s")
entry["entry_title"] = (tmpl %
{"title": entry_list[0].get("title", "No title")})
return args
|