app/models/wiki_words.rb in instiki-0.9.2 vs app/models/wiki_words.rb in instiki-0.10.0

- old
+ new

@@ -1,25 +1,23 @@ -# Contains all the methods for finding and replacing wiki words -module WikiWords - # In order of appearance: Latin, greek, cyrillian, armenian - I18N_HIGHER_CASE_LETTERS = - "ÀÁÂÃÄÅĀĄĂÆÇĆČĈĊĎĐÈÉÊËĒĘĚĔĖĜĞĠĢĤĦÌÍÎÏĪĨĬĮİIJĴĶŁĽĹĻĿÑŃŇŅŊÒÓÔÕÖØŌŐŎŒŔŘŖŚŠŞŜȘŤŢŦȚÙÚÛÜŪŮŰŬŨŲŴÝŶŸŹŽŻ" + - "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ" + - "ΆΈΉΊΌΎΏѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӸЖ" + - "ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՏՐՑՒՓՔՕՖ" - - I18N_LOWER_CASE_LETTERS = - "àáâãäåāąăæçćčĉċďđèéêëēęěĕėƒĝğġģĥħìíîïīĩĭįıijĵķĸłľĺļŀñńňņʼnŋòóôõöøōőŏœŕřŗśšşŝșťţŧțùúûüūůűŭũųŵýÿŷžżźÞþßſÐð" + - "άέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώΐ" + - "абвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљћќѝўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӹ" + - "աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆև" - - WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + '][a-z' + I18N_LOWER_CASE_LETTERS + ']+[A-Z' + I18N_HIGHER_CASE_LETTERS + ']\w+' - - def self.separate(wiki_word, ignore_separation = false) - if ignore_separation - wiki_word - else - wiki_word.gsub(/([a-z#{I18N_LOWER_CASE_LETTERS}])([A-Z#{I18N_HIGHER_CASE_LETTERS}])/u, '\1 \2') - end - end -end \ No newline at end of file +# Contains all the methods for finding and replacing wiki words +module WikiWords + # In order of appearance: Latin, greek, cyrillian, armenian + I18N_HIGHER_CASE_LETTERS = + "À?ÂÃÄÅĀĄĂÆÇĆČĈĊĎ?ÈÉÊËĒĘĚĔĖĜĞĠĢĤĦÌ?Î?ĪĨĬĮİIJĴĶ?ĽĹĻĿÑŃŇŅŊÒÓÔÕÖØŌ?ŎŒŔŘŖŚŠŞŜȘŤŢŦȚÙÚÛÜŪŮŰŬŨŲŴ?ŶŸŹŽŻ" + + "ΑΒΓΔΕΖΗΘΙΚΛΜ?ΞΟΠΡΣΤΥΦΧΨΩ" + + "ΆΈΉΊΌΎ?ѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎ?ҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾ?ӃӅӇӉӋ??ӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӸЖ" + + "ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀ?ՂՃՄՅՆՇՈՉՊՋՌ???ՑՒՓՔՕՖ" + + I18N_LOWER_CASE_LETTERS = + "àáâãäå?ąăæçć?ĉċ?đèéêëēęěĕėƒ?ğġģĥħìíîïīĩĭįıijĵķĸłľĺļŀñńňņʼnŋòóôõöø?ő?œŕřŗśšş?șťţŧțùúûüūůűŭũųŵýÿŷžżźÞþßſ?ð" + + "άέήίΰαβγδεζηθικλμνξοπ?ςστυφχψωϊϋό?ώ?" + + "абвгдежзийклмнопр?туфхцчшщъыь?ю??ёђѓєѕіїјљћќ?ўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿ?ҋ??ґғҕҗҙқ?ҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛ?ӟӡӣӥӧөӫӭӯӱӳӵӹ" + + "աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտր?ւփքօֆև" + + WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + '][a-z' + I18N_LOWER_CASE_LETTERS + ']+[A-Z' + I18N_HIGHER_CASE_LETTERS + ']\w+' + CAMEL_CASED_WORD_BORDER = /([a-z#{I18N_LOWER_CASE_LETTERS}])([A-Z#{I18N_HIGHER_CASE_LETTERS}])/u + + def self.separate(wiki_word) + wiki_word.gsub(CAMEL_CASED_WORD_BORDER, '\1 \2') + end + +end