本文整理汇总了Python中utils.rstcloth.rstcloth.RstCloth.field方法的典型用法代码示例。如果您正苦于以下问题:Python RstCloth.field方法的具体用法?Python RstCloth.field怎么用?Python RstCloth.field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.rstcloth.rstcloth.RstCloth
的用法示例。
在下文中一共展示了RstCloth.field方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_params
# 需要导入模块: from utils.rstcloth.rstcloth import RstCloth [as 别名]
# 或者: from utils.rstcloth.rstcloth.RstCloth import field [as 别名]
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