8,756
edits
(moved possessive/pluralize logic to its own module) |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
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 | |||
--split string at the first alphabetic character that appears immediately after a starting html tag <...> | |||
prefix = htmlString:match'([^/]*>)' or '' | |||
if (prefix == nil or prefix == '') then | |||
return conjugate.capitalize(htmlString) | |||
else | |||
_, a = htmlString:find'([^/]*>)' | |||
postfix = htmlString:sub(a + 1) or '' | |||
mw.log('prefix: ' .. prefix) | |||
mw.log('postfix: ' .. postfix) | |||
return (prefix .. conjugate.capitalize(postfix)) | |||
end | |||
end | end | ||