编辑“︁
Module:Wikisource further reading
”︁
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
local p = {}; out="" function p.getCommonsInfo(commonsType) commonsType = commonsType or "withParentheses" local id=mw.wikibase.getEntityIdForCurrentPage() ---If there is a interwiki link for Wikimedia Commons, show it. local commonsPage=mw.wikibase.getEntity( id )["sitelinks"]["commonswiki"] P373=mw.wikibase.getBestStatements( id , "P373")[1] if( commonsPage ~= nil ) then if( commonsType == "withoutParentheses") then commonsTitle=commonsPage["title"] out=out.."[[File:Commons-logo.svg|16x16px|class=noviewer|alt=|link=|维基共享资源]] 在[[维基共享资源]]'''[[commons:"..commonsTitle.."|阅览影像]]'''" ---Wikimedia Commons category. local P373=mw.wikibase.getBestStatements( id , "P373")[1] if( P373 and P373.mainsnak.datavalue and ("Category:"..P373.mainsnak.datavalue.value~=commonsTitle)) then out=out.."、[[commons:Category:"..P373.mainsnak.datavalue.value.."|'''分类''']]" end else commonsTitle=commonsPage["title"] out=out.."([[File:Commons-logo.svg|16x16px|class=noviewer|alt=|link=|维基共享资源]] 在[[维基共享资源]]'''[[commons:"..commonsTitle.."|阅览影像]]'''" ---Wikimedia Commons category. if( P373 and P373.mainsnak.datavalue and ("Category:"..P373.mainsnak.datavalue.value~=commonsTitle)) then out=out.."、[[commons:Category:"..P373.mainsnak.datavalue.value.."|'''分类''']]" end out=out..")" end elseif ( P373 and P373.mainsnak.datavalue) then if( commonsType == "withoutParentheses") then out=out.."[[File:Commons-logo.svg|16x16px|class=noviewer|alt=|link=|维基共享资源]] 在[[维基共享资源]]'''[[commons:Category:"..P373.mainsnak.datavalue.value.."|阅览影像]]'''" else out=out.."([[File:Commons-logo.svg|16x16px|class=noviewer|alt=|link=|维基共享资源]] 在[[维基共享资源]]'''[[commons:Category:"..P373.mainsnak.datavalue.value.."|阅览影像]]''')" end end return out; end function p.getWikisourceInfo() local id=mw.wikibase.getEntityIdForCurrentPage() local commonsNotShown=true local pageName=mw.wikibase.getLabel(id,"zh-hant") local out='<span class="mw-editsection-like plainlinks" style="float: right;"><span class="mw-editsection-bracket">[</span>[[wikidata:'..id..'|<span class="nomobile">在维基数据</span>编<span class="nomobile">辑</span>]]<span class="mw-editsection-bracket">]</span></span>' local wikisourcePage=mw.wikibase.getEntity( id )["sitelinks"]["zhwikisource"] --If there is a interwiki link for Wikisource, show it. if( wikisourcePage ~= nil ) then title=wikisourcePage["title"] if( string.match(title, "Author:") ) then out=out.."\n: [[File:Wikisource-logo.svg|16x16px|class=noviewer|alt=|link=|维基文库]] 在[[维基文库]]'''[[s:"..title.."|阅读此作者作品]]'''" else out=out.."\n: [[File:Wikisource-logo.svg|16x16px|class=noviewer|alt=|link=|维基文库]] 在[[维基文库]]'''[[s:"..title.."|阅读本作品原文]]'''" end out=out..p.getCommonsInfo() commonsNotShown=false end local claims=mw.wikibase.getEntity( id )["claims"] --If there are versions (P747) with a Wikisource link, show them. if( claims ~= nil and claims["P747"] ~= nil ) then P747=claims["P747"] for i, data in ipairs(P747) do if( data["qualifiers"]~= nil and data["qualifiers"]["P805"]~= nil) then local wikisourceBook=data["qualifiers"]["P805"] local wikisourceId=wikisourceBook[1]["datavalue"]["value"]["id"] local ws=mw.wikibase.getEntity( wikisourceId )["sitelinks"] if( ws~=nil and ws["zhwikisource"]~=nil ) then local zhws=ws["zhwikisource"] local wikisourcePageTitle=zhws["title"] local wikisourcePageName=mw.wikibase.getLabel( wikisourceId ) or wikisourcePageTitle if( data["qualifiers"]["P958"]~= nil and data["qualifiers"]["P958"][1]~= nil ) then wikisourceSection="#"..data["qualifiers"]["P958"][1]["datavalue"]["value"] else wikisourceSection="#"..pageName end out=out.."\n: [[File:Wikisource-logo.svg|16x16px|class=noviewer|alt=维基文库中的相关文本:|link=|维基文库]] 《[[s:"..wikisourcePageTitle..wikisourceSection.."|"..wikisourcePageTitle.."]]》" if commonsNotShown then out=out..p.getCommonsInfo() commonsNotShown=false end end else local wikisourceId =data["mainsnak"]["datavalue"]["value"]["id"] local ws=mw.wikibase.getEntity( wikisourceId )["sitelinks"] if( ws~=nil and ws["zhwikisource"]~=nil ) then local wikisourcePageTitle=ws["zhwikisource"]["title"] local wikisourcePageName=mw.wikibase.getLabel( wikisourceId ) or wikisourcePageTitle out=out.."\n: [[File:Wikisource-logo.svg|16x16px|class=noviewer|alt=维基文库中的相关文本:|link=|维基文库]] 《[[s:"..wikisourcePageTitle.."|"..wikisourcePageTitle.."]]》" if commonsNotShown then out=out..p.getCommonsInfo() commonsNotShown=false end local zhWikiLink=mw.wikibase.getEntity( wikisourceId )["sitelinks"]["zhwiki"] if( zhWikiLink~=nil ) then out=out.."([["..zhWikiLink["title"].."|介绍]])" end end end end end --If there are described by source (P1343) with a Wikisource link, show them. if( claims ~= nil and claims["P1343"] ~= nil ) then P1343=claims["P1343"] for i, data in ipairs(P1343) do if( data["qualifiers"]~= nil and data["qualifiers"]["P805"]~= nil) then local wikisourceBook=data["qualifiers"]["P805"] local bookId=data["mainsnak"]["datavalue"]["value"]["id"] local bookName=mw.wikibase.getLabel( bookId ) local bookAuthor=mw.wikibase.getBestStatements(bookId, "P50") local wikisourceId=wikisourceBook[1]["datavalue"]["value"]["id"] local ws=mw.wikibase.getEntity( wikisourceId )["sitelinks"] if( ws~=nil and ws["zhwikisource"]~=nil ) then local zhws=ws["zhwikisource"] local wikisourcePageTitle=zhws["title"] local wikisourcePageName=mw.wikibase.getLabel( wikisourceId ) or wikisourcePageTitle if( data["qualifiers"]["P958"]~= nil and data["qualifiers"]["P958"][1]~= nil ) then wikisourceSection="#"..data["qualifiers"]["P958"][1]["datavalue"]["value"] else wikisourceSection="#"..pageName end out=out.."\n: [[File:Wikisource-logo.svg|16x16px|class=noviewer|alt=维基文库中的相关文本:|link=|维基文库]] 《[[s:"..wikisourcePageTitle..wikisourceSection.."|"..wikisourcePageName.."]]》" out=out..",出自" if( bookAuthor[1]~=nil ) then if bookAuthor[1]['mainsnak']['snaktype'] == 'value' then local bookAuthorId=bookAuthor[1]['mainsnak']['datavalue']['value']["id"] local bookAuthorName=mw.wikibase.getLabel( bookAuthorId ) local bookAuthorLink=mw.wikibase.getEntity( bookAuthorId )["sitelinks"]["zhwiki"] if( bookAuthorLink~=nil ) then out=out.."[["..bookAuthorLink["title"].."|"..bookAuthorName.."]]" else out=out..bookAuthorName end end end local zhWikiLink=mw.wikibase.getEntity( bookId )["sitelinks"]["zhwiki"] if( zhWikiLink~=nil ) then out=out.."《[["..zhWikiLink["title"].."|"..bookName.."]]》" else out=out.."《"..bookName.."》" end end else local wikisourceId =data["mainsnak"]["datavalue"]["value"]["id"] local ws=mw.wikibase.getEntity( wikisourceId )["sitelinks"] if( ws~=nil and ws["zhwikisource"]~=nil ) then local wikisourcePageTitle=ws["zhwikisource"]["title"] local wikisourcePageName=mw.wikibase.getLabel( wikisourceId ) or wikisourcePageTitle out=out.."\n: [[File:Wikisource-logo.svg|16x16px|class=noviewer|alt=维基文库中的相关文本:|link=|维基文库]] 《[[s:"..wikisourcePageTitle.."|"..wikisourcePageName.."]]》" end end end end --If there is no Wikisource link yet and P31 is human (Q5), show commons link. if commonsNotShown then P31=mw.wikibase.getBestStatements(id , "P31")[1] if(P31 ~= nil )then if(P31.mainsnak.datavalue.value.id=="Q5")then out=out.."\n: "..p.getCommonsInfo("withoutParentheses") end end end return out end return p;
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息