8,290
edits
(create module for general HTML parsing. Begin with a "pluralize" function that can be used in Favilink) |
mNo edit summary |
||
Line 3: | Line 3: | ||
function p.pluralize(frame) | function p.pluralize(frame) | ||
local htmlString = frame.args[1] | local htmlString = frame.args[1] | ||
prefix, postfix = | prefix, postfix = htmlString:match'(.*%a)(</.*)' --split string at the last alphabetic character that appears immediately before a closing html tag </...> | ||
if (prefix == nil or prefix == '' or postfix == nil or postfix == '') then | if (prefix == nil or prefix == '' or postfix == nil or postfix == '') then | ||
return htmlString --return unmodified string (couldn't find alpha character followed by closing HTML tag) | return htmlString --return unmodified string (couldn't find alpha character followed by closing HTML tag) |