Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:EditAtWikidata

Permanently protected module
From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
Thismodule is rated asready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned onhelp pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed throughsandbox testing rather than repeated trial-and-error editing.
Page protectedThis module is currentlyprotected from editing.
See theprotection policy andprotection log for more details. Please discuss any changes on thetalk page; you maysubmit an edit request to ask anadministrator to make an edit if it isuncontroversial or supported byconsensus. You may alsorequest that this page be unprotected.
WarningThis Lua module is used onapproximately 2,130,000 pages, or roughly 3% of all pages.
To avoid major disruption and server load, any changes should be tested in the module's/sandbox or/testcases subpages, or in your ownmodule sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on thetalk page before implementing them.
Related pages

Module to display an icon with a tooltip such as "Edit this at Wikidata"

  • Icon will be linked to the Wikidata entry for the article where this is placed.
  • This message is only displayed if a local_parameter is not supplied, i.e. when called from a template, it can be coded not to display the message when a local parameter is in use, preventing the value form Wikidata being fetched.
  • The qid of a Wikidata entry can optionally be supplied for testing outside the article.

Usage

To always display the icon:

  • {{#invoke:EditAtWikidata|showMessage}}
Edit this at Wikidata

To display the icon depending on a local parameter not existing:

  • {{#invoke:EditAtWikidata|showMessage|local_parameter}}

To test the functionality outside of an article:

  • {{#invoke:EditAtWikidata|showMessage|qid=<ArticleID>|local_parameter}}

To make the link point to the given property at the Wikidata entry:

  • {{#invoke:EditAtWikidata|showMessage|pid=<PropertyID>|local_parameter}}

See also

The abovedocumentation istranscluded fromModule:EditAtWikidata/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) andtestcases(edit |run) pages.
Subpages of this module.

-- Module to display an icon with a tooltip such as "Edit this at Wikidata".-- Icon is linked to the Wikidata entry for the article where this is placed.-- This message is only displayed if a local_parameter is not supplied-- i.e. when called from a template, it can be coded not to display the message.-- The qid of a Wikidata entry can optionally be supplied for testing outside the article.-- Usage:-- {{#invoke:EditAtWikidata|showMessage|local_parameter}}-- {{#invoke:EditAtWikidata|showMessage|qid=<ArticleID>|local_parameter}}localp={}locali18n={["message"]="Edit this at Wikidata"}localfunctiontrimToNil(text)-- Return trimmed non-empty text, or nil.iftype(text)=='string'thenreturntext:match('(%S.-)%s*$')endendfunctionp._showMessage(args)locallocal_parm=trimToNil(args[1])iflocal_parmthenreturn""end-- Parameter qid=x specifies the Wikidata ID for the article.-- This is not normally used except for testing outside the article.localqid=trimToNil(args.qid)ormw.wikibase.getEntityIdForCurrentPage()ifqidandmw.wikibase.entityExists(qid)then-- Parameter pid=x uses x as an anchor in the link to the Wikidata entry.localanchor=trimToNil(args.pid)-- Parameter nbsp replaces the leading space with &nbsp;localspace=trimToNil(args.nbsp)and"&nbsp;"or" "returnspace.."[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px".."|alt="..i18n.message.."|link=https://www.wikidata.org/wiki/"..qid..(anchorand("#"..anchor)or"").."|class=noprint".."|"..i18n.message.."]]"endreturn""endfunctionp.showMessage(frame)returnp._showMessage(frame.args)endreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:EditAtWikidata&oldid=1316838665"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp