Beispiel #1
0
def main(logger=mylog.default_logger()):
    # load arguments and logger
    arguments = docopt(__doc__, version='0.0')
    # script self name
    self_name = os.path.basename(sys.argv[0])
    # log
    logfile = self_name.replace('py', 'log')
    logger = set_mylogger(arguments, logfile)
    # load config
    # main_config=load_config('.ll')

    # set filename varibles
    # main_title=os.path.basename(os.getcwd())
    # markdown_file_name=os.path.join(os.getcwd(),'build',main_title+'.markdown')
    # docx_file_name=main_title+'.docx'
    # rtf_file_name=main_title+'.rtf'

    latexmk_arg = [
        '-pdf', '-f', '-quiet', '-e',
        r'$pdflatex=q/xelatex %O -interaction=nonstopmode %S/'
    ]
    if arguments['--quiet']:
        latexmk_arg.append('-quiet')

    if arguments['<tex_file_name>']:
        latexmk_arg.append(arguments['<tex_file_name>'])
        try:
            sh.latexmk(*latexmk_arg)

        except Exception, e:
            pass
        pdf_file_name = arguments['<tex_file_name>'].replace('tex', 'pdf')
        if arguments['--view'] and os.path.exists(pdf_file_name):
            sh.open(pdf_file_name)
Beispiel #2
0
def main(logger=mylog.default_logger()):
    # load arguments and logger
    arguments = docopt(__doc__, version='0.0')
    # script self name
    self_name=os.path.basename(sys.argv[0])
    # log
    logfile=self_name.replace('py','log')
    logger=set_mylogger(arguments,logfile)
    # load config
    # main_config=load_config('.ll')

    # set filename varibles
    # main_title=os.path.basename(os.getcwd())
    # markdown_file_name=os.path.join(os.getcwd(),'build',main_title+'.markdown')
    # docx_file_name=main_title+'.docx'
    # rtf_file_name=main_title+'.rtf'

    latexmk_arg=['-pdf','-f','-quiet','-e',r'$pdflatex=q/xelatex %O -interaction=nonstopmode %S/']
    if arguments['--quiet']:
        latexmk_arg.append('-quiet')

    if arguments['<tex_file_name>']:
        latexmk_arg.append(arguments['<tex_file_name>'])
        try:
            sh.latexmk(*latexmk_arg)

        except Exception, e:
            pass
        pdf_file_name=arguments['<tex_file_name>'].replace('tex','pdf')
        if arguments['--view'] and os.path.exists(pdf_file_name):
            sh.open(pdf_file_name)
Beispiel #3
0
            sh.latexmk(*latexmk_arg)

        except Exception, e:
            pass
        pdf_file_name = arguments['<tex_file_name>'].replace('tex', 'pdf')
        if arguments['--view'] and os.path.exists(pdf_file_name):
            sh.open(pdf_file_name)

    else:
        effective_file = re.compile(r'.*\.tex$')
        for filename in os.listdir('.'):
            if effective_file.match(filename):
                latexmk_arg.append(filename)

                try:
                    sh.latexmk(*latexmk_arg)

                except Exception, e:
                    pass
                pdf_file_name = filename.replace('tex', 'pdf')
                if arguments['--view'] and os.path.exists(pdf_file_name):
                    sh.open(pdf_file_name)

    # if arguments['tex_file_name']

    ## file open operations
    # markdown_file=open(markdown_file_name, 'w')
    # markdown_file.close()
    # sh.open(markdown_file_name)

    # markdown_file=open(markdown_file_name, 'r')
Beispiel #4
0
            sh.latexmk(*latexmk_arg)

        except Exception, e:
            pass
        pdf_file_name=arguments['<tex_file_name>'].replace('tex','pdf')
        if arguments['--view'] and os.path.exists(pdf_file_name):
            sh.open(pdf_file_name)

    else:
        effective_file=re.compile(r'.*\.tex$')
        for filename in os.listdir('.'):
            if effective_file.match(filename):
                latexmk_arg.append(filename)

                try:
                    sh.latexmk(*latexmk_arg)

                except Exception, e:
                    pass
                pdf_file_name=filename.replace('tex','pdf')
                if arguments['--view'] and os.path.exists(pdf_file_name):
                    sh.open(pdf_file_name)





    # if arguments['tex_file_name']

    ## file open operations
    # markdown_file=open(markdown_file_name, 'w')