Ejemplo n.º 1
0
def test_add_lines():
    sc = SphinxContent()
    sc.add_lines("x")
    assert sc.content == "x\n"
    sc.add_lines("y", 1)
    assert sc.content == "x\n    y\n"
    sc.add_lines(["a", "b"])
    assert sc.content == "x\n    y\na\nb\n"
Ejemplo n.º 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