Multiple leading capital letters in a WikiWord
CMyApp is a WikiWord (at least, on other Wiki systems, like TWiki). Should allow that here Also, choose a more obscure name for the thread-local variable tracking included chunks.
This commit is contained in:
parent
61c3fb1ab9
commit
c3c33b68dd
|
@ -45,21 +45,22 @@ class Include < WikiChunk::WikiReference
|
||||||
end
|
end
|
||||||
|
|
||||||
# We track included pages in a thread-local variable.
|
# We track included pages in a thread-local variable.
|
||||||
# This allows a multi-threaded Rails to handle one request/thread,
|
# This allows a multi-threaded Rails to handle multiple
|
||||||
# without getting confused.
|
# simultaneous requests (one request/thread), without
|
||||||
|
# getting confused.
|
||||||
def clear_include_list
|
|
||||||
Thread.current[:included_by] = []
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_to_include_list
|
def add_to_include_list
|
||||||
Thread.current[:included_by] ?
|
Thread.current[:chunk_included_by] ?
|
||||||
Thread.current[:included_by].push(@content.page_name) :
|
Thread.current[:chunk_included_by].push(@content.page_name) :
|
||||||
Thread.current[:included_by] = [@content.page_name]
|
Thread.current[:chunk_included_by] = [@content.page_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
def clear_include_list
|
||||||
|
Thread.current[:chunk_included_by] = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def self_inclusion(refpage)
|
def self_inclusion(refpage)
|
||||||
if Thread.current[:included_by].include?(refpage.page.name)
|
if Thread.current[:chunk_included_by].include?(refpage.page.name)
|
||||||
@content.delete_chunk(self)
|
@content.delete_chunk(self)
|
||||||
clear_include_list
|
clear_include_list
|
||||||
else
|
else
|
||||||
|
|
|
@ -14,7 +14,7 @@ module WikiWords
|
||||||
"абвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљћќѝўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҌҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӹ" +
|
"абвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљћќѝўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҌҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӹ" +
|
||||||
"աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆև"
|
"աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆև"
|
||||||
|
|
||||||
WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + '][a-z' + I18N_LOWER_CASE_LETTERS + ']+[A-Z' + I18N_HIGHER_CASE_LETTERS + ']\w+'
|
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
|
CAMEL_CASED_WORD_BORDER = /([a-z#{I18N_LOWER_CASE_LETTERS}])([A-Z#{I18N_HIGHER_CASE_LETTERS}])/u
|
||||||
|
|
||||||
def self.separate(wiki_word)
|
def self.separate(wiki_word)
|
||||||
|
|
|
@ -11,4 +11,8 @@ class WikiWordsTest < Test::Unit::TestCase
|
||||||
assert_equal "Æe ÅØle Øen", WikiWords.separate("ÆeÅØleØen")
|
assert_equal "Æe ÅØle Øen", WikiWords.separate("ÆeÅØleØen")
|
||||||
assert_equal "Legetøj", WikiWords.separate("Legetøj")
|
assert_equal "Legetøj", WikiWords.separate("Legetøj")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_multiple_leading_capital_letters
|
||||||
|
assert_equal "CMy App", WikiWords.separate("CMyApp")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue