brechtm/rinohtype

How do you use a custom template?

laxnash opened this issue · 1 comments

The documentation lays out how to create a new template by subclassing an existing template like article. http://www.mos6581.org/rinohtype/master/templates.html
However, it doesnt say how to access the new template you created. In the source directory I have the conf.py file, which specifies the project-template.rtt file I created and the newtemplate.py file I created to subclass the article template. When I try to specify the new template I created in the project-template.rtt file it gives me an error saying it cant find my template. Is there a specific place I have to put the template? Is there a script I have to run to get rhinotype to see my template?

You have to register your custom template using the register_template() function. 'my_template' in the example below is the name by which you can then reference it in your .rtt file.

from rinoh import register_template

register_template('my_template', MyDocumentTemplate)

(Please don't close this issue; I'll close it once the documentation has been updated to cover this)