def render_apiarg_table(r, apiargs): table = TableData() header = [apiargs.field_type()] if apiargs.has_type() is True: header.append('Type') header.append('Description') num_columns = len(header) table.add_header(header) if num_columns == 2: widths = [20, 80] for entry in apiargs.ordered_content(): table.add_row([ RstCloth.pre(entry.name), fill(string=entry.description, first=0, hanging=3, wrap=False) ]) elif num_columns == 3: widths = [20, 20, 80] for entry in apiargs.ordered_content(): table.add_row([ RstCloth.pre(entry.name), entry.type_for_table_output(), fill(string=entry.description, first=0, hanging=3, wrap=False) ]) r.content(TableBuilder(ListTable(table, widths=widths)).output, indent=3)
def render_apiarg_table(r, apiargs): table = TableData() header = [apiargs.field_type()] if apiargs.has_type() is True: header.append('Type') header.append('Description') num_columns = len(header) table.add_header(header) if num_columns == 2: widths = [20, 80] for entry in apiargs.ordered_content(): table.add_row([RstCloth.pre(entry.name), fill(string=entry.description, first=0, hanging=3, wrap=False)]) elif num_columns == 3: widths = [20, 20, 80] for entry in apiargs.ordered_content(): table.add_row([RstCloth.pre(entry.name), entry.type_for_table_output(), fill(string=entry.description, first=0, hanging=3, wrap=False)]) r.content(TableBuilder(ListTable(table, widths=widths)).output, indent=3)
def generate_param_fields(param): _name = [ param['field']['type'] ] if ParamTable.has_type(param): _name.append(process_type_cell(param['type'], 'field')) if param['name'] is not None: _name.append(param['name']) description = param['description'] if isinstance( param['description'], list): field_content = fill('\n'.join(param['description']), 0, 6, False) else: field_content = fill(param['description'], 0, 6, False) return ' '.join(_name), field_content
def generate_param_fields(param): _name = [param['field']['type']] if ParamTable.has_type(param): _name.append(process_type_cell(param['type'], 'field')) if param['name'] is not None: _name.append(param['name']) description = param['description'] if isinstance(param['description'], list): field_content = fill('\n'.join(param['description']), 0, 6, False) else: field_content = fill(param['description'], 0, 6, False) return ' '.join(_name), field_content
def process_description(content, optional=False): if isinstance(content, list): if not content[11:] == 'Optional. ' and optional is True: content[0] = 'Optional.\n' + content[0] return content else: if not content[11:] == 'Optional. ' and optional is True: o = 'Optional. ' else: o = '' return fill(o + content, hanging=3, wrap=False)
def render_apiarg_fields(r, apiargs): for content in apiargs.ordered_content(): field_name = [content.arg_name] if content.type != '': field_name.append(', '.join(content.type)) field_name.append(content.name) field_content = fill(string=content.description, first=0, hanging=6, wrap=False) r.field(name=' '.join(field_name), value=field_content, indent=3, wrap=False) r.newline()