Pimki 1.7.092 → 1.8.092
Sign up to get free protection for your applications and to get access to all the features.
- data/README-PIMKI +182 -178
- data/app/controllers/wiki.rb +950 -942
- data/app/models/chunks/category.rb +33 -33
- data/app/models/chunks/category_test.rb +21 -21
- data/app/models/chunks/chunk.rb +20 -20
- data/app/models/chunks/engines.rb +48 -48
- data/app/models/chunks/include.rb +1 -1
- data/app/models/chunks/match.rb +1 -1
- data/app/models/chunks/nowiki.rb +1 -1
- data/app/models/chunks/nowiki_test.rb +5 -0
- data/app/models/chunks/todo.rb +1 -0
- data/app/models/chunks/wiki.rb +130 -130
- data/app/models/page.rb +124 -124
- data/app/models/revision.rb +92 -92
- data/app/models/web.rb +314 -316
- data/app/models/wiki_content.rb +2 -2
- data/app/models/wiki_service.rb +170 -166
- data/app/models/wiki_words.rb +28 -28
- data/app/views/error.rhtml +37 -37
- data/app/views/navigation.rhtml +1 -1
- data/app/views/static_style_sheet.rhtml +10 -5
- data/app/views/top.rhtml +1 -1
- data/app/views/wiki/adv_search.rhtml +61 -61
- data/app/views/wiki/bliki.rhtml +7 -6
- data/app/views/wiki/bliki_edit.rhtml +26 -37
- data/app/views/wiki/bliki_new.rhtml +58 -64
- data/app/views/wiki/bliki_revision.rhtml +5 -3
- data/app/views/wiki/edit.rhtml +44 -44
- data/app/views/wiki/edit_menu.rhtml +26 -19
- data/app/views/wiki/edit_web.rhtml +303 -305
- data/app/views/wiki/glossary.rhtml +35 -27
- data/app/views/wiki/list.rhtml +175 -174
- data/app/views/wiki/list.rhtml.bak +175 -0
- data/app/views/wiki/mind.rhtml +70 -70
- data/app/views/wiki/new.rhtml +34 -32
- data/app/views/wiki/published.rhtml +34 -49
- data/app/views/wiki/revision.rhtml +88 -87
- data/app/views/wiki/rollback.rhtml +36 -35
- data/app/views/wiki/todo.rhtml +2 -2
- data/app/views/wiki_words_help.rhtml +8 -8
- data/libraries/action_controller_servlet.rb +202 -202
- data/libraries/madeleine_service.rb +162 -162
- data/pimki.rb +181 -181
- metadata +11 -12
- data/README +0 -172
- data/app/models/chunks/acronym.rb +0 -19
- data/app/views/wiki/test.rhtml +0 -25
- data/libraries/secure_web_controller_server.rb +0 -106
data/app/models/wiki_content.rb
CHANGED
@@ -44,9 +44,9 @@ class WikiContent < String
|
|
44
44
|
|
45
45
|
# Moved URIChunk from pre-engine to post-engine, as it clashed with the textile
|
46
46
|
# markup of "link":URL.
|
47
|
-
PRE_ENGINE_ACTIONS = [ NoWiki, Category, Include,
|
47
|
+
PRE_ENGINE_ACTIONS = [ NoWiki, Category, Include, WikiSymbol,
|
48
48
|
WikiChunk::Link, WikiChunk::BlikiLink ]
|
49
|
-
POST_ENGINE_ACTIONS = [ Literal::Tags, URIChunk, WikiChunk::Word, Todo ]
|
49
|
+
POST_ENGINE_ACTIONS = [ Literal::Tags, Literal::Pre, URIChunk, WikiChunk::Word, Todo ]
|
50
50
|
|
51
51
|
|
52
52
|
DEFAULT_OPTS = {
|
data/app/models/wiki_service.rb
CHANGED
@@ -1,167 +1,171 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "madeleine_service"
|
4
|
-
require "web"
|
5
|
-
require "page"
|
6
|
-
require "author"
|
7
|
-
|
8
|
-
class WikiService < MadeleineService
|
9
|
-
attr_reader :webs, :system
|
10
|
-
attr_accessor :default_web
|
11
|
-
|
12
|
-
# These methods do not change the state of persistent objects, and
|
13
|
-
# should not be logged by Madeleine
|
14
|
-
automatic_read_only :authenticate, :read_page, :read_bliki_entry, :setup?, :webs
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
@webs, @system = {}, {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup?
|
21
|
-
!@system.empty?
|
22
|
-
end
|
23
|
-
|
24
|
-
def authenticate(password)
|
25
|
-
password == (@system["password"] || "pimki")
|
26
|
-
end
|
27
|
-
|
28
|
-
def setup(password, web_name, web_address)
|
29
|
-
@system["password"] = password
|
30
|
-
create_web(web_name, web_address)
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_web(name, address, password = nil)
|
34
|
-
@webs[address] = Web.new(name, address, password) unless @webs[address]
|
35
|
-
end
|
36
|
-
|
37
|
-
def update_web(old_address, new_address, name, markup, color, additional_style, safe_mode = false,
|
38
|
-
password = nil, published = false, default_to_published = false, brackets_only = false,
|
39
|
-
count_pages = false, mind_map_size="7,7", symbols_map=nil, links_map=nil,
|
40
|
-
snapshots_interval = 1,
|
41
|
-
enable_dclick_edit=nil, enable_menu=true, check_pass_on_edit=false,
|
42
|
-
prog=nil, graph_type=nil, missing=nil, show_authors=nil, show_leaves=nil, selected_categories=nil)
|
43
|
-
|
44
|
-
if old_address != new_address
|
45
|
-
@webs[new_address] = @webs[old_address]
|
46
|
-
@webs.delete(old_address)
|
47
|
-
@webs[new_address].address = new_address
|
48
|
-
end
|
49
|
-
|
50
|
-
self.class.snapshot_interval_hours = snapshots_interval
|
51
|
-
|
52
|
-
web = @webs[new_address]
|
53
|
-
web.refresh_revisions if settings_changed?(web, markup, safe_mode, brackets_only)
|
54
|
-
|
55
|
-
web.name, web.markup, web.color, web.additional_style, web.safe_mode =
|
56
|
-
name, markup, color, additional_style, safe_mode
|
57
|
-
|
58
|
-
web.password, web.published, web.default_to_published, web.brackets_only, web.count_pages =
|
59
|
-
password, published, default_to_published, brackets_only, count_pages
|
60
|
-
|
61
|
-
web.enable_dclick_edit, web.enable_menu, web.check_pass_on_edit = enable_dclick_edit, enable_menu, check_pass_on_edit
|
62
|
-
|
63
|
-
web.mind_map_size, web.mm_prog, web.mm_graph_type, web.mm_show_missing =
|
64
|
-
mind_map_size, prog, graph_type, missing
|
65
|
-
|
66
|
-
web.mm_show_authors, web.mm_show_leaves, web.mm_selected_categories =
|
67
|
-
show_authors, show_leaves, selected_categories
|
68
|
-
|
69
|
-
web.symbols_map, web.links_map = symbols_map, links_map
|
70
|
-
end
|
71
|
-
|
72
|
-
def read_page(web_address, page_name)
|
73
|
-
web = @webs[web_address]
|
74
|
-
web ? web.pages[page_name] : nil
|
75
|
-
end
|
76
|
-
|
77
|
-
def write_page(web_address, page_name, content, written_on, author)
|
78
|
-
page = Page.new(@webs[web_address], page_name, content, written_on, author)
|
79
|
-
@webs[web_address].add_page(page)
|
80
|
-
page
|
81
|
-
end
|
82
|
-
|
83
|
-
def revise_page(web_address, page_name, content, revised_on, author, edit_type)
|
84
|
-
page = read_page(web_address, page_name)
|
85
|
-
page.revise(content, revised_on, author, edit_type)
|
86
|
-
page
|
87
|
-
end
|
88
|
-
|
89
|
-
def rollback_page(web_address, page_name, revision_number, created_at, author_id = nil)
|
90
|
-
page = read_page(web_address, page_name)
|
91
|
-
page.rollback(revision_number, created_at, author_id)
|
92
|
-
page
|
93
|
-
end
|
94
|
-
|
95
|
-
def remove_orphaned_pages(web_address)
|
96
|
-
@webs[web_address].remove_pages(@webs[web_address].select.orphaned_pages)
|
97
|
-
end
|
98
|
-
|
99
|
-
#
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
page
|
110
|
-
web.pages
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
def
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
page
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
page
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
1
|
+
|
2
|
+
|
3
|
+
require "madeleine_service"
|
4
|
+
require "web"
|
5
|
+
require "page"
|
6
|
+
require "author"
|
7
|
+
|
8
|
+
class WikiService < MadeleineService
|
9
|
+
attr_reader :webs, :system
|
10
|
+
attr_accessor :default_web
|
11
|
+
|
12
|
+
# These methods do not change the state of persistent objects, and
|
13
|
+
# should not be logged by Madeleine
|
14
|
+
automatic_read_only :authenticate, :read_page, :read_bliki_entry, :setup?, :webs
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@webs, @system = {}, {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup?
|
21
|
+
!@system.empty?
|
22
|
+
end
|
23
|
+
|
24
|
+
def authenticate(password)
|
25
|
+
password == (@system["password"] || "pimki")
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup(password, web_name, web_address)
|
29
|
+
@system["password"] = password
|
30
|
+
create_web(web_name, web_address)
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_web(name, address, password = nil)
|
34
|
+
@webs[address] = Web.new(name, address, password) unless @webs[address]
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_web(old_address, new_address, name, markup, color, additional_style, safe_mode = false,
|
38
|
+
password = nil, published = false, default_to_published = false, brackets_only = false,
|
39
|
+
count_pages = false, mind_map_size="7,7", symbols_map=nil, links_map=nil,
|
40
|
+
snapshots_interval = 1,
|
41
|
+
enable_dclick_edit=nil, enable_menu=true, check_pass_on_edit=false,
|
42
|
+
prog=nil, graph_type=nil, missing=nil, show_authors=nil, show_leaves=nil, selected_categories=nil)
|
43
|
+
|
44
|
+
if old_address != new_address
|
45
|
+
@webs[new_address] = @webs[old_address]
|
46
|
+
@webs.delete(old_address)
|
47
|
+
@webs[new_address].address = new_address
|
48
|
+
end
|
49
|
+
|
50
|
+
self.class.snapshot_interval_hours = snapshots_interval
|
51
|
+
|
52
|
+
web = @webs[new_address]
|
53
|
+
web.refresh_revisions if settings_changed?(web, markup, safe_mode, brackets_only)
|
54
|
+
|
55
|
+
web.name, web.markup, web.color, web.additional_style, web.safe_mode =
|
56
|
+
name, markup, color, additional_style, safe_mode
|
57
|
+
|
58
|
+
web.password, web.published, web.default_to_published, web.brackets_only, web.count_pages =
|
59
|
+
password, published, default_to_published, brackets_only, count_pages
|
60
|
+
|
61
|
+
web.enable_dclick_edit, web.enable_menu, web.check_pass_on_edit = enable_dclick_edit, enable_menu, check_pass_on_edit
|
62
|
+
|
63
|
+
web.mind_map_size, web.mm_prog, web.mm_graph_type, web.mm_show_missing =
|
64
|
+
mind_map_size, prog, graph_type, missing
|
65
|
+
|
66
|
+
web.mm_show_authors, web.mm_show_leaves, web.mm_selected_categories =
|
67
|
+
show_authors, show_leaves, selected_categories
|
68
|
+
|
69
|
+
web.symbols_map, web.links_map = symbols_map, links_map
|
70
|
+
end
|
71
|
+
|
72
|
+
def read_page(web_address, page_name)
|
73
|
+
web = @webs[web_address]
|
74
|
+
web ? web.pages[page_name] : nil
|
75
|
+
end
|
76
|
+
|
77
|
+
def write_page(web_address, page_name, content, written_on, author)
|
78
|
+
page = Page.new(@webs[web_address], page_name, content, written_on, author)
|
79
|
+
@webs[web_address].add_page(page)
|
80
|
+
page
|
81
|
+
end
|
82
|
+
|
83
|
+
def revise_page(web_address, page_name, content, revised_on, author, edit_type)
|
84
|
+
page = read_page(web_address, page_name)
|
85
|
+
page.revise(content, revised_on, author, edit_type)
|
86
|
+
page
|
87
|
+
end
|
88
|
+
|
89
|
+
def rollback_page(web_address, page_name, revision_number, created_at, author_id = nil)
|
90
|
+
page = read_page(web_address, page_name)
|
91
|
+
page.rollback(revision_number, created_at, author_id)
|
92
|
+
page
|
93
|
+
end
|
94
|
+
|
95
|
+
def remove_orphaned_pages(web_address)
|
96
|
+
@webs[web_address].remove_pages(@webs[web_address].select.orphaned_pages)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Page Admin commands --------------------------------------------------------
|
100
|
+
|
101
|
+
# deletes a page from the web.
|
102
|
+
def delete_page(web_address, page_name) #{{{
|
103
|
+
@webs[web_address].pages.delete(page_name)
|
104
|
+
end #}}}
|
105
|
+
|
106
|
+
# renames a page in the web.
|
107
|
+
def rename_page(web_address, old_page_name, new_page_name) #{{{
|
108
|
+
web = @webs[web_address]
|
109
|
+
page = web.pages.delete(old_page_name)
|
110
|
+
page or raise "unknown page: #{old_page_name.to_s}; #{web.pages.keys.join(',')}"
|
111
|
+
page.name = new_page_name
|
112
|
+
web.pages[new_page_name] = page
|
113
|
+
end #}}}
|
114
|
+
|
115
|
+
# Menu commands --------------------------------------------------------------
|
116
|
+
|
117
|
+
def save_menu_pref(web_address, type, limit, content, category, author) #{{{
|
118
|
+
web = @webs[web_address]
|
119
|
+
web.menu_type = type
|
120
|
+
web.menu_limit = limit
|
121
|
+
web.menu_category = category
|
122
|
+
|
123
|
+
if Page === web.menu_content
|
124
|
+
web.menu_content.revise(
|
125
|
+
content, Time.now, '', author
|
126
|
+
)
|
127
|
+
else
|
128
|
+
# Protect old Pimki storages.
|
129
|
+
web.menu_content = Page.new(
|
130
|
+
web, 'menu', content, Time.now, ''
|
131
|
+
)
|
132
|
+
end
|
133
|
+
end #}}}
|
134
|
+
|
135
|
+
# Bliki commands -------------------------------------------------------------
|
136
|
+
|
137
|
+
def read_bliki_entry(web_address, page_name)
|
138
|
+
@webs[web_address].bliki[page_name]
|
139
|
+
end
|
140
|
+
|
141
|
+
def write_bliki_entry(web_address, page_name, content, written_on, author)
|
142
|
+
page = Page.new(@webs[web_address], page_name, content, written_on, author)
|
143
|
+
@webs[web_address].add_bliki_entry(page)
|
144
|
+
page
|
145
|
+
end
|
146
|
+
|
147
|
+
def revise_bliki_entry(web_address, page_name, content, revised_on, author)
|
148
|
+
page = read_bliki_entry(web_address, page_name)
|
149
|
+
page.revise(content, revised_on, author)
|
150
|
+
page
|
151
|
+
end
|
152
|
+
|
153
|
+
def rollback_bliki_entry(web_address, page_name, revision_number, created_at)
|
154
|
+
page = read_bliki_entry(web_address, page_name)
|
155
|
+
page.rollback(revision_number, created_at)
|
156
|
+
page
|
157
|
+
end
|
158
|
+
|
159
|
+
def delete_bliki_entry(web_address, page_name) #{{{
|
160
|
+
@webs[web_address].bliki.delete(page_name)
|
161
|
+
end #}}}
|
162
|
+
|
163
|
+
private
|
164
|
+
def settings_changed?(web, markup, safe_mode, brackets_only)
|
165
|
+
web.markup != markup ||
|
166
|
+
web.safe_mode != safe_mode ||
|
167
|
+
web.brackets_only != brackets_only
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
167
171
|
# jEdit :folding=indent:collapseFolds=1:
|
data/app/models/wiki_words.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
|
2
|
-
# Contains all the methods for finding and replacing wiki words
|
3
|
-
module WikiWords
|
4
|
-
# In order of appearance: Latin, greek, cyrillian, armenian
|
5
|
-
I18N_HIGHER_CASE_LETTERS =
|
6
|
-
"À�?ÂÃÄÅĀĄĂÆÇĆČĈĊĎ�?ÈÉÊËĒĘĚĔĖĜĞĠĢĤĦÌ�?Î�?ĪĨĬĮİIJĴĶ�?ĽĹĻĿÑŃŇŅŊÒÓÔÕÖØŌ�?ŎŒŔŘŖŚŠŞŜȘŤŢŦȚÙÚÛÜŪŮŰŬŨŲŴ�?ŶŸŹŽŻ" +
|
7
|
-
"ΑΒΓΔΕΖΗΘΙΚΛΜ�?ΞΟΠΡΣΤΥΦΧΨΩ" +
|
8
|
-
"ΆΈΉΊΌΎ�?ѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎ�?ҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾ�?ӃӅӇӉӋ�?�?ӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӸЖ" +
|
9
|
-
"ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀ�?ՂՃՄՅՆՇՈՉՊՋՌ�?�?�?ՑՒՓՔՕՖ"
|
10
|
-
|
11
|
-
I18N_LOWER_CASE_LETTERS =
|
12
|
-
"àáâãäå�?ąăæçć�?ĉċ�?đèéêëēęěĕėƒ�?ğġģĥħìíîïīĩĭįıijĵķĸłľĺļŀñńňņʼnŋòóôõöø�?ő�?œŕřŗśšş�?șťţŧțùúûüūůűŭũųŵýÿŷžżźÞþßſ�?ð" +
|
13
|
-
"άέήίΰαβγδεζηθικλμνξοπ�?ςστυφχψωϊϋό�?ώ�?" +
|
14
|
-
"абвгдежзийклмнопр�?туфхцчшщъыь�?ю�?�?ёђѓєѕіїјљћќ�?ўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿ�?ҋ�?�?ґғҕҗҙқ�?ҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛ�?ӟӡӣӥӧөӫӭӯӱӳӵӹ" +
|
15
|
-
"աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտր�?ւփքօֆև"
|
16
|
-
|
17
|
-
DIGITS = "0123456789"
|
18
|
-
|
19
|
-
WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + ']+[a-z' + I18N_LOWER_CASE_LETTERS + ']+[a-z' + I18N_LOWER_CASE_LETTERS + DIGITS + ']*[A-Z' + I18N_HIGHER_CASE_LETTERS + DIGITS + ']\w+'
|
20
|
-
CAMEL_CASED_WORD_BORDER = /([a-z#{I18N_LOWER_CASE_LETTERS}#{DIGITS}]|[A-Z#{I18N_HIGHER_CASE_LETTERS}]{2,})(?=[A-Z#{I18N_HIGHER_CASE_LETTERS}]\B)/u
|
21
|
-
|
22
|
-
def self.separate(wiki_word, ignore_separation = false)
|
23
|
-
if ignore_separation or wiki_word.match(/^[A-Z#{I18N_HIGHER_CASE_LETTERS}]+$/) or wiki_word.match(/\s/)
|
24
|
-
wiki_word
|
25
|
-
else
|
26
|
-
wiki_word.gsub(CAMEL_CASED_WORD_BORDER, '\1 \2').gsub(/(
|
27
|
-
end
|
28
|
-
end
|
1
|
+
|
2
|
+
# Contains all the methods for finding and replacing wiki words
|
3
|
+
module WikiWords
|
4
|
+
# In order of appearance: Latin, greek, cyrillian, armenian
|
5
|
+
I18N_HIGHER_CASE_LETTERS =
|
6
|
+
"À�?ÂÃÄÅĀĄĂÆÇĆČĈĊĎ�?ÈÉÊËĒĘĚĔĖĜĞĠĢĤĦÌ�?Î�?ĪĨĬĮİIJĴĶ�?ĽĹĻĿÑŃŇŅŊÒÓÔÕÖØŌ�?ŎŒŔŘŖŚŠŞŜȘŤŢŦȚÙÚÛÜŪŮŰŬŨŲŴ�?ŶŸŹŽŻ" +
|
7
|
+
"ΑΒΓΔΕΖΗΘΙΚΛΜ�?ΞΟΠΡΣΤΥΦΧΨΩ" +
|
8
|
+
"ΆΈΉΊΌΎ�?ѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎ�?ҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾ�?ӃӅӇӉӋ�?�?ӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӸЖ" +
|
9
|
+
"ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀ�?ՂՃՄՅՆՇՈՉՊՋՌ�?�?�?ՑՒՓՔՕՖ"
|
10
|
+
|
11
|
+
I18N_LOWER_CASE_LETTERS =
|
12
|
+
"àáâãäå�?ąăæçć�?ĉċ�?đèéêëēęěĕėƒ�?ğġģĥħìíîïīĩĭįıijĵķĸłľĺļŀñńňņʼnŋòóôõöø�?ő�?œŕřŗśšş�?șťţŧțùúûüūůűŭũųŵýÿŷžżźÞþßſ�?ð" +
|
13
|
+
"άέήίΰαβγδεζηθικλμνξοπ�?ςστυφχψωϊϋό�?ώ�?" +
|
14
|
+
"абвгдежзийклмнопр�?туфхцчшщъыь�?ю�?�?ёђѓєѕіїјљћќ�?ўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿ�?ҋ�?�?ґғҕҗҙқ�?ҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛ�?ӟӡӣӥӧөӫӭӯӱӳӵӹ" +
|
15
|
+
"աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտր�?ւփքօֆև"
|
16
|
+
|
17
|
+
DIGITS = "0123456789"
|
18
|
+
|
19
|
+
WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + ']+[a-z' + I18N_LOWER_CASE_LETTERS + ']+[a-z' + I18N_LOWER_CASE_LETTERS + DIGITS + ']*[A-Z' + I18N_HIGHER_CASE_LETTERS + DIGITS + ']\w+'
|
20
|
+
CAMEL_CASED_WORD_BORDER = /([a-z#{I18N_LOWER_CASE_LETTERS}#{DIGITS}]|[A-Z#{I18N_HIGHER_CASE_LETTERS}]{2,})(?=[A-Z#{I18N_HIGHER_CASE_LETTERS}]\B)/u
|
21
|
+
|
22
|
+
def self.separate(wiki_word, ignore_separation = false)
|
23
|
+
if ignore_separation or wiki_word.match(/^[A-Z#{I18N_HIGHER_CASE_LETTERS}]+$/) or wiki_word.match(/\s/)
|
24
|
+
wiki_word
|
25
|
+
else
|
26
|
+
wiki_word.gsub(CAMEL_CASED_WORD_BORDER, '\1 \2').gsub(/([a-z#{I18N_LOWER_CASE_LETTERS}A-Z#{I18N_HIGHER_CASE_LETTERS}])(\d+)/u) { $1 == '_' ? "#$1#$2" : "#$1 #$2" }
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
data/app/views/error.rhtml
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
<% def html_escape str
|
2
|
-
str.gsub( '<', '<').gsub( '>', '>').gsub('&', '&')
|
3
|
-
end %>
|
4
|
-
|
5
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
7
|
-
<head>
|
8
|
-
<title>Internal Error</title>
|
9
|
-
|
10
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
11
|
-
<link rel="Stylesheet" href="../../static_style_sheet/" type="text/css" media="screen" />
|
12
|
-
</head>
|
13
|
-
<body>
|
14
|
-
|
15
|
-
<h3>An error has occured!</h3>
|
16
|
-
|
17
|
-
<p>We're sorry, we're not perfect... but we want to be! If you have the time, please go to the pimki <a href="http://rubyforge.org/tracker/?atid=1750&group_id=447&func=browse">BUG tracker</a> at RubyForge and open a bug report. Please supply a short description of what you did when this happended, the system you're on, etc. and paste everything below this line in the bug report. It will greatly help in development. Thank you for your efforts!</p>
|
18
|
-
|
19
|
-
<hr />
|
20
|
-
|
21
|
-
<p><b>Error message:</b>
|
22
|
-
<code style="color:red"><%= html_escape @error_details.message %></code>
|
23
|
-
</p>
|
24
|
-
|
25
|
-
<p><b>Action:</b> <%= @action_name %></p>
|
26
|
-
|
27
|
-
<p><b>Request:</b> <%= @req %></p>
|
28
|
-
|
29
|
-
<p><b>Backtrace:</b></p>
|
30
|
-
<p><table border="0">
|
31
|
-
<% for line in @error_details.backtrace %>
|
32
|
-
<tr><td><code><%= line.sub(/(.*)\/(\w+\.rb):(\d+):in (.*)/, '\1/<b>\2</b>:\3:in <b>\4</b>') %></code></td></tr>
|
33
|
-
<% end %>
|
34
|
-
</p>
|
35
|
-
|
36
|
-
</body>
|
37
|
-
</html>
|
1
|
+
<% def html_escape str
|
2
|
+
str.gsub( '<', '<').gsub( '>', '>').gsub('&', '&')
|
3
|
+
end %>
|
4
|
+
|
5
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
7
|
+
<head>
|
8
|
+
<title>Internal Error</title>
|
9
|
+
|
10
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
11
|
+
<link rel="Stylesheet" href="../../static_style_sheet/" type="text/css" media="screen" />
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
|
15
|
+
<h3>An error has occured!</h3>
|
16
|
+
|
17
|
+
<p>We're sorry, we're not perfect... but we want to be! If you have the time, please go to the pimki <a href="http://rubyforge.org/tracker/?atid=1750&group_id=447&func=browse">BUG tracker</a> at RubyForge and open a bug report. Please supply a short description of what you did when this happended, the system you're on, etc. and paste everything below this line in the bug report. It will greatly help in development. Thank you for your efforts!</p>
|
18
|
+
|
19
|
+
<hr />
|
20
|
+
|
21
|
+
<p><b>Error message:</b>
|
22
|
+
<code style="color:red"><%= html_escape @error_details.message %></code>
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p><b>Action:</b> <%= @action_name %></p>
|
26
|
+
|
27
|
+
<p><b>Request:</b> <%= @req %></p>
|
28
|
+
|
29
|
+
<p><b>Backtrace:</b></p>
|
30
|
+
<p><table border="0">
|
31
|
+
<% for line in @error_details.backtrace %>
|
32
|
+
<tr><td><code><%= line.sub(/(.*)\/(\w+\.rb):(\d+):in (.*)/, '\1/<b>\2</b>:\3:in <b>\4</b>') %></code></td></tr>
|
33
|
+
<% end %>
|
34
|
+
</p>
|
35
|
+
|
36
|
+
</body>
|
37
|
+
</html>
|