Example #1
0
def get_synopsis(program):
    synopsis = etree.Element("cmdsynopsis")
    synopsis.append(get_text_node_simple("command", program.name))

    # add required options
    for g in program.option_groups:
        for o in g.options:
            if o.required:
                node = etree.Element("arg", choice="req")
                node.text = "-" + o.short + " "
                node.append(get_text_node_simple("replaceable", o.type))
                synopsis.append(node)

    # add standard option hint
    node = etree.SubElement(synopsis, "arg", rep="repeat")
    node.append(get_text_node_simple("replaceable", "options"))

    #add free parameter if exists
    if not program.FreeParams is None:
        node = etree.SubElement(synopsis, "arg", rep="repeat")
        plugin = etree.SubElement(node, "replaceable")
        etree.SubElement(plugin,
                         "xref",
                         linkend=make_sec_ancor("SecPlugintype",
                                                program.FreeParams))

    return synopsis
Example #2
0
def make_section_root_node(tag, name):
    secid = make_sec_ancor("Sec", name)
    section = etree.Element(tag)
    section.set(xmlns + "id", secid)
    section.set("xreflabel", name)
    title = etree.Element("title")
    title.text = name
    section.append(title)
    return section
Example #3
0
def translate_descr(section, description):
    descrpara = etree.SubElement(section, "para", role="sectiondescr")
    for d in description:
        para = etree.SubElement(descrpara, "para", role="sectiondescr")
        para.text = d.text
        for l in d.iter("link"):
            link = etree.SubElement(para, "xref", linkend=make_sec_ancor(l.get("key"), l.text))
            link.tail = l.tail
    return descrpara
Example #4
0
def make_section_root_node(tag, name):
    secid = make_sec_ancor("Sec", name)
    section = etree.Element(tag)
    section.set(xmlns + "id", secid)
    section.set("xreflabel", name)
    title = etree.Element("title")
    title.text = name
    section.append(title)
    return section
Example #5
0
def translate_descr(section, description):
    descrpara = etree.SubElement(section, "para", role="sectiondescr")
    for d in description:
        para = etree.SubElement(descrpara, "para", role="sectiondescr")
        para.text = d.text
        for l in d.iter("link"):
            link = etree.SubElement(para,
                                    "xref",
                                    linkend=make_sec_ancor(
                                        l.get("key"), l.text))
            link.tail = l.tail
    return descrpara
Example #6
0
def get_synopsis(program):
    synopsis = etree.Element("cmdsynopsis")
    synopsis.append(get_text_node_simple("command", program.name))
    
    # add required options 
    for g in program.option_groups:
        for o in g.options:
            if o.required:
                node = etree.Element("arg", choice="req")
                node.text = "-" + o.short + " "
                node.append(get_text_node_simple("replaceable",  o.type))
                synopsis.append(node)
    
    # add standard option hint 
    node = etree.SubElement(synopsis, "arg", rep="repeat")
    node.append(get_text_node_simple("replaceable",  "options"))
    
    #add free parameter if exists
    if not program.FreeParams is None:
           node = etree.SubElement(synopsis, "arg", rep="repeat")
           plugin = etree.SubElement(node, "replaceable")
           etree.SubElement(plugin, "xref", linkend=make_sec_ancor("SecPlugintype", program.FreeParams))
    
    return synopsis