示例#1
0
def get_program(program):
    section = make_section_root_node("section", program.name)
    section.append(get_bridgehead("Sysnopis:"))
    section.append(get_synopsis(program))
    section.append(get_bridgehead("Description:"))
    section.append(get_text_node_simple("para", program.description))
    section.append(get_bridgehead("Options:"))
    
    for g in program.option_groups:
        if len(g.name) > 0:
            section.append(get_bridgehead(g.name))
            
        if len(g.options) > 0:
            varlist = etree.Element("variablelist", spacing="compact")
            for o in g.options:
                varlist.append(get_option_descr(o))
            section.append(varlist)

    if not program.Example is None:
        if not program.Example.text is None:
            section.append(get_bridgehead("Example:"))
            section.append(get_text_node_simple("para", program.Example.text))
            for c in program.Example.code:
                if not c.text is None: 
                    screen = etree.SubElement(section, "screen")
                    screen.text = program.name + " " + c.text
        else:
            print( "Warning: {} doesn't provide example text".format (program.name)  )
    else:
        print( "Warning: {} doesn't provide an example".format (program.name)  )

    section.append(get_bridgehead("Author(s):"))
    section.append(get_text_node_simple("para", program.author))
    
    return section 
示例#2
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
示例#3
0
def get_program(program):
    section = make_section_root_node("section", program.name)
    section.append(get_bridgehead("Sysnopis:"))
    section.append(get_synopsis(program))
    section.append(get_bridgehead("Description:"))
    node = etree.Element('para', role='description')
    get_text_node_with_doi_links(node, program.description)
    section.append(node)
    section.append(get_bridgehead("Options:"))

    for g in program.option_groups:
        if len(g.name) > 0:
            section.append(get_bridgehead(g.name))

        if len(g.options) > 0:
            varlist = etree.Element("variablelist", spacing="compact")
            for o in g.options:
                varlist.append(get_option_descr(o))
            section.append(varlist)

    if not program.Example is None:
        if not program.Example.text is None:
            section.append(get_bridgehead("Example:"))
            section.append(get_text_node_simple("para", program.Example.text))
            for c in program.Example.code:
                if not c.text is None:
                    screen = etree.SubElement(section, "screen")
                    screen.text = program.name + " " + c.text
        else:
            print("Warning: {} doesn't provide example text".format(
                program.name))
    else:
        print("Warning: {} doesn't provide an example".format(program.name))

    section.append(get_bridgehead("Author(s):"))
    section.append(get_text_node_simple("para", program.author))

    return section
示例#4
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