jenkins-bot has submitted this change and it was merged.
Change subject: Update and improve the Lua docs
......................................................................
Update and improve the Lua docs
Explain the mw.wikibase.entity.claimRanks table and
avoid long lines in source tags.
Change-Id: If16030bb0a2be10aa74b974f57da6b88cecf7dfc
---
M docs/lua.wiki
1 file changed, 24 insertions(+), 3 deletions(-)
Approvals:
WikidataJenkins: Verified
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/lua.wiki b/docs/lua.wiki
index adc49e4..d7d3c88 100644
--- a/docs/lua.wiki
+++ b/docs/lua.wiki
@@ -70,12 +70,33 @@
<code>entity:formatPropertyValues( propertyId )</code><br>
<code>entity:formatPropertyValues( propertyId, acceptableRanks )</code><br>
Get the formatted value of the claims with the given property id. Per default
only the best claims will be returned.
-Alternatively a table with acceptable ranks can be given as second parameter.
+Alternatively a table with acceptable ranks can be given as second parameter
(a mapping table with all ranks can be found in
[[#mw.wikibase.entity.claimRanks|<code>mw.wikibase.entity.claimRanks</code>]]).
An example call might look like this:
<source lang="lua">
-entity:formatPropertyValues( 'P12' ) -- Returns a table like: { value =
"Formatted claim value", label = "Label of the Property" }
-entity:formatPropertyValues( 'P42', {
mw.wikibase.entity.claimRanks.RANK_NORMAL } ) -- Returns the normal ranked
claims with the property Id 42 (same format as above)
+-- Return a table like: { value = "Formatted claim value", label = "Label of
the Property" }
+entity:formatPropertyValues( 'P12' )
+
+-- Return the normal ranked claims with the property Id 42 (same format as
above)
+entity:formatPropertyValues( 'P42', {
mw.wikibase.entity.claimRanks.RANK_NORMAL } )
+</source>
+
+=== mw.wikibase.entity.claimRanks ===
+The <code>mw.wikibase.entity.claimRanks</code> table contains a map of all
available claim ranks.
+
+The available ranks are:
+# RANK_TRUTH
+# RANK_PREFERRED
+# RANK_NORMAL
+# RANK_DEPRECATED
+
+This can for example be used like this:
+<source lang="lua">
+-- Return the normal ranked claims with the property id P5
+entity:formatPropertyValues( 'P5', { mw.wikibase.entity.claimRanks.RANK_NORMAL
} )
+
+ -- Return all claims with id P123 (as the table passed contains all possible
claim ranks)
+entity:formatPropertyValues( 'P123', mw.wikibase.entity.claimRanks )
</source>
=== mw.wikibase.entity.create ===
--
To view, visit https://gerrit.wikimedia.org/r/145767
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If16030bb0a2be10aa74b974f57da6b88cecf7dfc
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits