Difference between revisions of "CreateHelpPageTest"

From OPENRESEARCH th copy Wiki
Jump to navigation Jump to search
(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...")
 
(edited by wikiedit)
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
{{Sourcecode
 
{{Sourcecode
 
|id=CreateHelpPageTest
 
|id=CreateHelpPageTest
|lang=python
+
|lang=jinja
 
|since=2021/02/05
 
|since=2021/02/05
|text=rows=context["rows"]
+
|author= Tim Holzheim
for row in rows:
+
|text=
        help_template = '[[File:Help_Icon.png|right]]' \
+
<pre>
                        '== Help for {{ name }} ==' \
+
{% set pagetitle = ""%}
                        '{% raw %}{{{% endraw %}#ask: [[Topic name::{{ name }}]]' \
+
{% set pagetitle_prefix = "Help:"%}
                        '|mainlabel=-' \
+
[[File:Help_Icon.png|right]]
                        '|?Topic icon = icon' \
+
== Help for {{ row.name }} ==
                        '|? = Topic' \
+
{% raw %}{{{% endraw %}#ask: [[Topic name::{{ row.name }}]]
                        '|?Topic name = name' \
+
|mainlabel=-
                        '|?Topic pluralName = pluralName' \
+
|?Topic icon = icon
                        '|?Topic documentation = documentation' \
+
|? = Topic
                        '{% raw %}}}{% endraw %}' \
+
|?Topic name = name
                        '=== Documentation ===' \
+
|?Topic pluralName = pluralName
                        '{{ documentation }}' \
+
|?Topic documentation = documentation
                        '=== Example {{ pluralName }} ===' \
+
{% raw %}}}{% endraw %}
                        '{% raw %}{{{% endraw %}#ask: [[Concept:{{ name }}]]{% raw %}}}{% endraw %}' \
+
=== Documentation ===
                        '=== Properties ===' \
+
{{ row.documentation }}
                        '{% raw %}{{{% endraw %}#ask: [[Concept:Property]][[Property topic::Concept: {{ name }} ]]' \
+
=== Example {{ row.pluralName }} ===
                        '| ?Property documentation = documentation' \
+
{% raw %}{{{% endraw %}#ask: [[Concept:{{ row.name }}]]{% raw %}}}{% endraw %}
                        '| ?Property type = type' \
+
=== Properties ===
                        '| ?Property name = name' \
+
 
                        '| ?Property label = label' \
+
{% raw %} {{ {% endraw %}#ask: [[Concept:Property]][[Property topic::Concept:{{ row.name }}]]
                        '| ?Property allowedValues = allowedValues' \
+
|mainlabel={{ row.name }}
                        '| ?Property mandatory = mandatory' \
+
{% for page in smw.query("[[Concept:Property]][[Property topic::Concept:Property]]|?Property name = name").values() %}
                        '| ?Property uploadable = uploadable' \
+
| ?Property {{ page.name }} = {{ page.name }}
                        '|format=table' \
+
{%endfor%}
                        '{% raw %}}}{% endraw %}' \
+
|order=ascending
                        '{{ uml }}' \
+
| limit={% if row.listlimit %} {{ row.listlimit }} {% else %} 200 {% endif %}
                        '{{ seealso }}' \
+
{% raw %} }} {% endraw %}
                        '[[Category:{{ name }}]]'
+
 
        from jinja2 import Template
+
{{ row.uml }}
        template = Template(help_template)
+
{{ row.seealso }}
        page_content = template.render(name=row['name'],
+
[[Category:{{ row.Topic }}]]
                                      documentation=row['documentation'],
+
</pre>
                                      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")
 
 
|storemode=property
 
|storemode=property
 
}}
 
}}
 +
 
=Freitext=
 
=Freitext=
 +
[[Category:Jinja Template]]

Latest revision as of 19:01, 9 February 2021

Sourcecode

Sourcecode
edit
id  CreateHelpPageTest
lang  jinja
author  Tim Holzheim
since  2021/02/05
test  
'"`UNIQ--pre-00000000-QINU`"'
url  

Freitext