Template:SmwDictGlosses: Difference between revisions
From Guild of Archivists
BladeLakem (talk | contribs) No edit summary |
BladeLakem (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<includeonly>''{{lc:{{#invoke:String|sub|s={{{1}}}|i={{#expr:{{#invoke:String|find|{{{1}}}|#|plain=true}}+1}}}}}}.'' {{#ifeq: {{#invoke:String|find|{{{2}}}|^|plain=true}} | 0 | {{{2}}} | <ol class="hlist-ordered"><li>{{#invoke:String|replace|{{{2}}}|^|</li><li>}}</li></ol>}} | <includeonly>{{#invoke:Dict D'ni|smw_format_gloss}}</includeonly><noinclude>''{{lc:{{#invoke:String|sub|s={{{1}}}|i={{#expr:{{#invoke:String|find|{{{1}}}|#|plain=true}}+1}}}}}}.'' {{#ifeq: {{#invoke:String|find|{{{2}}}|^|plain=true}} | 0 | {{{2}}} | <ol class="hlist-ordered"><li>{{#invoke:String|replace|{{{2}}}|^|</li><li>}}</li></ol>}} | ||
{{documentation}} | {{documentation}} |
Revision as of 05:10, 28 September 2020
{{{1}}}. {{{2}}}
This template is designed to be used with SMW queries, specifically for queries done on the Dictionary namespace. It's passed to the "template" parameter of an #ask statement and formats the returned subobjects as a part of 'dictionary' style line. Note that the actual word is not returned, or any properties of the page itself - this just aggregates the 'definition' subobjects.
Example:
{{#ask:
[[-Has subobject::Dictionary:shorah]]
| ?Gloss
|format=plainlist
|valuesep=^
|link=none
|template=SmwDictGlosses
|sep=
}}
Result:
- interj 1. hello 2. goodbye n peace
A query such as the above is intended to be used inside another template that provides the full dictionary line
Assumptions
The template assumes:
- that the query is pretty much identical to the one above in terms of options (the lines beginning with |). That is, the only property being returned is Gloss, the values in a property are separated by carats (^), and no link data is being sent through.
- that the dictionary page has its subobjects arranged properly. That is, is using the appropriate part-of-speech templates and that each definition is defined with the {{df}} template.
The above documentation is transcluded from Template:SmwDictGlosses/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |