How to use DocOnce - 4 common examples

To help you get started, we’ve selected a few DocOnce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hplgit / parampool / parampool / generator / flask / generate_template.py View on Github external
def run_doconce_on_text(doc):
    if doc is None:
        return ''

    def wrap_in_pre_tags(text):
        return '<code><pre>\n%s\n</pre></code>\n' % text

    if re.search(r'#\s*\(?[Dd]oc[Oo]nce', doc):
        from doconce.common import fix_backslashes
        doc = fix_backslashes(doc)
        # Remove indentation
        lines = doc.splitlines()
        for i in range(len(lines)):
            if lines[i][0:4] == '    ':
                lines[i] = lines[i][4:]
        doc = '\n'.join(lines)

        # Run doconce using a lib version of the doconce format command
        from doconce import doconce_format, DocOnceSyntaxError
        stem = 'tmp_doc_string'
        try:
            print 'Found doc string in doconce format:'
            print 'Running doconce on help file', stem + '.do.txt'
            doc = doconce_format('html', doc, filename_stem=stem,
                                 cleanup=False)
            # grab parts
github hplgit / parampool / parampool / generator / flask / generate_template.py View on Github external
from doconce.common import fix_backslashes
        doc = fix_backslashes(doc)
        # Remove indentation
        lines = doc.splitlines()
        for i in range(len(lines)):
            if lines[i][0:4] == '    ':
                lines[i] = lines[i][4:]
        doc = '\n'.join(lines)

        # Run doconce using a lib version of the doconce format command
        from doconce import doconce_format, DocOnceSyntaxError
        stem = 'tmp_doc_string'
        try:
            print 'Found doc string in doconce format:'
            print 'Running doconce on help file', stem + '.do.txt'
            doc = doconce_format('html', doc, filename_stem=stem,
                                 cleanup=False)
            # grab parts
            pattern = r'()'
            m = re.search(pattern, doc, flags=re.DOTALL)
            if m:
                doc = m.group(1) + '\n'
                doc = doc.replace('\n', '')
            files = [stem + '.do.txt',
                     stem + '.html',
                     '.' + stem + '_html_file_collection']
            #for name in files:
            #    os.remove(name)
        except DocOnceSyntaxError, e:
            print e
            doc = wrap_in_pre_tags(doc)
    else:
github hplgit / parampool / parampool / generator / flask / generate_template.py View on Github external
print 'Found doc string in doconce format:'
            print 'Running doconce on help file', stem + '.do.txt'
            doc = doconce_format('html', doc, filename_stem=stem,
                                 cleanup=False)
            # grab parts
            pattern = r'()'
            m = re.search(pattern, doc, flags=re.DOTALL)
            if m:
                doc = m.group(1) + '\n'
                doc = doc.replace('\n', '')
            files = [stem + '.do.txt',
                     stem + '.html',
                     '.' + stem + '_html_file_collection']
            #for name in files:
            #    os.remove(name)
        except DocOnceSyntaxError, e:
            print e
            doc = wrap_in_pre_tags(doc)
    else:
        doc = wrap_in_pre_tags(doc)
    return doc
github spectralDNS / shenfun / docs / src / mekit17 / sphinx-rootdir / conf.py View on Github external
def setup(app):
    from sphinx.highlighting import lexers
    from doconce.misc import DocOnceLexer
    lexers['doconce'] = DocOnceLexer()

DocOnce

Markup language similar to Markdown targeting scientific reports, software documentation, books, blog posts, and slides. DocOnce can generate LaTeX, Sphinx, HTML, IPython notebooks, Markdown, MediaWiki, and other formats

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

39 / 100
Full package analysis