Изменения
Перейти к навигации
Перейти к поиску
Строка 2:
Строка 2:
+
+
Строка 148:
Строка 150:
− +
− +
− text = text:gsub("<!%-%-.-%-%->", "") -- Remove html comments.
− end
− if not (args.wikilinks == "no") then
− +
− +
+
+
+
почему бы не сделать через yesno
require('Module:No globals')
require('Module:No globals')
local yesno = require('Module:Yesno')
local p = {}
local p = {}
function p._delink(args)
function p._delink(args)
local text = args[1] or ""
local text = args[1] or ""
if args.refs == "yes" then
if yesno(args.refs) == true then
-- Remove any [[Help:Strip markers]] representing ref tags. In most situations
-- Remove any [[Help:Strip markers]] representing ref tags. In most situations
-- this is not a good idea - only use it if you know what you are doing!
-- this is not a good idea - only use it if you know what you are doing!
text = mw.ustring.gsub(text, "UNIQ%w*%-ref%-%d*%-QINU", "")
text = mw.ustring.gsub(text, "UNIQ%w*%-ref%-%d*%-QINU", "")
end
end
if not (args.comments == "no") then
if not (yesno(args.wikilinks) == false) then
text = delinkLinkClass(text, "^%[%[.-%]%]", delinkWikilink) -- De-link wikilinks.
text = delinkLinkClass(text, "^%[%[.-%]%]", delinkWikilink) -- De-link wikilinks.
end
end
if not (args.urls == "no") then
if not (yesno(args.urls) == false) then
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
end
end
if not (args.whitespace == "no") then
if not (yesno(args.comments) == false) then
text = text:gsub("<!%-%-.-%-%->", "") -- Remove html comments.
end
if not (yesno(args.whitespace) == false) then
-- Replace single new lines with a single space, but leave double new lines
-- Replace single new lines with a single space, but leave double new lines
-- and new lines only containing spaces or tabs before a second new line.
-- and new lines only containing spaces or tabs before a second new line.