예제 #1
0
def format_extension_parameters(extension, out, width, shift=4):
    out.write('parameters:\n\n')
    param_texts = []
    for param in extension.parameters:
        description = format_paragraph(strip_inlined_text(param.description or ''), width - shift)
        param_text = '{}'.format(param.name)
        if param.mandatory:
            param_text += " (MANDATORY)"
        param_text += '\n{}\n'.format(description)
        param_text += indent('type: {}\n'.format(get_type_name(param.kind)))
        if param.allowed_values:
            param_text += indent('allowed values: {}\n'.format(', '.join(map(str, param.allowed_values))))
        elif param.constraint:
            param_text += indent('constraint: {}\n'.format(get_type_name(param.constraint)))
        if param.default is not None:
            param_text += indent('default: {}\n'.format(param.default))
        param_texts.append(indent(param_text, shift))

    out.write(format_column('\n'.join(param_texts), width))
예제 #2
0
def format_extension_parameters(extension, out, width, shift=4):
    out.write('parameters:\n\n')
    param_texts = []
    for param in extension.parameters:
        description = format_paragraph(
            strip_inlined_text(param.description or ''), width - shift)
        param_text = '{}'.format(param.name)
        if param.mandatory:
            param_text += " (MANDATORY)"
        param_text += '\n{}\n'.format(description)
        param_text += indent('type: {}\n'.format(get_type_name(param.kind)))
        if param.allowed_values:
            param_text += indent('allowed values: {}\n'.format(', '.join(
                map(str, param.allowed_values))))
        elif param.constraint:
            param_text += indent('constraint: {}\n'.format(
                get_type_name(param.constraint)))
        if param.default is not None:
            param_text += indent('default: {}\n'.format(param.default))
        param_texts.append(indent(param_text, shift))

    out.write(format_column('\n'.join(param_texts), width))
예제 #3
0
def format_extension_description(extension, out, width):
    # skip the initial paragraph of multi-paragraph description, as already
    # listed above.
    description = get_description(extension).split('\n\n', 1)[-1]
    out.write('{}\n'.format(format_body(strip_inlined_text(description), width)))
예제 #4
0
def format_extension_summary(extension, out, width):
    out.write('{}\n'.format(format_body(strip_inlined_text(get_summary(extension)), width)))
예제 #5
0
def format_extension_description(extension, out, width):
    # skip the initial paragraph of multi-paragraph description, as already
    # listed above.
    description = get_description(extension).split('\n\n', 1)[-1]
    out.write('{}\n'.format(format_body(strip_inlined_text(description),
                                        width)))
예제 #6
0
def format_extension_summary(extension, out, width):
    out.write('{}\n'.format(
        format_body(strip_inlined_text(get_summary(extension)), width)))