Jump to content
Toggle menu
  • 3 articles
  • 75 files
  • 7 users
  • 37.9K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:TagQS: Difference between revisions

From Neodyland Wiki
Fix Linter errors. When this template is preceded by indenting markup and wrapped in div tags, misnesting occurs
add appendValue function
Line 56: Line 56:
-- tag with the wikidata item and {{Book}} template will add label and property for "transaltor".
-- tag with the wikidata item and {{Book}} template will add label and property for "transaltor".
local patrn = '%<div style="display: none;"%>'.. old ..' QS:([^%<]+)%</div%>'
local patrn = '%<div style="display: none;"%>'.. old ..' QS:([^%<]+)%</div%>'
local repl  = '<div style="display: none;">'.. new ..' QS:%1</div>'
local repl  = '<div style="display: none;">'.. new ..' QS:%1</div>'
return mw.ustring.gsub(text, patrn, repl)
return mw.ustring.gsub(text, patrn, repl)
end
end
Line 70: Line 70:
local patrn = '%<div style="display: none;"%>' .. field .. ' QS:' .. old .. ',([^%<]+)%</div%>'
local patrn = '%<div style="display: none;"%>' .. field .. ' QS:' .. old .. ',([^%<]+)%</div%>'
local repl  =  '<div style="display: none;">' .. field .. ' QS:' .. new .. ',%1</div>'
local repl  =  '<div style="display: none;">' .. field .. ' QS:' .. new .. ',%1</div>'
return mw.ustring.gsub(text, patrn, repl)
end
function p.appendValue(text, field, text)
-- append "text" to the "value" part of the tag
local patrn = '%<div style="display: none;"%>'.. field ..' QS:([^%<]+)%</div%>'
local repl  =  '<div style="display: none;">' .. field ..' QS:%1,' .. text .. '</div>'
return mw.ustring.gsub(text, patrn, repl)
return mw.ustring.gsub(text, patrn, repl)
end
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.