I suspect that you can achieve what you want by inheriting django.template.loaders.app_directories.Loader(or any other bootloader) and rewriting the load_template_sourcemethod, for example:
from django.template.loaders.app_directories import Loader
from shpaml import convert_text
class SHPAMLLoader(Loader):
def load_template_source(self, *args, **kwargs):
shpaml_source = super(SHPAMLLoader, self).load_template_source(*args, **kwargs)
html = convert_text(shpaml_source)
return html
Then put your loader at the beginning of the tuple TEMPLATE_LOADERSin settings.py. Of course, you will dance SHPAML for HTML every time you load the template, so you can see some overhead. The upcoming Django 1.2 supports template caching, which can help mitigate this overhead ...
Disclaimer: This code is completely untested, sorry.
source
share