コード例 #1
0
ファイル: converter.py プロジェクト: danielhjames/Booktype
    def _create_frontmatter(self, book):
        """Creates front matter file.

        Front matter HTML file will be used by booktype2mpdf.php script to create
        PDF file.

        :Args:
          - book: EPUB Book object
        """

        data = self._get_data(book)
        data.update(self.get_extra_data(book))

        frontmatter_name = get_single_frontmatter(self.theme_name, self.name)
        html = render_to_string(frontmatter_name, data)

        f = codecs.open('{}/frontmatter.html'.format(self.sandbox_path), 'wt', 'utf8')
        f.write(html)
        f.close()
コード例 #2
0
    def _create_frontmatter(self, book):
        """Creates front matter file.

        Front matter HTML file will be used by booktype2mpdf.php script to create
        PDF file.

        :Args:
          - book: EPUB Book object
        """

        data = self._get_data(book)
        data.update(self.get_extra_data(book))

        frontmatter_name = get_single_frontmatter(self.theme_name, self.name)
        html = render_to_string(frontmatter_name, data)

        f = codecs.open('{}/frontmatter.html'.format(self.sandbox_path), 'wt',
                        'utf8')
        f.write(html)
        f.close()