projectmallard / projectmallard.org

The Mallard web site, including specifications and enhancement proposals
MIT License
15 stars 10 forks source link

Making mallard working with python-django. #37

Open pons1991 opened 8 years ago

pons1991 commented 8 years ago

I want mallard to work with python-django. What I want is to fetch document from mallard and display it in HTML. using django. Is there any possibles? Sorry. Little urgent. So, Opened an issue.

shaunix commented 8 years ago

Probably best to discuss this on mallard-list: http://projectmallard.org/about/contact

The easiest way to just generate an HTML file is with yelp-build, part of the yelp-tools package. You can generate HTML files for a bunch of page files like this:

yelp-build html *.page

If you want to build them one at a time, you can do that too, but for automatic links between pages to work, you have to first generate a cache file and pass that to yelp-build.

yelp-build cache -o index.cache *.page
yelp-build html -c index.cache foo.page
yelp-build html -c index.cache bar.page

As for integrating this into a Django workflow, I don't have an easy answer. You can certainly just pass on the HTML, but it's a complete HTML file, and not really something you can pass through Django's templates. You could recreate your site's look with XSLT extensions, which you can pass with the -x option to yelp-build. Or you can dig into yelp-xsl to get a div output. Or you could reimplement your own transforms in pure Python. The core language is pretty small.

kittykat commented 8 years ago

This is actually something that I'm interested in as well as I am writing Mallard docs for integration into a Django portal. For the moment we are planning to do with generating html using yelp-build.