« Take Snapshot » : différence entre les versions
De Semantic MediaWiki - Sandbox
(keep the links) |
|||
(Une version intermédiaire par le même utilisateur non affichée) | |||
Ligne 1 : | Ligne 1 : | ||
To take a 'snapshot' of the results of an ask query, use | To take a 'snapshot' of the results of an ask query, you can use [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#Substitution parser function substitution.] | ||
For example: | For example, the following statement: | ||
<nowiki>{{safesubst:#ask: [[:+]] | <nowiki>{{safesubst:#ask: [[:+]] | ||
|?Creation date | |?Creation date | ||
Ligne 9 : | Ligne 9 : | ||
}}</nowiki> | }}</nowiki> | ||
If entered on an page, | If entered on an page, would ''substitute'' the results/output (writing the information to the page) instead of leaving an in-line query behind. | ||
==Output== | ==Output== | ||
Ligne 16 : | Ligne 16 : | ||
==Formatting== | ==Formatting== | ||
Notice the output is very raw (not the clean wiki-markup you might have been expecting). To get around this, you can use the template format which will give you [https://www.mediawiki.org/wiki/Help:Substitution additional control over what is being substituted] (not to mention, control over how 'deep' of a substitution you want to do). | |||
<nowiki>{{safesubst:#ask: [[:+]] | <nowiki>{{safesubst:#ask: [[:+]] |
Dernière version du 8 août 2019 à 20:51
To take a 'snapshot' of the results of an ask query, you can use parser function substitution.
For example, the following statement:
{{safesubst:#ask: [[:+]] |?Creation date |?Last editor is |limit=5 |format=ul }}
If entered on an page, would substitute the results/output (writing the information to the page) instead of leaving an in-line query behind.
Output
- [[::smw-border:|:smw-border:]]
- "Just a Test, nothing less, nothing more" by Noe, Jane; Doe, John (Creation date"Creation date" is a predefined property that corresponds to the date of the first revision of a subject and is provided by Semantic MediaWiki.: 19 juillet 2017 15:46:13, Last editor is"Last editor is" is a predefined property that contains the page name of the user who created the last revision and is provided by Semantic MediaWiki.: HermannSchwaerzler)
- "Just a Test, nothing less, nothing more" by Noe, Jane; Doe, John
- "Just a Test, nothing less, nothing more" by Noe, Jane; Doe, John
- "Next Test - no mapping property" by Doe, John; Noe, Jane (Creation date"Creation date" is a predefined property that corresponds to the date of the first revision of a subject and is provided by Semantic MediaWiki.: 20 juillet 2017 06:59:18, Last editor is"Last editor is" is a predefined property that contains the page name of the user who created the last revision and is provided by Semantic MediaWiki.: HermannSchwaerzler)
Formatting
Notice the output is very raw (not the clean wiki-markup you might have been expecting). To get around this, you can use the template format which will give you additional control over what is being substituted (not to mention, control over how 'deep' of a substitution you want to do).
{{safesubst:#ask: [[:+]] |?Creation date |?Last editor is |limit=5 |format=template |template=safesubst:Snapshot }}
Template Output
- [[::smw-border:|:smw-border:]]
- "Just a Test, nothing less, nothing more" by Noe, Jane; Doe, John19 juillet 2017 15:46:13HermannSchwaerzler
- "Just a Test, nothing less, nothing more" by Noe, Jane; Doe, John
- "Just a Test, nothing less, nothing more" by Noe, Jane; Doe, John
- "Next Test - no mapping property" by Doe, John; Noe, Jane20 juillet 2017 06:59:18HermannSchwaerzler... further results