This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/md_pdf/build/__init__.py

16 lines
589 B
Python
Raw Normal View History

2017-03-29 18:26:54 +01:00
from md_pdf.build.md import read_files
from md_pdf.build.pandoc import build_document, output_html
from md_pdf.build.cover import render_cover
from md_pdf.build.pdf import export_pdf
import os
2017-03-29 19:16:12 +01:00
def build(config):
2017-03-29 19:20:08 +01:00
data = read_files(os.path.abspath(config.input))
2017-03-30 18:01:48 +01:00
doc = build_document(data, getattr(config, 'bibliography', None), getattr(config, 'context', None))
2017-03-29 19:16:12 +01:00
if 'html' in config.output_formats:
2017-03-29 19:20:08 +01:00
output_html(doc, os.path.abspath(config.output_dir))
2017-03-29 19:16:12 +01:00
if 'pdf' in config.output_formats:
2017-03-30 17:08:00 +01:00
render_cover(config.context.toDict())
2017-03-30 08:52:35 +01:00
export_pdf(doc, config)