|
|
Line 8: |
Line 8: |
| local namespace = mw.title.getCurrentTitle().nsText | | local namespace = mw.title.getCurrentTitle().nsText |
| | | |
| if not data.lang or type(data.lang) ~= "table" or not data.lang.getCode then
| |
| error("In data, the first argument to full_headword, data.lang should be a language object.")
| |
| end
| |
| | | |
| if not data.sc then
| |
| data.sc = require("Module:scripts").findBestScript(data.heads and data.heads[1] ~= "" and data.heads[1] or pagename, data.lang)
| |
| else
| |
| -- Track uses of sc parameter
| |
| local best = require("Module:scripts").findBestScript(pagename, data.lang)
| |
| require("Module:debug").track("headword/sc")
| |
|
| |
| if data.sc:getCode() == best:getCode() then
| |
| require("Module:debug").track("headword/sc/redundant")
| |
| require("Module:debug").track("headword/sc/redundant/" .. data.sc:getCode())
| |
| else
| |
| require("Module:debug").track("headword/sc/needed")
| |
| require("Module:debug").track("headword/sc/needed/" .. data.sc:getCode())
| |
| end
| |
| end
| |
| | | |
| local displayTitle | | local displayTitle |
| -- Assumes that the scripts in "toBeTagged" will never occur in the Reconstruction namespace.
| |
| -- Avoid tagging ASCII as Hani even when it is tagged as Hani in the
| |
| -- headword, as in [[check]]. The check for ASCII might need to be expanded
| |
| -- to a check for any Latin characters and whitespace or punctuation.
| |
| if (namespace == "" and data.sc and toBeTagged[data.sc:getCode()] | | if (namespace == "" and data.sc and toBeTagged[data.sc:getCode()] |
| and not pagename:find "^[%z\1-\127]+$") | | and not pagename:find "^[%z\1-\127]+$") |