Editing
Brighter Shores:Style guide/Semantic MediaWiki
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Cheatsheet== ===Defining attributes=== {| class="wikitable" ! Code ! Display ! Function |- | <code><nowiki>[[foo::bar]]</nowiki></code> | [[foo::bar]] | Defines the property "foo" as bar and creates a link to [[bar]] |- | <code><nowiki>[[foo::bar|baz]]</nowiki></code> | [[foo::bar|baz]] | Defines the property "foo" as bar and creates a link to [[bar]] on the text "baz" |- | <code><nowiki>[[foo::bar| ]]</nowiki></code> | [[foo::bar| ]] | Defines the property "foo" as bar and creates no text |- | <code><nowiki>{{#set:foo=bar}}</nowiki></code> | {{#set:foo=bar}} | Defines the property "foo" as bar and displays nothing. Multiple properties can be defined this way. '''Note''': Use {{T|Set}} if defining properties in the content namespaces. |- |<syntaxhighlight lang="lua"> -- setup data table - standard key-value pairs where key is property name and value is property value local data1 = { foo = 'bar', ['Has property2'] = 'value2' } -- set the properties local result1 = mw.smw.set(data1) if result1 == true then -- everything fine else -- error message is in result1.error end -- setup data table - an array of strings, in format 'propname=propvalue' local data2 = { 'foo=bar', 'Has property2=value2' } -- set the properties local result2 = mw.smw.set(data2) if result2 == true then -- everything fine else -- error message is in result2.error end </syntaxhighlight> | | Used in lua modules to set data, similarly to the #set parser function - all methods are equivalent, so use whichever is easier for the module at the time. See [https://github.com/SemanticMediaWiki/SemanticScribunto/blob/master/docs/README.md SemanticScribunto documentation] for more information. |- |<syntaxhighlight lang="lua"> -- setup data table - multiple property values for one property local data3 = { foo = { 'bar', 'baz', 'qok' } } -- set the properties local result3 = mw.smw.set(data3) if result3 == true then -- everything fine else -- error message is in result3.error end </syntaxhighlight> | | As above, but setting multiple values to the same property. |} ===Retrieving attributes with #ask=== {| class="wikitable" ! Code ! Display ! Function |- | <code><nowiki>[[Category:Foo]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#category|Example]] | Finds all pages that are in category "foo" |- | <code><nowiki>?foo</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#?Property|Example]] | Shows the property "foo" of all results |- | <code>limit=X</code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#limit|Example]] | Confines the displayed results to limit X |- | <code>offset=X</code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#offset|Example]] | Begins the search at an offset of X |- | <code><nowiki>[[foo::bar]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:query|Example]] | Finds all pages that contain a property of "foo" that is equal to "bar" |- | <code><nowiki>[[foo::!bar]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:!|Example]] | Finds all pages that contain a property of "foo" that is not equal to "bar" |- | <code><nowiki>[[foo::>X]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:gte|Example]] | Finds all pages that contain a property of "foo" that is greater than or equal to X |- | <code><nowiki>[[foo::>>X]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:gt|Example]] | Finds all pages that contain a property of "foo" that is greater than X |- | <code><nowiki>[[foo::<X]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:lte|Example]] | Finds all pages that contain a property of "foo" that is less than or equal to X |- | <code><nowiki>[[foo::<<X]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:lt|Example]] | Finds all pages that contain a property of "foo" that is less than X |- | <code><nowiki>[[foo::bar||baz]]</nowiki></code> <code><nowiki>[[foo::bar]] OR [[foo::baz]]</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#Property:or|Example]] | Finds all pages that contain a property of "foo" that is "bar" or "baz" |} ====Lua==== For details on fetching information via lua, see [https://github.com/SemanticMediaWiki/SemanticScribunto/blob/master/docs/mw.smw.ask.md#result mw.smw.ask documentation]. ===Retrieving attributes with #show=== {| class="wikitable" ! Code ! Display ! Function |- | <code><nowiki>{{#show:Bar|?foo}}</nowiki></code> '''Note:''' Use <code><nowiki>{{Get|Bar|foo}}</nowiki></code> | [[Brighter Shores:Semantic MediaWiki cheatsheet/examples#show|Example]] | Shows the property "foo" of page [[Bar]] |- |}
Summary:
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Brighter Shores:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Project page
Discussion
British English
Views
Read
Edit source
View history
More
Refresh
Search
Discord
Discord
Navigation
About us
User help
Random page
Recent changes
Gallabast the Ragged
9m
ago
-
Girmrepear
Olider Murray
12m
ago
-
Girmrepear
Rapier
14m
ago
-
Dan
Hugh
17m
ago
-
Girmrepear
Show more...
Brighter Shores
Professions
Factions
Episodes
Premium Pass
Monsters
Quests
Community
Policies
Tools
What links here
Related changes
Special pages
Page information