Exemple #1
0
def generate_params(params, fn, conf):
    r = RstCloth()
    basename = os.path.basename(fn)

    params.sort(key=lambda p: p['position'])

    # Begin by generating the table for web output
    r.directive('only', '(html or singlehtml or dirhtml)', block='htm')
    r.newline(block='htm')

    # { filename: { $name: <param> } }
    ext_params = {}

    processed_params = []
    for param in params:
        if 'file' in param:
            pos = param['position']
            if param['file'] not in ext_params:

                fn, ext = populate_external_param(param['file'],
                                                  basename,
                                                  conf.paths.projectroot,
                                                  conf.paths.source)
                ext_params[fn] = ext

            param = ext_params[conf.paths.source + param['file']][param['name']]
            param['position'] = pos

        processed_params.append(param)

    r.content(generate_param_table(processed_params), indent=3, block='html')
    r.newline(block='htm')

    # Then generate old-style param fields for non-web output
    r.directive('only', '(texinfo or latex or epub)', block='tex')
    r.newline(block='tex')

    for param in processed_params:
        key, val = generate_param_fields(param)
        r.field(name=key, value=val, indent=3, wrap=False, block='tex')
        r.newline(block='tex')

    return r
Exemple #2
0
def generate_params(params, fn, conf):
    r = RstCloth()
    basename = os.path.basename(fn)

    params.sort(key=lambda p: p['position'])

    # Begin by generating the table for web output
    r.directive('only', '(html or singlehtml or dirhtml)', block='htm')
    r.newline(block='htm')

    # { filename: { $name: <param> } }
    ext_params = {}

    processed_params = []
    for param in params:
        if 'file' in param:
            pos = param['position']
            if param['file'] not in ext_params:

                fn, ext = populate_external_param(param['file'], basename,
                                                  conf.paths.projectroot,
                                                  conf.paths.source)
                ext_params[fn] = ext

            param = ext_params[conf.paths.source +
                               param['file']][param['name']]
            param['position'] = pos

        processed_params.append(param)

    r.content(generate_param_table(processed_params), indent=3, block='html')
    r.newline(block='htm')

    # Then generate old-style param fields for non-web output
    r.directive('only', '(texinfo or latex or epub)', block='tex')
    r.newline(block='tex')

    for param in processed_params:
        key, val = generate_param_fields(param)
        r.field(name=key, value=val, indent=3, wrap=False, block='tex')
        r.newline(block='tex')

    return r