Module:head: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 31: Line 31:
if data.head then
if data.head then
head = data.head
head = data.head
head = mw.ustring.gsub(head, "%*([^%*:]+):([^%*:]+)%*", "[[%2#" .. data.language.name .. "|%1]]")
if mw.ustring.match(head, "%*[^%*%[%]]*%[[^%*%]]+%][^%*]*%*") then
head = mw.ustring.gsub(head, "%*([^%*]+)%*", "[[%1#" .. data.language.name .. "|%1]]")
for linker in mw.ustring.gmatch(head, "%*([^%*%[%]]*%[[^%*%[%]]+%][^%*]*)%*") do
local formatted = linker .. ":" .. mw.ustring.gsub(linker, "%[[^%*%[%]]+%]", "") -- turn word[s] into words:word
head = mw.ustring.gsub(head, "%*" .. linker .. "%*", "*" .. formatted .. "*")
end
end
head = mw.ustring.gsub(head, "%*([^%*:]+):([^%*:]+)%*", "[[%2#" .. data.language.name .. "|%1]]") -- *word:link*
head = mw.ustring.gsub(head, "%*([^%*]+)%*", "[[%1#" .. data.language.name .. "|%1]]") -- *word*
elseif mw.ustring.find(head, " ") then
elseif mw.ustring.find(head, " ") then
local pieces = {}
local pieces = {}