Module:HTMLParse: Difference between revisions

145 bytes added ,  18:19, 20 August 2019
m
no edit summary
mNo edit summary
mNo edit summary
Line 3: Line 3:
function p.pluralize(frame)
function p.pluralize(frame)
     local htmlString = frame.args.html
     local htmlString = frame.args.html
    if string.find(htmlString, "{") then
        htmlString = frame:preprocess(htmlString)  --expand templates if passed to this module
    end
     prefix, postfix = htmlString:match'(.*%a)(</.*)'  --split string at the last alphabetic character that appears immediately before a closing html tag </...>
     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