Esempio n. 1
0
    def get_html(self):
        html = ''
        if self.__documentation['content']:
            root = repo_root()
            html_template_path = root / 'templates/docs/html/index.html'
            html_template = html_template_path.read_text()

            css_template_path = root / \
                'templates/docs/html/github-markdown.css'

            html_body = pypandoc.convert_text(
                self.__documentation['content'],
                'html',
                format='markdown',
                extra_args=['--section-divs']
            )
            t = Template(html_template)

            data = {
                '__DOCUMENTATION_BODY__': html_body,
                '__CSS__': css_template_path.read_text()
            }

            html = t.substitute(data)

        return html
Esempio n. 2
0
def load_genesis_template(wrkchain_base, wrkchain_consensus):
    template_file = repo_root() / 'templates' / 'genesis' / wrkchain_base / \
                    f'{wrkchain_consensus}.json'

    with open(template_file, 'r') as f:
        contents = f.read()
        t = json.loads(contents)

    return t
Esempio n. 3
0
    def __init__(self, md_path, section_number, title):
        self.__template_dir = 'templates/docs/md/sections/'
        self.root_dir = repo_root()

        self.template_path = self.root_dir / \
            self.__template_dir / md_path

        self.template = self.template_path.read_text()
        self.contents = ''
        self.title = ''
        self.section_number = section_number
        self.set_title(section_number, title)
Esempio n. 4
0
def copy_readme(build_dir):
    readme_src = repo_root() / 'templates' / 'docs' / 'md' / 'README.md'
    readme_dst = Path(build_dir) / 'README.md'
    copyfile(readme_src, readme_dst)
Esempio n. 5
0
 def __load_template(self):
     template_path = repo_root() / self.__documentation['path']
     self.__documentation['template'] = \
         template_path.read_text()