Closed mfrasca closed 6 years ago
in the template authoring instructions, consider referring to the site: http://getdrawings.com/tropical-leaves-drawing
As mentioned in #434, I grew definitely fed up with the low quality of the Mako documentation. I wanted to use inheritance in templates and from the Jinja2 docs I could produce a working example in 20 minutes, while I've spent no less than 2 hours trying to pin it down in Mako and did not manage. So I'm leaving Mako for historical reasons and I'm moving to Jinja2. Most utility functions still apply, obviously, as does this whole issue too.
loader = ChoiceLoader([FileSystemLoader(), PackageLoader()])
, forsan
todo:
resources
directory, sibling totemplates
.MakoFormatterPlugin
andFormatterPlugin
, from which to deriveJinja2FormatterPlugin
templates
directory for package-templatesadd_text
out of templates, into plugin module.add_text
.add_text
.insert_picture
work with either PIL.Image object or filename.insert_picture
work with Level (greyscale, ignoring Alpha)insert_picture
work with RGB (colours, ignoring Alpha)PS
and theSVG
namespaces and make them visible to Jinja2 and Makosecond thoughts
postscript production is currently severely bulky: in each template we have font definitions, this even messes up github statistics, making the system consider postscript the main language for our project. every template also contains copies of a couple of python functions which really belong in the report tool. now we would be adding pictures, and I would rather have them as external resources, not as included postscript data.
original notes
it is possible to include JPG data in PS files, but not out of the box, in the sense that we better provide some tools in the libs, that let us:
PS lets us easily work with JPG (it contains the right decoder), while if we want to do PNG (lossless) then we need do more work in Python, like decoding the PNG then encoding possibly with LZW (known to PS) before going to ASCII. I have not been successful with ASCII85.
please refer to this Q&A on stackoverflow.
if we want to do any other RGB format, consider we cannot do transparency (only True/False mask is available), we can go through PIL:
convert image.png -background white -alpha remove white.png