コード例 #1
0
ファイル: toc.py プロジェクト: TylerBrock/docs-tools
def _generate_toc_tree(fn, fmt, base_name, paths, conf):
    print('[toc]: generating {0} toc'.format(fn))

    if fmt == 'spec':
        toc = AggregatedTocTree(fn, conf)
        fmt = toc._first_source[0:3]
        toc.build_dfn()
        toc.build_table()
        toc.finalize()

        if fmt == 'ref':
            if toc.table is not None:
                outfn = _get_toc_output_name(base_name, 'table', paths)
                t = TableBuilder(RstTable(toc.table))
                t.write(outfn)
                print('[toc-spec]: wrote: '  + outfn)
        elif fmt == 'toc':
            outfn = _get_toc_output_name(base_name, 'dfn-list', paths)
            toc.dfn.write(outfn)
            print('[toc-spec]: wrote: '  + outfn)

    else:
        toc = CustomTocTree(fn, conf)
        toc.build_contents()

        if fmt == 'toc':
            toc.build_dfn()
        elif fmt == 'ref':
            toc.build_table()

        toc.finalize()

        outfn = _get_toc_output_name(base_name, 'toc', paths)
        toc.contents.write(outfn)
        print('[toc]: wrote: '  + outfn)

        if fmt == 'ref':
            outfn = _get_toc_output_name(base_name, 'table', paths)
            t = TableBuilder(RstTable(toc.table))
            t.write(outfn)
            print('[ref-toc]: wrote: '  + outfn)
        elif fmt == 'toc':
            outfn = _get_toc_output_name(base_name, 'dfn-list', paths)
            toc.dfn.write(outfn)
            print('[toc]: wrote: '  + outfn)

    print('[toc]: compiled toc output for {0}'.format(fn))
コード例 #2
0
ファイル: toc.py プロジェクト: rawfalafel/docs-tools
def _generate_toc_tree(fn, fmt, base_name, paths, conf):
    if fmt == 'spec':
        logger.debug('generating spec toc {0}'.format(fn))

        toc = AggregatedTocTree(fn, conf)
        fmt = toc._first_source[0:3]
        toc.build_dfn()
        toc.build_table()
        toc.finalize()

        if fmt == 'ref':
            if toc.table is not None:
                outfn = _get_toc_output_name(base_name, 'table', paths)
                t = TableBuilder(RstTable(toc.table))
                t.write(outfn)
                logger.debug('wrote spec ref-toc: ' + outfn)
        elif fmt == 'toc':
            outfn = _get_toc_output_name(base_name, 'dfn-list', paths)
            toc.dfn.write(outfn)
            logger.debug('wrote spec toc: ' + outfn)
    else:
        logger.debug('generating toc {0}'.format(fn))

        toc = CustomTocTree(fn, conf)
        toc.build_contents()

        if fmt == 'toc':
            toc.build_dfn()
        elif fmt == 'ref':
            toc.build_table()

        toc.finalize()

        outfn = _get_toc_output_name(base_name, 'toc', paths)
        toc.contents.write(outfn)
        logger.debug('wrote toc: ' + outfn)

        if fmt == 'ref':
            outfn = _get_toc_output_name(base_name, 'table', paths)
            t = TableBuilder(RstTable(toc.table))
            t.write(outfn)
            logger.debug('wrote ref toc: ' + outfn)
        elif fmt == 'toc':
            outfn = _get_toc_output_name(base_name, 'dfn-list', paths)
            toc.dfn.write(outfn)
            logger.debug('wrote toc file: ' + outfn)
コード例 #3
0
ファイル: toc.py プロジェクト: RandomStuffs22/docs-tools
def _generate_toc_tree(fn, fmt, base_name, paths):
    print("[toc]: generating {0} toc".format(fn))
    if fmt == "spec":
        toc = AggregatedTocTree(fn)
        fmt = toc._first_source[0:3]
        toc.build_dfn()
        toc.build_table()
        toc.finalize()

        if fmt == "ref":
            if toc.table is not None:
                outfn = _get_toc_output_name(base_name, "table", paths)
                t = TableBuilder(RstTable(toc.table))
                t.write(outfn)
                print("[toc-spec]: wrote: " + outfn)
        elif fmt == "toc":
            outfn = _get_toc_output_name(base_name, "dfn-list", paths)
            toc.dfn.write(outfn)
            print("[toc-spec]: wrote: " + outfn)

    else:
        toc = CustomTocTree(fn)
        toc.build_contents()

        if fmt == "toc":
            toc.build_dfn()
        elif fmt == "ref":
            toc.build_table()

        toc.finalize()

        outfn = _get_toc_output_name(base_name, "toc", paths)
        toc.contents.write(outfn)
        print("[toc]: wrote: " + outfn)

        if fmt == "ref":
            outfn = _get_toc_output_name(base_name, "table", paths)
            t = TableBuilder(RstTable(toc.table))
            t.write(outfn)
            print("[ref-toc]: wrote: " + outfn)
        elif fmt == "toc":
            outfn = _get_toc_output_name(base_name, "dfn-list", paths)
            toc.dfn.write(outfn)
            print("[toc]: wrote: " + outfn)

    print("[toc]: compiled toc output for {0}".format(fn))
コード例 #4
0
ファイル: toc.py プロジェクト: rawfalafel/docs-tools
def _generate_toc_tree(fn, fmt, base_name, paths, conf):
    if fmt == "spec":
        logger.debug("generating spec toc {0}".format(fn))

        toc = AggregatedTocTree(fn, conf)
        fmt = toc._first_source[0:3]
        toc.build_dfn()
        toc.build_table()
        toc.finalize()

        if fmt == "ref":
            if toc.table is not None:
                outfn = _get_toc_output_name(base_name, "table", paths)
                t = TableBuilder(RstTable(toc.table))
                t.write(outfn)
                logger.debug("wrote spec ref-toc: " + outfn)
        elif fmt == "toc":
            outfn = _get_toc_output_name(base_name, "dfn-list", paths)
            toc.dfn.write(outfn)
            logger.debug("wrote spec toc: " + outfn)
    else:
        logger.debug("generating toc {0}".format(fn))

        toc = CustomTocTree(fn, conf)
        toc.build_contents()

        if fmt == "toc":
            toc.build_dfn()
        elif fmt == "ref":
            toc.build_table()

        toc.finalize()

        outfn = _get_toc_output_name(base_name, "toc", paths)
        toc.contents.write(outfn)
        logger.debug("wrote toc: " + outfn)

        if fmt == "ref":
            outfn = _get_toc_output_name(base_name, "table", paths)
            t = TableBuilder(RstTable(toc.table))
            t.write(outfn)
            logger.debug("wrote ref toc: " + outfn)
        elif fmt == "toc":
            outfn = _get_toc_output_name(base_name, "dfn-list", paths)
            toc.dfn.write(outfn)
            logger.debug("wrote toc file: " + outfn)
コード例 #5
0
ファイル: toc.py プロジェクト: RandomStuffs22/docs-tools
def _generate_toc_tree(fn, fmt, base_name, paths):
    print('[toc]: generating {0} toc'.format(fn))
    if fmt == 'spec':
        toc = AggregatedTocTree(fn)
        fmt = toc._first_source[0:3]
        toc.build_dfn()
        toc.build_table()
        toc.finalize()

        if fmt == 'ref':
            if toc.table is not None:
                outfn = _get_toc_output_name(base_name, 'table', paths)
                t = TableBuilder(RstTable(toc.table))
                t.write(outfn)
                print('[toc-spec]: wrote: ' + outfn)
        elif fmt == 'toc':
            outfn = _get_toc_output_name(base_name, 'dfn-list', paths)
            toc.dfn.write(outfn)
            print('[toc-spec]: wrote: ' + outfn)

    else:
        toc = CustomTocTree(fn)
        toc.build_contents()

        if fmt == 'toc':
            toc.build_dfn()
        elif fmt == 'ref':
            toc.build_table()

        toc.finalize()

        outfn = _get_toc_output_name(base_name, 'toc', paths)
        toc.contents.write(outfn)
        print('[toc]: wrote: ' + outfn)

        if fmt == 'ref':
            outfn = _get_toc_output_name(base_name, 'table', paths)
            t = TableBuilder(RstTable(toc.table))
            t.write(outfn)
            print('[ref-toc]: wrote: ' + outfn)
        elif fmt == 'toc':
            outfn = _get_toc_output_name(base_name, 'dfn-list', paths)
            toc.dfn.write(outfn)
            print('[toc]: wrote: ' + outfn)

    print('[toc]: compiled toc output for {0}'.format(fn))