Template re-org

* Re-organized template structure
* Added default novel template
This commit is contained in:
Dmytro Yeroshkin 2022-02-02 21:51:04 +01:00
parent e4f187e292
commit 8afddb7217
4 changed files with 8 additions and 2 deletions

1
MANIFEST.in Normal file
View File

@ -0,0 +1 @@
recursive-include novel_compiler templates *.docx

View File

@ -6,6 +6,7 @@ import tempfile
import MarkdownPP import MarkdownPP
import json import json
from lxml import etree from lxml import etree
from importlib.resources import path
TITLE_MARKER = '# ' TITLE_MARKER = '# '
AUTHOR_MARKER = '### ' AUTHOR_MARKER = '### '
@ -123,8 +124,12 @@ def main():
) )
arguments = parser.parse_args() arguments = parser.parse_args()
arguments.template.close() if arguments.template:
doc = DocxTemplate(arguments.template.name) arguments.template.close()
doc = DocxTemplate(arguments.template.name)
else:
with path('novel_compiler.templates', 'novel.docx') as novel_template:
doc = DocxTemplate(novel_template)
if arguments.pp: if arguments.pp:
mdfile = tempfile.TemporaryFile(mode='w+') mdfile = tempfile.TemporaryFile(mode='w+')
MarkdownPP.MarkdownPP( MarkdownPP.MarkdownPP(

View File