Commits

Luke Plant  committed 1711619

Create a Trac plugin for displaying Bible and KioSword links

  • Participants
  • Parent commits e2335fb

Comments (0)

Files changed (5)

+__import__('pkg_resources').declare_namespace(__name__)

File setup/bibletracplugin/setup.py

+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from setuptools import setup
+
+setup(
+    name = 'BibleLink',
+    version = '0.11dev',
+    packages = ['lukeplant_me_uk.tracplugins.bible'],
+    author = "Luke Plant",
+    author_email = "L.Plant.98@cantab.net",
+    description = "Enables writing KioSword links into Trac Wiki.",
+    license = "BSD",
+    keywords = "trac link bible kiosword",
+    url = "http://lukeplant.me.uk/", # FIXME
+
+    entry_points = {
+        'trac.plugins': [
+            'bible = lukeplant_me_uk.tracplugins.bible'
+        ]
+    },
+
+    namespace_packages = ['lukeplant_me_uk.tracplugins']
+)

File tracplugins/__init__.py

+__import__('pkg_resources').declare_namespace(__name__)

File tracplugins/bible/__init__.py

+from links import *

File tracplugins/bible/links.py

+# -*- coding: utf-8 -*-
+from trac.core import *
+from trac.wiki.api import IWikiSyntaxProvider
+from genshi.builder import tag
+from genshi import escape
+
+__all__ = ['BibleLinkPlugin']
+
+def make_kiosword_link(formatter, ns, target, label):
+    return tag.a(escape(target), # this is nicer than label
+                 href=(u'sword:%s' % target),
+                 class_='bible')
+
+
+class BibleLinkPlugin(Component):
+    implements(IWikiSyntaxProvider)
+    def get_wiki_syntax(self):
+        return []
+
+    def get_link_resolvers(self):
+        return [('bible', make_kiosword_link)]