Différences entre les versions de « SpecialSymbolsExample »
Balise : Éditeur de wikicode 2017 |
Balise : Éditeur de wikicode 2017 |
||
(5 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 2 : | Ligne 2 : | ||
The problematic symbols are | The problematic symbols are | ||
− | + | <pre> | |
| = { } [ ] < | | = { } [ ] < | ||
− | + | </pre> | |
In various combinations or patterns these mess up the parsing of pages defined by mediawiki templates and with the semantic mediawiki property setting syntax. | In various combinations or patterns these mess up the parsing of pages defined by mediawiki templates and with the semantic mediawiki property setting syntax. | ||
Ligne 10 : | Ligne 10 : | ||
While documentation for escaping `|` is easy to find, documentation for escaping the other special symbols is harder to discover - but can be found here on the [https://en.wikipedia.org/wiki/Help:Metatemplating mediawiki site]. | While documentation for escaping `|` is easy to find, documentation for escaping the other special symbols is harder to discover - but can be found here on the [https://en.wikipedia.org/wiki/Help:Metatemplating mediawiki site]. | ||
− | + | <pre> | |
| {{!}} | | {{!}} | ||
= {{=}} | = {{=}} | ||
Ligne 18 : | Ligne 18 : | ||
] {{!)}} | ] {{!)}} | ||
< {{lessthan}} | < {{lessthan}} | ||
− | + | </pre> | |
However, as on this sandbox site, many of these "escape" templates are not predefined - but they are easy to define as needed. | However, as on this sandbox site, many of these "escape" templates are not predefined - but they are easy to define as needed. | ||
Ligne 24 : | Ligne 24 : | ||
These escapes are used in the defining template: | These escapes are used in the defining template: | ||
− | + | <pre> | |
{{SpecialSymbolsTemplate | {{SpecialSymbolsTemplate | ||
|simple=no special symbols here! | |simple=no special symbols here! | ||
|code={{!}}{{=}}{{(}}{{!(}}{{)}}{{!)}}{{lessthan}} | |code={{!}}{{=}}{{(}}{{!(}}{{)}}{{!)}}{{lessthan}} | ||
− | }} | + | }} |
− | + | </pre> | |
The template can display this value without any further issues or enclose in html tags for display. | The template can display this value without any further issues or enclose in html tags for display. | ||
− | + | <pre> | |
{{{code|}}} | {{{code|}}} | ||
<code>{{{code|}}}</code> | <code>{{{code|}}}</code> | ||
<div class="smwpre">{{{code|}}}<div> | <div class="smwpre">{{{code|}}}<div> | ||
− | + | </pre> | |
− | The automatic property data-type dependent display implemented by semantic mediawiki is not available since the | + | The automatic property data-type dependent display implemented by semantic mediawiki is not available since the <pre>[[Has code::{{{code|}}}]]</pre> technique does not work. |
The template should populate the relevant property using the #set: technique. | The template should populate the relevant property using the #set: technique. | ||
− | + | <pre> | |
{{#set:|Has code={{{code|}}}}} | {{#set:|Has code={{{code|}}}}} | ||
− | + | </pre> | |
− | PageForms does not appear to support the editing of such fields. | + | PageForms does not appear to support the editing of such fields other than by treating them literally. |
{{SpecialSymbolsTemplate | {{SpecialSymbolsTemplate |
Dernière version du 1 novembre 2018 à 21:02
This page shows a partial example of how to use semantic mediawiki via templates when page values contain characters (semantic) mediawiki uses for its template and/or property setting syntax.
The problematic symbols are
| = { } [ ] <
In various combinations or patterns these mess up the parsing of pages defined by mediawiki templates and with the semantic mediawiki property setting syntax.
While documentation for escaping `|` is easy to find, documentation for escaping the other special symbols is harder to discover - but can be found here on the mediawiki site.
| {{!}} = {{=}} { {{(}} } {{)}} [ {{!(}} ] {{!)}} < {{lessthan}}
However, as on this sandbox site, many of these "escape" templates are not predefined - but they are easy to define as needed.
These escapes are used in the defining template:
{{SpecialSymbolsTemplate |simple=no special symbols here! |code={{!}}{{=}}{{(}}{{!(}}{{)}}{{!)}}{{lessthan}} }}
The template can display this value without any further issues or enclose in html tags for display.
{{{code|}}} <code>{{{code|}}}</code> <div class="smwpre">{{{code|}}}<div>
The automatic property data-type dependent display implemented by semantic mediawiki is not available since the
[[Has code::{{{code|}}}]]
technique does not work.
The template should populate the relevant property using the #set: technique.
{{#set:|Has code={{{code|}}}}}
PageForms does not appear to support the editing of such fields other than by treating them literally.
SIMPLE | no special symbols here! |
---|---|
CODE | ={[}]< |