Difference between revisions of "CreateHelpPageTest"
Jump to navigation
Jump to search
Tim Holzheim (talk | contribs) (Created page with "=Sourcecode= {{Sourcecode |id=CreateHelpPageTest |lang=python |since=2021/02/05 |text=rows=context["rows"] for row in rows: help_template = 'File:Help_Icon.png|ri...") |
Tim Holzheim (talk | contribs) |
||
Line 7: | Line 7: | ||
|text=rows=context["rows"] | |text=rows=context["rows"] | ||
for row in rows: | for row in rows: | ||
− | help_template = '[[File:Help_Icon.png|right]]' \ | + | help_template = '[[File:Help_Icon.png|right]]\n' \ |
− | '== Help for {{ name }} ==' \ | + | '== Help for {{ name }} ==\n' \ |
'{% raw %}{{{% endraw %}#ask: [[Topic name::{{ name }}]]' \ | '{% raw %}{{{% endraw %}#ask: [[Topic name::{{ name }}]]' \ | ||
'|mainlabel=-' \ | '|mainlabel=-' \ | ||
Line 16: | Line 16: | ||
'|?Topic pluralName = pluralName' \ | '|?Topic pluralName = pluralName' \ | ||
'|?Topic documentation = documentation' \ | '|?Topic documentation = documentation' \ | ||
− | '{% raw %}}}{% endraw %}' \ | + | '{% raw %}}}{% endraw %}\n' \ |
− | '=== Documentation ===' \ | + | '=== Documentation ===\n' \ |
− | '{{ documentation }}' \ | + | '{{ documentation }}\n' \ |
− | '=== Example {{ pluralName }} ===' \ | + | '=== Example {{ pluralName }} ===\n' \ |
− | '{% raw %}{{{% endraw %}#ask: [[Concept:{{ name }}]]{% raw %}}}{% endraw %}' \ | + | '{% raw %}{{{% endraw %}#ask: [[Concept:{{ name }}]]{% raw %}}}{% endraw %}\n' \ |
− | '=== Properties ===' \ | + | '=== Properties ===\n' \ |
'{% raw %}{{{% endraw %}#ask: [[Concept:Property]][[Property topic::Concept: {{ name }} ]]' \ | '{% raw %}{{{% endraw %}#ask: [[Concept:Property]][[Property topic::Concept: {{ name }} ]]' \ | ||
'| ?Property documentation = documentation' \ | '| ?Property documentation = documentation' \ | ||
Line 31: | Line 31: | ||
'| ?Property uploadable = uploadable' \ | '| ?Property uploadable = uploadable' \ | ||
'|format=table' \ | '|format=table' \ | ||
− | '{% raw %}}}{% endraw %}' \ | + | '{% raw %}}}{% endraw %}\n' \ |
− | '{{ uml }}' \ | + | '{{ uml }}\n' \ |
− | '{{ seealso }}' \ | + | '{{ seealso }}\n' \ |
'[[Category:{{ name }}]]' | '[[Category:{{ name }}]]' | ||
from jinja2 import Template | from jinja2 import Template | ||
Line 46: | Line 46: | ||
|storemode=property | |storemode=property | ||
}} | }} | ||
+ | |||
=Freitext= | =Freitext= |
Revision as of 19:01, 7 February 2021
Sourcecode
Sourcecode | |
---|---|
id | CreateHelpPageTest |
lang | python |
author | |
since | 2021/02/05 |
test | rows=context["rows"]
for row in rows:
help_template = '[[File:Help_Icon.png|right]]\n' \
'== Help for [[:Template:Name]] ==\n' \
'{% raw %}mainlabel=-' \
'{% endraw %}\n' \
'=== Documentation ===\n' \
'[[:Template:Documentation]]\n' \
'=== Example [[:Template:PluralName]] ===\n' \
'{% raw %}{{{% endraw %}#ask: [[Concept:[[:Template:Name]]]]{% raw %}}}{% endraw %}\n' \
'=== Properties ===\n' \
'{% raw %} ?Property documentation = documentation' \
'{% endraw %}\n' \
'[[:Template:Uml]]\n' \
'[[:Template:Seealso]]\n' \
'[[Category:[[:Template:Name]]]]'
from jinja2 import Template
template = Template(help_template)
page_content = template.render(name=row['name'],
documentation=row['documentation'],
pluralName=row['pluralName'],
uml=row['uml'] if row['uml'] else "",
seealso=row['seealso'] if row['seealso'] else "")
page = context['wikiclient'].getPage(f"Help:{row['name']}")
page.edit(page_content, "Created for test purposes by lambdaactions")
|
url |