第5行: |
第5行: |
| function renderMaintainers(frame, maintainers, other_creators) | | function renderMaintainers(frame, maintainers, other_creators) |
| local node = mw.html.create(nil) | | local node = mw.html.create(nil) |
− | node:wikitext("创作者: ") | + | local content = "" |
| + | content = content .. "创作者: " |
| for i, m in ipairs(maintainers) do | | for i, m in ipairs(maintainers) do |
− | node:wikitext("[[User:"..m.."|"..m.."]]") | + | content = content .. "[[User:"..m.."|"..m.."]]" |
− | node:wikitext("[[Category:由"..m.."维护的条目]]") | + | content = content .. "[[Category:由"..m.."维护的条目]]" |
− | node:wikitext("[[Category:由"..m.."创作的条目]]") | + | content = content .. "[[Category:由"..m.."创作的条目]]" |
| mw.smw.set({ | | mw.smw.set({ |
| ['Editable by user'] = 'User:'..m | | ['Editable by user'] = 'User:'..m |
第15行: |
第16行: |
| end | | end |
| for i, m in ipairs(other_creators) do | | for i, m in ipairs(other_creators) do |
− | node:wikitext("[[创作者:"..m.."|"..m.."]]") | + | content = content .. "[[创作者:"..m.."|"..m.."]]" |
− | node:wikitext("[[Category:由"..m.."创作的条目]]") | + | content = content .. "[[Category:由"..m.."创作的条目]]" |
| end | | end |
− | local res = node:allDone() | + | local args = {image = 'Copyright.svg', content = content} |
− | return res
| + | return frame:expandTemplate{title = "LiteInfoBox", args = args} |
− | -- local args = {image = 'Copyright.svg', content = res}
| |
− | -- return frame:expandTemplate{title = "LiteInfoBox", args = args} | |
| end | | end |
| | | |
第37行: |
第36行: |
| local root = mw.html.create(nil) | | local root = mw.html.create(nil) |
| local maintainerTemp = renderMaintainers(frame, props["维护者"], props["创作者"]) | | local maintainerTemp = renderMaintainers(frame, props["维护者"], props["创作者"]) |
− | return mw.text.jsonEncode(maintainerTemp) | + | root:wikitext(maintainerTemp) |
− | -- root:wikitext()
| + | if props["维护者"]["仅允许维护者编辑"][1] == "t" then |
− | -- if props["维护者"]["仅允许维护者编辑"][1] == "t" then | + | renderLockedPage(frame) |
− | -- renderLockedPage(frame)
| + | end |
− | -- end | + | return root:done() |
− | -- return root:done() | |
| end | | end |
| | | |
| return p | | return p |