第1行: |
第1行: |
| local PageName = require("Module:PageName") | | local PageName = require("Module:PageName") |
− | p = {} | + | local p = {} |
| | | |
| | | |
第6行: |
第6行: |
| local noMaintainerWarning = "{{无维护者警告}}" | | local noMaintainerWarning = "{{无维护者警告}}" |
| | | |
− | function p.display_title(type_flag, group_name, page_name) | + | function p.display_title(frame) |
| + | local pagename = mw.title.getCurrentTitle().text |
| local node = mw.html.create(nil) | | local node = mw.html.create(nil) |
| + | local type_flag, group_name, page_name |
| + | type_flag, group_name, page_name = PageName.parse(pagename) |
| if type_flag then | | if type_flag then |
− | local type_name = PageName.type_name(type_flag)
| |
| if page_name then | | if page_name then |
| local base, sub | | local base, sub |
第15行: |
第17行: |
| if base then | | if base then |
| node:wikitext(sub) | | node:wikitext(sub) |
− | node:tag("span"):addClass("ifw-basepagename"):wikitext("("..type_name.."-"..group_name..":"..base..")") | + | node:tag("span"):addClass("ifw-basepagename"):wikitext(" ("..group_name..":"..base..")") |
| elseif page_name then | | elseif page_name then |
| node:wikitext(page_name) | | node:wikitext(page_name) |
− | node:tag("span"):addClass("ifw-basepagename"):wikitext("("..type_name.."-"..group_name..")") | + | node:tag("span"):addClass("ifw-basepagename"):wikitext(" ("..group_name..")") |
| end | | end |
| else | | else |
| node:wikitext(group_name) | | node:wikitext(group_name) |
− | node:tag("span"):addClass("ifw-basepagename"):wikitext("("..type_name..")") | + | local type_name = PageName.type_name(type_flag) |
| + | node:tag("span"):addClass("ifw-basepagename"):wikitext(" ("..type_name..")") |
| end | | end |
| else | | else |
第29行: |
第32行: |
| if base then | | if base then |
| node:wikitext(sub) | | node:wikitext(sub) |
− | node:tag("span"):addClass("ifw-basepagename"):wikitext("("..base..")") | + | node:tag("span"):addClass("ifw-basepagename"):wikitext(" ("..base..")") |
| else | | else |
| local type_name = PageName.type_name(page_name) | | local type_name = PageName.type_name(page_name) |
第40行: |
第43行: |
| end | | end |
| local code = node:done() | | local code = node:done() |
− | return { title = 'DISPLAYTITLE', args = { code } } | + | return code |
| end | | end |
| | | |
第72行: |
第75行: |
| local type_flag, group_name, page_name | | local type_flag, group_name, page_name |
| type_flag, group_name, page_name = PageName.parse(pagename) | | type_flag, group_name, page_name = PageName.parse(pagename) |
− | local title = frame:expandTemplate(p.display_title(type_flag, group_name, page_name))
| |
| mw.smw.set({['设定标题']=pagename}) | | mw.smw.set({['设定标题']=pagename}) |
| local categorize = frame:expandTemplate(p.categorize(type_flag, group_name, page_name)) | | local categorize = frame:expandTemplate(p.categorize(type_flag, group_name, page_name)) |
− | return title .. categorize | + | return categorize |
| end | | end |
| | | |
| return p | | return p |