Module:MolFormIndex

local p = {};

function p.format_as_HTML(frame)

local s = mw.title.getCurrentTitle.subpageText

local disp = "" for element, count in string.gmatch(s, "([A-Z][a-z]?)(%d*)") do   if ( count == "" ) then disp = disp .. element else disp = disp .. element .. "" .. count .. ""   end end

return disp

end

function p.collation_key(frame)

local s = mw.title.getCurrentTitle.subpageText

local ckey = "" for element, count in string.gmatch(s, "([A-Z][a-z]?)(%d*)") do   if ( count == "" ) then count = 1 end ckey = ckey .. string.format("%s%05d", element, count) end

return ckey

end

return p