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

Add asciidoc template name support #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion corsair/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def generate_templates(format):
targets.update(corsair.generators.Python(path="sw/regs.py").make_target('py'))
targets.update(corsair.generators.CHeader(path="sw/regs.h").make_target('c_header'))
targets.update(corsair.generators.Markdown(path="doc/regs.md", image_dir="md_img").make_target('md_doc'))
targets.update(corsair.generators.Asciidoc(path="doc/regs.adoc", image_dir="adoc_img").make_target('asciidoc_doc'))
targets.update(corsair.generators.Asciidoc(template="regmap_asciidoc.j2",path="doc/regs.adoc", image_dir="adoc_img").make_target('asciidoc_doc'))

# create templates
if format == 'txt':
Expand Down
7 changes: 5 additions & 2 deletions corsair/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ class Asciidoc(Generator, Jinja2, Wavedrom):

:param rmap: Register map object
:type rmap: :class:`corsair.RegisterMap`
:param template: Name of template file
:type template: str
:param path: Path to the output file
:type path: str
:param title: Document title
Expand All @@ -551,9 +553,10 @@ class Asciidoc(Generator, Jinja2, Wavedrom):
:type print_conventions: bool
"""

def __init__(self, rmap=None, path='regs.adoc', title='Register map',
def __init__(self, rmap=None, template='regmap_asciidoc.j2', path='regs.adoc', title='Register map',
print_images=True, image_dir="regs_img", print_conventions=True, **args):
super().__init__(rmap, **args)
self.template = template
self.path = path
self.title = title
self.print_images = print_images
Expand All @@ -565,7 +568,7 @@ def generate(self):
# validate parameters
self.validate()
# prepare jinja2
j2_template = 'regmap_asciidoc.j2'
j2_template = self.template
j2_vars = {}
j2_vars['corsair_ver'] = __version__
j2_vars['rmap'] = self.rmap
Expand Down