Example #1
0
def _generate_glossary_content(terms: ItemMap) -> SphinxContent:
    content = SphinxContent()
    content.add_header("Glossary", level="*")
    content.add_blank_line()
    content.add_line(".. glossary::")
    content.add_line(":sorted:", indent=1)
    macro_to_sphinx = MacroToSphinx()
    macro_to_sphinx.set_terms(terms)
    for item in sorted(terms.values(),
                       key=lambda x: x["glossary-term"].lower()):
        text = macro_to_sphinx.substitute(item["text"].strip())
        item.register_license_and_copyrights(content)
        content.add_definition_item(item["glossary-term"], text, indent=1)
    content.add_licence_and_copyrights()
    return content
Example #2
0
def _generate_content(group: Item, options: ItemMap,
                      item_cache: ItemCache) -> SphinxContent:
    content = SphinxContent()
    group.register_license_and_copyrights(content)
    content.add_header(group["appl-config-group-name"], level="=")
    content.add_blank_line()
    content.add_lines(group["appl-config-group-description"])
    for item in sorted(options.values(), key=lambda x: x.uid):
        name = item["appl-config-option-name"]
        item.register_license_and_copyrights(content)
        content.add_index_entries([name] + item["appl-config-option-index"])
        content.add_blank_line()
        content.add_label(name)
        content.add_blank_line()
        content.add_header(name, level="-")
        content.add_definition_item("CONSTANT:", f"``{name}``")
        option_type = item["appl-config-option-type"]
        content.add_definition_item("OPTION TYPE:", _OPTION_TYPES[option_type])
        _OPTION_GENERATORS[option_type](content, item, option_type, item_cache)
        content.add_definition_item("DESCRIPTION:",
                                    item["appl-config-option-description"])
        _generate_notes(content, item["appl-config-option-notes"])
    content.add_licence_and_copyrights()
    return content
Example #3
0
def test_add_blank_line():
    sc = SphinxContent()
    sc.add_blank_line()
    assert "\n" == sc.content