Пример #1
0
Файл: toc.py Проект: AXNY/docs
def make_toc():
    inputs = [i for i in util.expand_tree('./source/includes') if i.startswith('./source/includes/ref-toc-') ]

    for document in inputs:
        document = document[2:]

        base_name = document.rsplit('/', 1)[1].rsplit('.', 1)[0][8:]
        
        m.section_break(document)
        
        table_target = 'source/includes/table-' + base_name + '.rst'
        m.append_var('ref-toc-output', table_target, block=base_name)
        m.target(target=table_target,
                 dependency=[document, 'bin/toc_builder.py'], block=base_name)
        m.job('$(PYTHONBIN) bin/toc_builder.py $< --table $@', block=base_name)
        m.msg('[toc-builder]: built table file for %s' % base_name, block=base_name)

        m.newline()
        toc_target = 'source/includes/toc-' + base_name + '.rst'
        m.append_var('ref-toc-output', toc_target, block=base_name)
        m.target(target=toc_target,
                 dependency=[document, 'bin/toc_builder.py'], block=base_name)
        m.job('$(PYTHONBIN) bin/toc_builder.py $< --contents $@', block=base_name)
        m.msg('[toc-builder]: built toctree file for %s' % base_name, block=base_name)

    m.section_break('meta')
    m.target('.PHONY', ['$(ref-toc-output)', 'ref-toc'], block='meta')
    m.target('ref-toc', '$(ref-toc-output)', block='meta')
    m.target('clean-ref-toc', block='meta')
    m.job('rm -f $(ref-toc-output)', ignore=True)
Пример #2
0
def collect_source_files():
    output = []

    for i in util.expand_tree('./source/includes', 'yaml'):
        if i.startswith('./source/includes/ref-toc-'):
            output.append((i, 'table'))
        if i.startswith('./source/includes/toc-'):
            output.append((i, 'dfn'))

    return output
Пример #3
0
def collect_source_files():
    output = []

    for i in util.expand_tree('./source/includes', 'yaml'):
        if i.startswith('./source/includes/ref-toc-'):
            output.append((i, 'table'))
        if i.startswith('./source/includes/toc-'):
            output.append((i, 'dfn'))

    return output
Пример #4
0
def make_toc():
    inputs = [
        i for i in util.expand_tree('./source/includes')
        if i.startswith('./source/includes/ref-toc-')
    ]

    for document in inputs:
        document = document[2:]

        base_name = document.rsplit('/', 1)[1].rsplit('.', 1)[0][8:]

        m.section_break(document)

        table_target = 'source/includes/table-' + base_name + '.rst'
        m.append_var('ref-toc-output', table_target, block=base_name)
        m.target(target=table_target,
                 dependency=[document, 'bin/toc_builder.py'],
                 block=base_name)
        m.job('$(PYTHONBIN) bin/toc_builder.py $< --table $@', block=base_name)
        m.msg('[toc-builder]: built table file for %s' % base_name,
              block=base_name)

        m.newline()
        toc_target = 'source/includes/toc-' + base_name + '.rst'
        m.append_var('ref-toc-output', toc_target, block=base_name)
        m.target(target=toc_target,
                 dependency=[document, 'bin/toc_builder.py'],
                 block=base_name)
        m.job('$(PYTHONBIN) bin/toc_builder.py $< --contents $@',
              block=base_name)
        m.msg('[toc-builder]: built toctree file for %s' % base_name,
              block=base_name)

    m.section_break('meta')
    m.target('.PHONY', ['clean-ref-toc', 'ref-toc', 'reftoc', 'clean-reftoc'],
             block='meta')
    m.target(['ref-toc', 'reftoc'], '$(ref-toc-output)', block='meta')
    m.target(['clean-ref-toc', 'clean-reftoc'], block='meta')
    m.job('rm -f $(ref-toc-output)', ignore=True)
    m.msg('[toc-builder]: cleaned all ref-toc build products.')