Module:links: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 18: Line 18:
-- of the same name.
-- of the same name.
local usub = mw.ustring.sub
local usub = mw.ustring.sub
local find = mw.ustring.find


local table_insert = table.insert
local table_insert = table.insert
Line 170: Line 169:
if id then
if id then
link.fragment = require("Module:utilities").make_id(lang, id)
link.fragment = require("Module:utilities").make_id(lang, id)
elseif not find(link.target, "^Appendix:")
elseif not mw.ustring.find(link.target, "^Appendix:")
and not find(link.target, "^Reconstruction:") then
and not mw.ustring.find(link.target, "^Reconstruction:") then
link.fragment = lang:getCanonicalName()
link.fragment = lang:getCanonicalName()
end
end
Line 226: Line 225:
-- then act as if each link begins with *
-- then act as if each link begins with *
local allReconstructed = false
local allReconstructed = false
if find(text, "^*.") then
allReconstructed = true
end


-- Do we have embedded wikilinks?
-- Do we have embedded wikilinks?
if text:find("[[", nil, true) then
if find(text, "[[", nil, true) then
--[=[
--[=[
[[Special:WhatLinksHere/Template:tracking/links/alt-ignored]]
[[Special:WhatLinksHere/Template:tracking/links/alt-ignored]]
Line 247: Line 250:


-- Begins and ends with a wikilink tag
-- Begins and ends with a wikilink tag
if text:find("^%[%[(.+)%]%]$") then
if find(text, "^%[%[(.+)%]%]$") then
-- There are no [ ] in between.
-- There are no [ ] in between.
-- This makes the wikilink tag redundant.
-- This makes the wikilink tag redundant.
if text:find("^%[%[[^%[%]]+%]%]$") then
if find(text, "^%[%[[^%[%]]+%]%]$") then
require("Module:debug").track("links/redundant wikilink")
require("Module:debug").track("links/redundant wikilink")
else
else

Navigation menu