Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you use a custom template? #390

Open
laxnash opened this issue Jan 5, 2023 · 1 comment
Open

How do you use a custom template? #390

laxnash opened this issue Jan 5, 2023 · 1 comment

Comments

@laxnash
Copy link

laxnash commented Jan 5, 2023

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?

@brechtm
Copy link
Owner

brechtm commented Jan 6, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants