localm_ja=require("Module:ja")localkata_to_hira=m_ja.kata_to_hiralocalnormalize_kana=m_ja.normalize_kanalocaldata=mw.loadData("Module:Hrkt-sortkey/data")localexport={}-- Generate a sortkey from a kana input. This can be any combination of hiragana and katakana, and will not be normalized to hiragana or katakana first. Use [[Module:Hira-sortkey]] or [[Module:Kana-sortkey]] if that is required, which in turn call this module.functionexport.makeSortKey(text,lang,sc)-- Normalize long vowel and iteration marks.text=normalize_kana(text)-- Middle dots and double hyphens become spaces.text=text:gsub("\227[\130\131][\160\187]",data.spaces)-- For each dakuten and handakuten, remove it and add 1 or 2 apostrophes to the end (respectively).localapos=0text=text:gsub("\227\130[\153\154]",function(char)apos=apos+data.voicing[char]return""end)returnapos>0and(text..("'"):rep(apos))ortextendreturnexport