Module:HTMLParse: Difference between revisions

134 bytes added ,  01:54, 1 September 2019
add make_possessive
mNo edit summary
(add make_possessive)
Line 1: Line 1:
local p = {}
local p = {}


function p.pluralize(frame)
function p.pluralize(frame, apostrophe)
    apostrophe = apostrophe or ''
     local htmlString = frame.args.html
     local htmlString = frame.args.html
     if string.find(htmlString, "{") then
     if string.find(htmlString, "{") then
Line 12: Line 13:
         return htmlString  --return unmodified (ends with 's', like 'boots', so we shouldn't append another 's')
         return htmlString  --return unmodified (ends with 's', like 'boots', so we shouldn't append another 's')
     else
     else
         return (prefix .. 's' .. postfix)
         return (prefix .. apostrophe .. 's' .. postfix)
     end
     end
end
function p.make_possessive(frame)
    return p.pluralize(frame, "'")
end
end


return p
return p