Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Wikibase-navigation
Create a new Item
Create a new Property
Query Service
Item by title
wikibase
Search
Search
English
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Authors
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
In other projects
Appearance
move to sidebar
hide
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!
local p = {} function p.list(frame) -- Get the Wikibase entity for the current page local entity = mw.wikibase.getEntity() if not entity then return "No Wikibase entity found for this page." end -- Access claims for P2 ("has authors") local claims = entity.claims or {} local p2Claims = claims.P2 or {} local authors = {} -- Loop through each author claim for _, claim in ipairs(p2Claims) do local value = claim.mainsnak.datavalue if value and value.type == "wikibase-entityid" then local itemId = value.value.id -- Get label and sitelink for the author local label = mw.wikibase.getLabel(itemId) or itemId local sitelink = mw.wikibase.getSitelink(itemId) -- Get the author's entity to fetch P5 local authorEntity = mw.wikibase.getEntity(itemId) local p5Value = "" if authorEntity and authorEntity.claims and authorEntity.claims.P5 then -- Assume P5 is a string property; take the first value local p5Claim = authorEntity.claims.P5[1] if p5Claim and p5Claim.mainsnak.datavalue then p5Value = p5Claim.mainsnak.datavalue.value or "" end end -- Format: link to author, with P5 in parentheses if available local display = label if p5Value ~= "" then display = display .. " (" .. p5Value .. ")" end if sitelink then table.insert(authors, "[[" .. sitelink .. "|" .. display .. "]]") else table.insert(authors, display) end end end if #authors == 0 then return "No authors found." end -- Return as comma-separated list return table.concat(authors, ", ") end return p
Summary:
Please note that all contributions to wikibase may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
Wikibase:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:Authors/doc
(
edit
)
Search
Search
Editing
Module:Authors
Add languages
Add topic