Example #1
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    if OPTIONS['pandoc']['output'] != '-':
        move_temp_files_back(OPTIONS['pandoc']['output'])
    else:
        panzertools.log('INFO', 'not run')
Example #2
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath != '-' and not OPTIONS['pandoc']['pdf_output']:
        print_log(filepath)
    else:
        panzertools.log('INFO', 'not run')
Example #3
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath != '-' and not OPTIONS['pandoc']['pdf_output']:
        print_log(filepath)
    else:
        panzertools.log('INFO', 'not run')
Example #4
0
def main():
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath != '-' \
       and not OPTIONS['pandoc']['pdf_output'] \
       and os.path.exists(filepath):
        os.remove(filepath)
        panzertools.log('INFO', 'removed "%s"' % filepath)
    else:
        panzertools.log('INFO', 'not run')
Example #5
0
def main():
    """main function"""
    options = panzertools.read_options()
    output = options["pandoc"]["output"]
    if output != "-":
        src_file = os.path.join(
            os.environ["PANZER_SHARED"], "javascript", "innoconv.mathjax.js"
        )
        build_path = os.path.dirname(output)
        shutil.copy(src_file, build_path)
Example #6
0
def main():
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath != '-' \
       and not OPTIONS['pandoc']['pdf_output'] \
       and os.path.exists(filepath):
        os.remove(filepath)
        panzertools.log('INFO', 'removed "%s"' % filepath)
    else:
        panzertools.log('INFO', 'not run')
Example #7
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath == '-':
        panzertools.log('INFO', 'not run')
        return
    target = panzertools.FileInfo(filepath)
    target.set_extension('.pdf')
    pdfpath = target.fullpath()
    if os.path.exists(pdfpath):
        open_pdf(pdfpath)
Example #8
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath == '-':
        panzertools.log('INFO', 'not run')
        return
    target = panzertools.FileInfo(filepath)
    target.set_extension('.pdf')
    pdfpath = target.fullpath()
    if os.path.exists(pdfpath):
        open_pdf(pdfpath)
Example #9
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath != '-' and not OPTIONS['pandoc']['pdf_output'] and os.path.exists(filepath):
        old_cwd = os.getcwd()
        try:
            run_latexmk(filepath)
        finally:
            os.chdir(old_cwd)
            panzertools.log('INFO', 'restored working directory to "%s"' % old_cwd)
    else:
        panzertools.log('INFO', 'not run')
Example #10
0
def main():
    """docstring for main"""
    OPTIONS = panzertools.read_options()
    filepath = OPTIONS['pandoc']['output']
    if filepath != '-' and not OPTIONS['pandoc'][
            'pdf_output'] and os.path.exists(filepath):
        old_cwd = os.getcwd()
        try:
            run_latexmk(filepath)
        finally:
            os.chdir(old_cwd)
            panzertools.log('INFO',
                            'restored working directory to "%s"' % old_cwd)
    else:
        panzertools.log('INFO', 'not run')
 def __init__(self, debug=False):
     self.debug = debug
     self.options = panzertools.read_options()
     self.filepath = self.options["pandoc"]["output"]
     self.convert_to = "json"
     if os.environ.get("INNOCONV_GENERATE_INNODOC_MARKDOWN"):
         panzertools.log("INFO", "Converting to Markdown.")
         self.convert_to = "markdown"
     if self.options["pandoc"]["write"] != "json":
         panzertools.log("ERROR", "Output is expected to be JSON!")
         sys.exit(0)
     # extract lang
     self.lang = None
     for key in self.options["pandoc"]["options"]["r"]["metadata"]:
         match = re.match(r"^lang:([a-z]{2})$", key[0])
         if match:
             self.lang = match.group(1)
     if not self.lang:
         raise RuntimeError("Error: Unable to extract lang key from metadata!")
     panzertools.log("INFO", "Found lang key={}".format(self.lang))