Beispiel #1
0
def loadItems(files):
    items = minidom.NodeList()

    for file in files:
        xml = minidom.parse(file)
        items.extend(xml.getElementsByTagName('item'))

    return items
Beispiel #2
0
def _GenerateContent(namespace, symbols):

    node_list = minidom.NodeList()

    node_list.append(_MakeElement('h1', namespace))

    sorted_symbols = sorted(symbols, key=lambda symbol: symbol.identifier)

    # Constructor
    constructor_symbols = _GetSymbolsOfType(sorted_symbols,
                                            symboltypes.CONSTRUCTOR)

    if constructor_symbols:
        node_list.append(_MakeElement('h2', 'Constructor'))
        for constructor in constructor_symbols:
            _AddSymbolDescription(node_list, constructor)

    # Interface
    interface_symbols = _GetSymbolsOfType(sorted_symbols,
                                          symboltypes.INTERFACE)

    if interface_symbols:
        node_list.append(_MakeElement('h2', 'Interface'))
        for interface in interface_symbols:
            _AddSymbolDescription(node_list, interface)

    instance_methods = filter(
        _IsNotStatic, _GetSymbolsOfType(sorted_symbols, symboltypes.FUNCTION))

    instance_properties = filter(
        _IsNotStatic, _GetSymbolsOfType(sorted_symbols, symboltypes.PROPERTY))

    static_functions = filter(
        _IsStatic, _GetSymbolsOfType(sorted_symbols, symboltypes.FUNCTION))

    public_instance_methods = filter(
        lambda m: flags.GetVisibility(m.comment.flags) == flags.PUBLIC,
        instance_methods)
    if public_instance_methods:
        node_list.append(_MakeElement('h2', 'Public instance method summary'))
        node_list.append(_MakeFunctionSummaryList(public_instance_methods))

    public_static_methods = filter(
        lambda m: flags.GetVisibility(m.comment.flags) == flags.PUBLIC,
        static_functions)
    if static_functions:
        node_list.append(_MakeElement('h2', 'Public static method summary'))
        node_list.append(_MakeFunctionSummaryList(public_static_methods))

    # Enumerations
    enum_symbols = _GetSymbolsOfType(sorted_symbols, symboltypes.ENUM)

    if enum_symbols:
        node_list.append(_MakeElement('h2', 'Enumerations'))
        for enum_symbol in enum_symbols:
            _AddSymbolDescription(node_list, enum_symbol)

    if instance_methods:
        node_list.append(_MakeElement('h2', 'Instance methods'))
        for method in instance_methods:
            _AddFunctionDescription(node_list, method)
            node_list.append(_MakeElement('hr'))

    if instance_properties:
        node_list.append(_MakeElement('h2', 'Instance properties'))
        for property in instance_properties:
            _AddSymbolDescription(node_list, property)
            node_list.append(_MakeElement('hr'))

    if static_functions:
        node_list.append(_MakeElement('h2', 'Static methods'))
        node_list.append(_MakeElement('hr'))
        for function in static_functions:
            _AddFunctionDescription(node_list, function)
            node_list.append(_MakeElement('hr'))

    static_properties = filter(
        _IsStatic, _GetSymbolsOfType(sorted_symbols, symboltypes.PROPERTY))
    if static_properties:
        node_list.append(_MakeElement('h2', 'Static properties'))
        for property in static_properties:
            _AddSymbolDescription(node_list, property)
            node_list.append(_MakeElement('hr'))

    return node_list