8,756
edits
(moved possessive/pluralize logic to its own module) |
(capitalize...?) |
||
Line 18: | Line 18: | ||
function p.make_possessive(frame) | function p.make_possessive(frame) | ||
return p.pluralize(frame, "'") | return p.pluralize(frame, "'") | ||
end | |||
function p.capitalize(frame) | |||
local htmlString = frame.args.html | |||
if string.find(htmlString, "{") then | |||
htmlString = frame:preprocess(htmlString) --expand any templates that may have been passed to this module | |||
end | |||
prefix, postfix = htmlString:match'(<.*>)(.*%a)' --split string at the first alphabetic character that appears immediately after a starting html tag <...> | |||
if (prefix == nil or prefix == '') then | |||
if (postfix == nil or postfix == '') then | |||
return htmlString --return unmodified string | |||
else | |||
return conjugate.capitalize(htmlString) | |||
end | |||
else | |||
return (prefix .. conjugate.capitalize(postfix)) | |||
end | |||
end | end | ||