Example #1
0
 def delete_cover_art(self):
     """Delete the cover art file and unset cover_art."""
     try:
         fileutil.remove(self.cover_art)
     except (OSError, TypeError):
         pass
     self.cover_art = None
Example #2
0
def pdf_compile():
    """
    Compiles any tex files in the out directory to PDF or DVI depending on what `compile_format` is set to. All
    additional files (aux, log, tex) are removed once compilation completes.
    """
    options.state.cwd(options.state.out())
    options.post('Compiling', len(fileutil.with_extension('.tex')), 'files.')
    for file in fileutil.with_extension('.tex'):
        if compile_format == 'dvi':
            fileutil.write(file, '%&latex\n' + fileutil.read(file))
        try:
            fileutil.remove(file.replace('.tex', '.pdf'))
        except:
            pass
        for i in range(options.state.recomps()):
            lib_loader.pdflatex(file)
    fileutil.remove(fileutil.with_extension(['.aux', '.log', '.tex']))
    options.post('Finished compiling.\n')
Example #3
0
def pdf_compile():
    """
    Compiles any tex files in the out directory to PDF or DVI depending on what `compile_format` is set to. All
    additional files (aux, log, tex) are removed once compilation completes.
    """
    options.state.cwd(options.state.out())
    options.post('Compiling', len(fileutil.with_extension('.tex')), 'files.')
    for file in fileutil.with_extension('.tex'):
        if compile_format == 'dvi':
            fileutil.write(file, '%&latex\n' + fileutil.read(file))
        try:
            fileutil.remove(file.replace('.tex', '.pdf'))
        except:
            pass
        for i in range(options.state.recomps()):
            lib_loader.pdflatex(file)
    fileutil.remove(fileutil.with_extension(['.aux', '.log', '.tex']))
    options.post('Finished compiling.\n')
Example #4
0
def compile_doc(build, doc):
    """
    Converts the given file from markdown to HTML and then copies it to the build directory.

    :param build: The directory of the file to compile
    :param doc: The file to compile
    """
    pyxam.pyxam.start([
        '-w',           # Disable weaving
        '-f', 'html',   # Convert to HTML
        '-o', build,    # Output to the build directory
        '-t', 'doc',    # Title the file doc
        '-htt', config.template_directory + '/docs.html', doc   # Use the docs template
    ])
    buffer = fileutil.read(build + '/doc_v1.html')
    fileutil.remove(doc)
    fileutil.remove(build + '/doc_v1.html')
    fileutil.write(
        doc.replace('.md', '.html'),
        buffer
            .replace('<!-- nav -->', nav)
            .replace('<!-- table -->', table + '</ul>')
            .replace('%/', url + '/')
    )