Exemplo n.º 1
0
def get_ncx_toc_entries(book_config):
    xml = [
        get_ncx_toc_entry("Title Page", config.struct.title.filename, 1),
        get_ncx_toc_entry("Copyright", config.struct.copyright.filename, 2),
        get_ncx_toc_entry("Dedication", config.struct.dedication.filename, 3),
        get_ncx_toc_entry("Acknowledgements", config.struct.ack.filename, 4),
        ]
    for index, heading in enumerate(md.assemble_headings(book_config)):
        anchor = md.get_anchor_name(heading)
        linktext = heading.strip("#").replace("`", "").strip()
        indent = get_indent(heading) * const.toc_indent
        xml.append(get_ncx_toc_entry(linktext, config.struct.main.filename,
                                     index + 5, anchor, indent))
    return "\n".join(xml)
Exemplo n.º 2
0
def get_toc_entries(book_config):
    html = [
        get_toc_entry("Title Page", config.struct.title.filename),
        get_toc_entry("Copyright", config.struct.copyright.filename),
        get_toc_entry("Dedication", config.struct.dedication.filename),
        get_toc_entry("Acknowledgements", config.struct.ack.filename),
        ]
    for heading in md.assemble_headings(book_config):
        linktext = heading.strip("#").replace("`", "").strip()
        anchor = md.get_anchor_name(heading)
        indent = get_indent(heading)
        filename = config.struct.main.filename
        html.append(get_toc_entry(linktext, filename, anchor, indent))
    return "\n".join(html)