Template talk:Test-case-query: Difference between revisions
Jump to navigation
Jump to search
(...) |
m (brackets that are not math) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Here we are hacking data we get back from SMW : it is returning the name of the test in question as a property, with standard format |
|||
{{add-test-result|testname={{#sub:[[hello]]|{{#expr:{{#len:[[hello]]}}-1/2}} |-2}} }} |
|||
[[Property name|Property name]] |
|||
So we use the string functions provided by Extension:StringFunctions to extract the raw property name: |
|||
# find the length of the property-string S |
|||
# if the property name string is P, <math>len(S) = 2len(P) + 5</math>. so we extract the substring (len(P)+4, -2) to get P |
|||
# in the above, since we don't yet know P, we write this as <math>(len(S) + 3)/2</math> [ <math>= (2len(P) + 8)/2 = len(P) + 4</math> ] |
|||
Hopefully you don't have to try this at home. If you do, see [http://semantic-mediawiki.org/wiki/Help:Inline_queries#Using_templates_for_custom_formatting] and [http://www.mediawiki.org/wiki/Extension:StringFunctions]. |
|||
--[[User:Sj|Sj]] [[User talk:Sj|<font style="color:#f70; font-size:70%">talk</font>]] 06:10, 5 September 2008 (UTC) |
Latest revision as of 06:14, 5 September 2008
Here we are hacking data we get back from SMW : it is returning the name of the test in question as a property, with standard format
Property name
So we use the string functions provided by Extension:StringFunctions to extract the raw property name:
- find the length of the property-string S
- if the property name string is P, <math>len(S) = 2len(P) + 5</math>. so we extract the substring (len(P)+4, -2) to get P
- in the above, since we don't yet know P, we write this as <math>(len(S) + 3)/2</math> [ <math>= (2len(P) + 8)/2 = len(P) + 4</math> ]
Hopefully you don't have to try this at home. If you do, see [1] and [2]. --Sj talk 06:10, 5 September 2008 (UTC)