Wiki2Go 1.17.5 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/Wiki2Go_firewall_blacklist.rb +8 -0
- data/bin/Wiki2Go_make_cvs_repository.rb +1 -0
- data/bin/Wiki2Go_make_site.rb +1 -2
- data/bin/Wiki2Go_update_site.rb +1 -2
- data/lib/Web2Go/CGIRequest.rb +8 -2
- data/lib/Web2Go/CGIResponse.rb +17 -14
- data/lib/Web2Go/MockRequest.rb +12 -2
- data/lib/Web2Go/MockResponse.rb +10 -7
- data/lib/Web2Go/WebrickRequest.rb +106 -101
- data/lib/Web2Go/WebrickResponse.rb +4 -8
- data/lib/Wiki2Go/BlackList.rb +48 -25
- data/lib/Wiki2Go/DotGraphics.rb +1 -1
- data/lib/Wiki2Go/FileStorage.rb +266 -266
- data/lib/Wiki2Go/HTMLFormatter.rb +28 -0
- data/lib/Wiki2Go/Install/config/chonqed_blacklist.txt +418 -0
- data/lib/Wiki2Go/Install/config/passwords +1 -1
- data/lib/Wiki2Go/Install/config/url_blacklist.txt +3855 -0
- data/lib/Wiki2Go/Install/make_repository.rb +32 -26
- data/lib/Wiki2Go/Install/make_site.rb +197 -111
- data/lib/Wiki2Go/Install/site/error.html +1 -1
- data/lib/Wiki2Go/Install/site/robots.txt +10 -1
- data/lib/Wiki2Go/Install/site/style.css +129 -64
- data/lib/Wiki2Go/Install/templates/admin.htm +1 -1
- data/lib/Wiki2Go/Install/templates/admin_pages/edit.txt +2 -1
- data/lib/Wiki2Go/Install/templates/admin_pages/format_for_fck.txt +31 -0
- data/lib/Wiki2Go/Install/templates/admin_pages/passwords.txt +1 -1
- data/lib/Wiki2Go/Install/templates/edit.htm +62 -46
- data/lib/Wiki2Go/Install/templates/full_footer.htm +31 -33
- data/lib/Wiki2Go/Install/templates/header.htm +0 -1
- data/lib/Wiki2Go/Install/templates/menu.htm +29 -0
- data/lib/Wiki2Go/Install/templates/pagelist.htm +46 -43
- data/lib/Wiki2Go/Install/templates/simple_footer.htm +20 -16
- data/lib/Wiki2Go/Install/templates/versionlist.htm +52 -40
- data/lib/Wiki2Go/Install/templates/view.htm +46 -29
- data/lib/Wiki2Go/Install/templates/wikiedit.htm +63 -0
- data/lib/Wiki2Go/Install/wiki/delete.png +0 -0
- data/lib/Wiki2Go/Install/wiki/style.css +133 -63
- data/lib/Wiki2Go/LineFormatter.rb +345 -197
- data/lib/Wiki2Go/Page.rb +16 -3
- data/lib/Wiki2Go/PrivateWikiConfig.rb +5 -5
- data/lib/Wiki2Go/PublicWikiConfig.rb +83 -37
- data/lib/Wiki2Go/ReadWriteWikiConfig.rb +8 -8
- data/lib/Wiki2Go/Server.rb +6 -1
- data/lib/Wiki2Go/SpamFilter.rb +32 -41
- data/lib/Wiki2Go/Web.rb +10 -3
- data/lib/Wiki2Go/Wiki2Go.rb +301 -94
- data/lib/Wiki2Go/Wiki2GoConfig.rb +87 -6
- data/lib/Wiki2Go/Wiki2GoServlet.rb +66 -12
- data/lib/Wiki2Go/WikiFormatter.rb +60 -30
- data/lib/Wiki2Go/cgi/diff.rb +20 -0
- data/lib/Wiki2Go/cgi/secure/log_rss.rb +21 -0
- data/lib/Wiki2Go/cgi/sidebyside.rb +20 -0
- data/lib/Wiki2Go/cgi/wikiedit.rb +20 -0
- data/lib/Wiki2Go/firewall_blacklist.rb +88 -0
- data/test/All.rb +5 -2
- data/test/TestBlackList.rb +70 -14
- data/test/TestConfig.rb +5 -5
- data/test/TestDiff.rb +95 -0
- data/test/TestFormatter.rb +14 -16
- data/test/TestHTMLFormatter.rb +37 -0
- data/test/TestInstall.rb +70 -27
- data/test/TestLineFormatter.rb +71 -15
- data/test/TestRSS.rb +8 -7
- data/test/TestRepository.rb +50 -0
- data/test/TestServer.rb +3 -8
- data/test/TestSpamFilter.rb +33 -1
- data/test/TestStorage.rb +11 -0
- data/test/TestWeb.rb +2 -2
- data/test/TestWiki2Go.rb +766 -166
- data/test/TestWiki2GoServlet.rb +1122 -524
- data/test/UnitTestFiles.rb +7 -3
- data/test/Wiki2GoConfigForTest.rb +40 -6
- data/test/checksite.rb +17 -50
- data/test/test_firewall_blacklist.rb +131 -0
- data/test/test_page.rb +45 -0
- data/test/testdata/Registration.rbl.txt +7 -0
- data/test/testdata/config/url_blacklist.txt +38822 -0
- data/test/testdata/expected_changes.html +1 -2
- data/test/testdata/expected_edit.html +108 -59
- data/test/testdata/expected_full_rss.xml +2 -2
- data/test/testdata/expected_out.html +97 -61
- data/test/testdata/expected_put.html +88 -53
- data/test/testdata/expected_save.html +88 -52
- data/test/testdata/expected_savehtml.html +88 -52
- data/test/testdata/expected_search.html +68 -53
- data/test/testdata/expected_upload.html +88 -53
- data/test/testdata/expected_versions.html +97 -82
- data/test/testdata/expected_view.html +97 -61
- data/test/testdata/firewall/iptables.config +37 -0
- data/test/testdata/firewall/user_blacklist.txt +162 -0
- data/test/testdata/logs/wiki.log +652 -0
- data/test/testdata/logs/wiki.log.0 +113 -0
- data/test/testdata/logs/wiki.log.1 +113 -0
- data/test/testdata/logs/wiki.log.2 +113 -0
- data/test/testdata/logs/wiki.log.3 +115 -0
- data/test/testdata/logs/wiki.log.4 +5 -0
- data/test/testdata/logs/wiki.log.5 +7 -0
- data/test/testdata/logs/wiki.log.6 +5 -0
- data/test/testdata/logs/wiki.log.7 +118 -0
- data/test/testdata/logs/wiki.log.8 +12 -0
- data/test/testdata/site/html/Xpday/rss.xml +53 -103
- data/test/testdata/texts/Bugs/FrontPage.txt +6 -0
- data/test/testdata/texts/Bugs/NoHidden.spam +17850 -0
- data/test/testdata/texts/Bugs/PairProgrammingParties.spam +102 -0
- data/test/testdata/texts/Bugs/PairProgrammingParties.txt +99 -0
- metadata +53 -7
- data/test/TestMail.rb +0 -29
- data/test/gc.log +0 -2
data/test/TestFormatter.rb
CHANGED
@@ -11,19 +11,17 @@ require "Wiki2Go/WhiteList"
|
|
11
11
|
require "Wiki2GoConfigForTest"
|
12
12
|
require "UnitTestFiles"
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
module TestFormatter_local
|
15
|
+
class MockStorage
|
16
|
+
attr_accessor :find_it
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def load_whitelist
|
22
|
-
return Wiki2Go::WhiteList.new(Array.new)
|
23
|
-
end
|
18
|
+
def exists?(path)
|
19
|
+
return @find_it
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
22
|
+
def initialize
|
23
|
+
@find_it = false
|
24
|
+
end
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
@@ -139,8 +137,8 @@ END_OF_EXPECTED
|
|
139
137
|
|
140
138
|
def test_view_link_with_parameters
|
141
139
|
formatter = makeFormatter
|
142
|
-
formatted = formatter.view_version_link("Xpday", "aPage", "aLabel",
|
143
|
-
assert_equal('<a href="/view/Xpday/aPage?
|
140
|
+
formatted = formatter.view_version_link("Xpday", "aPage", "aLabel",2)
|
141
|
+
assert_equal('<a href="/view/Xpday/aPage?version=2">aLabel</a>',formatted)
|
144
142
|
|
145
143
|
end
|
146
144
|
|
@@ -453,7 +451,7 @@ END_OF_LOADSATAGS
|
|
453
451
|
end
|
454
452
|
|
455
453
|
def makeFormatter
|
456
|
-
storage = MockStorage.new
|
454
|
+
storage = TestFormatter_local::MockStorage.new
|
457
455
|
storage.find_it = true
|
458
456
|
config = TestWiki2GoConfig.new
|
459
457
|
web = Wiki2Go::Web.from_page_url("http://webserver:8081/view/Xpday/Page",'view',config)
|
@@ -461,7 +459,7 @@ END_OF_LOADSATAGS
|
|
461
459
|
end
|
462
460
|
|
463
461
|
def makePublicFormatter
|
464
|
-
storage = MockStorage.new
|
462
|
+
storage = TestFormatter_local::MockStorage.new
|
465
463
|
storage.find_it = true
|
466
464
|
config = PublicTestWiki2GoConfig.new
|
467
465
|
web = Wiki2Go::Web.from_page_url("http://webserver:8081/view/Xpday/Page",'view',config)
|
@@ -469,7 +467,7 @@ END_OF_LOADSATAGS
|
|
469
467
|
end
|
470
468
|
|
471
469
|
def make_single_wiki_Formatter
|
472
|
-
storage = MockStorage.new
|
470
|
+
storage = TestFormatter_local::MockStorage.new
|
473
471
|
storage.find_it = true
|
474
472
|
config = PublicTestWiki2GoConfig.new
|
475
473
|
config.multi_wiki = false
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require 'Wiki2Go/HTMLFormatter'
|
6
|
+
require "Wiki2Go/Web"
|
7
|
+
require "Wiki2Go/FileStorage"
|
8
|
+
require "Wiki2GoConfigForTest"
|
9
|
+
require "UnitTestFiles"
|
10
|
+
|
11
|
+
class TestHTMLFormatter < Test::Unit::TestCase
|
12
|
+
|
13
|
+
include UnitTestFiles
|
14
|
+
|
15
|
+
def test_formatter_doesnt_touch_wikiwords
|
16
|
+
config = PublicTestWiki2GoConfig.new
|
17
|
+
config.multi_wiki = false
|
18
|
+
web = Wiki2Go::Web.from_page_url("http://webserver:8081/view/Page",'view',config)
|
19
|
+
|
20
|
+
formatter = Wiki2Go::HTMLFormatter.new(web,nil,config,true,false)
|
21
|
+
|
22
|
+
output = formatter.format_page("Don't *touch* the WikiWord !")
|
23
|
+
assert_equal "Don't <STRONG>touch</STRONG> the WikiWord !",output
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_formatter_doesnt_touch_forced_internal_links
|
27
|
+
config = PublicTestWiki2GoConfig.new
|
28
|
+
config.multi_wiki = false
|
29
|
+
web = Wiki2Go::Web.from_page_url("http://webserver:8081/view/Page",'view',config)
|
30
|
+
|
31
|
+
formatter = Wiki2Go::HTMLFormatter.new(web,nil,config,true,false)
|
32
|
+
|
33
|
+
output = formatter.format_page("Don't *touch* the {forced link@Somepage} !")
|
34
|
+
assert_equal "Don't <STRONG>touch</STRONG> the {forced link@Somepage} !",output
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/test/TestInstall.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
|
2
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
|
4
3
|
|
5
4
|
require 'test/unit'
|
5
|
+
require 'rubygems'
|
6
6
|
|
7
7
|
require "Wiki2Go/Install/make_site"
|
8
8
|
require "Wiki2Go/Install/make_repository"
|
@@ -11,6 +11,49 @@ require 'UnitTestFiles'
|
|
11
11
|
|
12
12
|
include FileUtils
|
13
13
|
|
14
|
+
class UpdatedFiles
|
15
|
+
def initialize(directory)
|
16
|
+
@directory = directory
|
17
|
+
@files = {}
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns an array of all filenames that have been updated since the last call
|
21
|
+
def updated_files
|
22
|
+
changed = []
|
23
|
+
sources = all_files_with_mtime
|
24
|
+
|
25
|
+
# Changed == a file did not exist before or its timestamp has changed
|
26
|
+
sources.each do |filename,mtime|
|
27
|
+
existing = @files[filename]
|
28
|
+
if existing.nil? || existing < mtime then
|
29
|
+
changed << filename
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Changed == a file existed before, but no longer
|
34
|
+
@files.each do |filename,mtime|
|
35
|
+
changed << filename unless sources.has_key?(filename)
|
36
|
+
end
|
37
|
+
|
38
|
+
@files = sources
|
39
|
+
|
40
|
+
changed
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def all_files_with_mtime
|
46
|
+
path = File.join(@directory,'**','*')
|
47
|
+
found = Dir.glob(path)
|
48
|
+
files = {}
|
49
|
+
found.each do |filename|
|
50
|
+
files[filename] = File.mtime(filename) if File.file?(filename)
|
51
|
+
end
|
52
|
+
|
53
|
+
files
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
14
57
|
class TestInstall < Test::Unit::TestCase
|
15
58
|
|
16
59
|
def test_public_make_site
|
@@ -64,37 +107,30 @@ class TestInstall < Test::Unit::TestCase
|
|
64
107
|
assert_wiki_structure_exists(wiki_dir,'Wiki2Go')
|
65
108
|
assert_wiki_structure_exists(wiki_dir,'Admin')
|
66
109
|
end
|
67
|
-
|
68
|
-
def
|
69
|
-
wiki_dir = scratch_dir('
|
110
|
+
|
111
|
+
def test_update_doesnt_change_install
|
112
|
+
wiki_dir = scratch_dir('formathtml')
|
70
113
|
args = ['-s', 'wiki2go.nayima.be' , '-w' , 'Wiki2Go' , '-t' , 'private', '-d' , wiki_dir]
|
71
114
|
Wiki2Go::Install.make_site(args)
|
72
|
-
args = ['-t' , 'private', '-d' , wiki_dir]
|
73
|
-
Wiki2Go::Install.update_site(args)
|
74
|
-
assert_wiki_structure_exists(wiki_dir,'Wiki2Go')
|
75
|
-
end
|
76
115
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
args = ['-d', repository_dir , '-u' ,user, '-g' , user, '-m' , 'readwrite']
|
83
|
-
Wiki2Go::RepositoryMaker.create(args)
|
84
|
-
assert File.exists?(repository_dir)
|
116
|
+
files = UpdatedFiles.new(wiki_dir)
|
117
|
+
changed = files.updated_files
|
118
|
+
|
119
|
+
args = [ '-d' , wiki_dir]
|
120
|
+
Wiki2Go::Install.update_site(args)
|
85
121
|
|
86
|
-
|
87
|
-
|
122
|
+
# An update should not change existing files, except...
|
123
|
+
# CGI .rb scripts may be updated
|
124
|
+
# Except CgiOptions.rb, put a new version in CgiOptions.rb.new so that the user can merge new functionalities
|
125
|
+
changed = files.updated_files
|
126
|
+
really_changed = changed.reject {|name| name =~ /\.new$/ || name =~/\.rb$/ }
|
127
|
+
assert_equal 0,really_changed.length,"Update should NOT change files but updated : #{really_changed.join(' and ')}"
|
128
|
+
assert !changed.find {|name| name =~ /CgiOptions\.rb$/ }
|
129
|
+
assert changed.find {|name| name =~ /CgiOptions\.rb\.new$/ }
|
88
130
|
|
89
|
-
|
90
|
-
added = Wiki2Go::RepositoryMaker.addwiki(args)
|
91
|
-
added = Wiki2Go::RepositoryMaker.addwiki(args)
|
92
|
-
assert_equal 0,added.length
|
93
|
-
args = ['-d', repository_dir , '-w' ,wiki_dir]
|
94
|
-
Wiki2Go::RepositoryMaker.updatewiki(args)
|
131
|
+
assert_wiki_structure_exists(wiki_dir,'Wiki2Go')
|
95
132
|
end
|
96
133
|
|
97
|
-
|
98
134
|
private
|
99
135
|
|
100
136
|
def scratch_dir(type)
|
@@ -107,8 +143,10 @@ class TestInstall < Test::Unit::TestCase
|
|
107
143
|
end
|
108
144
|
|
109
145
|
def assert_wiki_structure_exists(wiki_dir,wiki_name)
|
110
|
-
|
146
|
+
assert_exists(wiki_dir,'site','scripts')
|
111
147
|
assert(File.exists?(File.join(wiki_dir,'site','scripts','secure')))
|
148
|
+
assert(File.exists?(File.join(wiki_dir,'site','html',wiki_name)))
|
149
|
+
assert(!File.exists?(File.join(wiki_dir,'site','fckeditor')))
|
112
150
|
assert(File.exists?(File.join(wiki_dir,'texts')))
|
113
151
|
assert(File.exists?(File.join(wiki_dir,'templates')))
|
114
152
|
assert(File.exists?(File.join(wiki_dir,'config')))
|
@@ -116,5 +154,10 @@ class TestInstall < Test::Unit::TestCase
|
|
116
154
|
assert(File.exists?(File.join(wiki_dir,'texts',wiki_name)))
|
117
155
|
assert(File.exists?(File.join(wiki_dir,'templates',wiki_name)))
|
118
156
|
end
|
157
|
+
|
158
|
+
def assert_exists(wiki_dir,*dirs)
|
159
|
+
dir = File.join(wiki_dir,dirs)
|
160
|
+
assert("#{dir} must exist",File.exists?(dir))
|
161
|
+
end
|
119
162
|
end
|
120
163
|
|
data/test/TestLineFormatter.rb
CHANGED
@@ -18,10 +18,6 @@ class LineMockStorage
|
|
18
18
|
return @find_it
|
19
19
|
end
|
20
20
|
|
21
|
-
def load_whitelist
|
22
|
-
return Wiki2Go::WhiteList.new(Array.new)
|
23
|
-
end
|
24
|
-
|
25
21
|
def initialize
|
26
22
|
@find_it = false
|
27
23
|
end
|
@@ -62,14 +58,39 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
62
58
|
def test_accept_tags_with_attributes
|
63
59
|
formatter = makeFormatter
|
64
60
|
|
65
|
-
formatted = formatter.format_line("<
|
66
|
-
assert_equal("<
|
61
|
+
formatted = formatter.format_line("<img src=\"http://www.xp.be\"/>")
|
62
|
+
assert_equal("<img src=\"http://www.xp.be\"/>",formatted)
|
67
63
|
|
68
|
-
formatted = formatter.format_line("<
|
69
|
-
assert_equal("<
|
64
|
+
formatted = formatter.format_line("<div name=\"hello>\"/>")
|
65
|
+
assert_equal("<div name=\"hello>\"/>",formatted)
|
70
66
|
end
|
67
|
+
|
68
|
+
def test_handle_anchor_links
|
69
|
+
formatter = makePublicFormatter
|
70
|
+
|
71
|
+
formatted = formatter.format_line("<a href=\"http://www.xp.be\" />")
|
72
|
+
assert_equal("<a href=\"http://www.xp.be\" target=\"_blank\" />",formatted)
|
73
|
+
|
74
|
+
formatted = formatter.format_line("<a href=\"http://www.xp.be\" target=\"_blank\" />")
|
75
|
+
assert_equal("<a href=\"http://www.xp.be\" target=\"_blank\" />",formatted)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_accept_technorati_links
|
79
|
+
formatter = makePublicFormatter
|
71
80
|
|
72
|
-
|
81
|
+
formatted = formatter.format_line("<a href=\"http://hello\" rel=\"tag\"/>")
|
82
|
+
assert_equal("<a href=\"http://hello\" target=\"_blank\" rel=\"tag\"/>",formatted)
|
83
|
+
|
84
|
+
formatted = formatter.format_line("<a href=\"hello>\" rel=\"tag\"/>")
|
85
|
+
assert_equal("<a href=\"hello>\" rel=\"tag\"/>",formatted)
|
86
|
+
|
87
|
+
formatted = formatter.format_line("{technorati:agileopen}")
|
88
|
+
assert_equal("<a href=\"http://technorati.com/tag/agileopen\" target=\"_blank\" rel=\"tag\">agileopen</a>",formatted)
|
89
|
+
formatted = formatter.format_line("{Agile Open@technorati:agileopen}")
|
90
|
+
assert_equal("<a href=\"http://technorati.com/tag/agileopen\" target=\"_blank\" rel=\"tag\">Agile Open</a>",formatted)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_formatter_entities
|
73
94
|
formatter = makeFormatter
|
74
95
|
|
75
96
|
formatted = formatter.format_line(" < & > ")
|
@@ -145,7 +166,21 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
145
166
|
formatted = formatter.format_line(" a link http://www.xp.be/logo.GIF works ")
|
146
167
|
assert_equal(" a link <img src=\"http://www.xp.be/logo.GIF\" alt=\"logo\"> works ",formatted)
|
147
168
|
end
|
148
|
-
|
169
|
+
|
170
|
+
# Bug on XP Day 2006 sessions wiki
|
171
|
+
def test_bug_link_not_formatted
|
172
|
+
formatter = makePublicFormatter
|
173
|
+
|
174
|
+
formatted = formatter.format_line("I hope to play the {Leadership game@http://www.xpday.org/wiki/index.php/The_Leadership_Game%2C_a_pair_coaching_experiment} ")
|
175
|
+
assert_equal('I hope to play the <a href="http://www.xpday.org/wiki/index.php/The_Leadership_Game%2C_a_pair_coaching_experiment" target="_blank">Leadership game</a> ',formatted)
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_bug_save_may_not_redirect_to_static_page_of_rbl_page
|
179
|
+
formatter = makePublicFormatter
|
180
|
+
formatted = formatter.view_url('Xpday','Registration.rbl')
|
181
|
+
assert_equal '/view/Xpday/Registration.rbl',formatted
|
182
|
+
end
|
183
|
+
|
149
184
|
def test_links_with_redirect
|
150
185
|
formatter = makeFormatter
|
151
186
|
|
@@ -157,7 +192,7 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
157
192
|
|
158
193
|
|
159
194
|
formatted = formatter.format_line(" a mail link mailto:pvc@nayima.be works ")
|
160
|
-
assert_equal(" a mail link <a href=\"/view/Xpday/MailFormattingRules\" onmouseover=\"this.href='mai' + 'lto:' + 'pvc' + '@' + 'nayima.be'\">pvc</a> works ",formatted)
|
195
|
+
assert_equal(" a mail link <a href=\"/view/Xpday/MailFormattingRules\" rel=\"nofollow\" onmouseover=\"this.href='mai' + 'lto:' + 'pvc' + '@' + 'nayima.be'\">pvc</a> works ",formatted)
|
161
196
|
|
162
197
|
formatted = formatter.format_line(" a link %test@http://SomePage% works ")
|
163
198
|
assert_equal(" a link <a href=\"/redirect/Xpday?url=http%3A%2F%2FSomePage\" rel=\"nofollow\" target=\"_blank\">test</a> works ",formatted)
|
@@ -189,7 +224,7 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
189
224
|
assert_equal(" a link <img src=\"http://www.xp.be/logo.gif\" alt=\"logo\"> works ",formatted)
|
190
225
|
|
191
226
|
formatted = formatter.format_line(" a mail link mailto:pvc@nayima.be works ")
|
192
|
-
assert_equal(" a mail link <a href=\"/Xpday/MailFormattingRules.html\" onmouseover=\"this.href='mai' + 'lto:' + 'pvc' + '@' + 'nayima.be'\">pvc</a> works ",formatted)
|
227
|
+
assert_equal(" a mail link <a href=\"/Xpday/MailFormattingRules.html\" rel=\"nofollow\" onmouseover=\"this.href='mai' + 'lto:' + 'pvc' + '@' + 'nayima.be'\">pvc</a> works ",formatted)
|
193
228
|
|
194
229
|
formatted = formatter.format_line(" a link %test@http://SomePage% works ")
|
195
230
|
assert_equal(" a link <a href=\"http://SomePage\" target=\"_blank\">test</a> works ",formatted)
|
@@ -216,6 +251,12 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
216
251
|
assert_equal(" a link http:// does not generate a link ",formatted)
|
217
252
|
end
|
218
253
|
|
254
|
+
def test_bug_labeled_link_to_named_wiki
|
255
|
+
formatter = makePublicFormatter
|
256
|
+
formatted = formatter.format_line(" a link {Previous year@Xpday2007:FrontPage} works ")
|
257
|
+
assert_equal(" a link <a href=\"/Xpday2007/FrontPage.html\">Previous year</a> works ",formatted)
|
258
|
+
end
|
259
|
+
|
219
260
|
def perform_test_sister_wikis(formatter)
|
220
261
|
formatted = formatter.format_line(" a link {xpnl:BesprokenOnderwerpen} works ")
|
221
262
|
assert_equal(" a link <a href=\"http://www.xpnl.org/Wiki/BesprokenOnderwerpen\" target=\"_blank\">xpnl:BesprokenOnderwerpen</a> works ",formatted)
|
@@ -266,6 +307,9 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
266
307
|
formatted = formatter.format_line("{microsoft.gif}")
|
267
308
|
assert_equal("<img src=\"/html/Xpday/microsoft.gif\" border=0 alt=\"microsoft\" >",formatted)
|
268
309
|
|
310
|
+
formatted = formatter.format_line("{Wicked Witch.gif}")
|
311
|
+
assert_equal("<img src=\"/html/Xpday/Wicked%20Witch.gif\" border=0 alt=\"Wicked Witch\" >",formatted)
|
312
|
+
|
269
313
|
formatted = formatter.format_line("{paper.pdf}")
|
270
314
|
assert_equal("<a href=\"/html/Xpday/paper.pdf\" target=\"_blank\">paper.pdf</a>",formatted)
|
271
315
|
|
@@ -297,13 +341,19 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
297
341
|
|
298
342
|
end
|
299
343
|
|
344
|
+
def test_no_target_for_img_tags
|
345
|
+
formatter = makePublicFormatter
|
346
|
+
formatted = formatter.format_line("Dont add a target to <img src=\"http://blog.nayima.be/html/logo2005small.gif\" align=left border=0 alt=\"XP Day Benelux 2005 logo\"> tags")
|
347
|
+
assert_equal("Dont add a target to <img src=\"http://blog.nayima.be/html/logo2005small.gif\" align=left border=0 alt=\"XP Day Benelux 2005 logo\"> tags",formatted)
|
348
|
+
end
|
349
|
+
|
300
350
|
def test_tilde_in_url
|
301
351
|
formatter = makePublicFormatter
|
302
352
|
formatted = formatter.format_line("Read about %weblog@http://www.xs4all.nl/~mmmevers/blog% or %homepage@http://www.xs4all.nl/~mmmevers% in Dutch")
|
303
353
|
assert_equal("Read about <a href=\"http://www.xs4all.nl/~mmmevers/blog\" target=\"_blank\">weblog</a> or <a href=\"http://www.xs4all.nl/~mmmevers\" target=\"_blank\">homepage</a> in Dutch",formatted)
|
304
354
|
end
|
305
355
|
|
306
|
-
|
356
|
+
def test_underscore_in_url
|
307
357
|
formatter = makeFormatter
|
308
358
|
formatted = formatter.format_line("<p align=center>{http://www.agileopen.com@agileopen_logo.jpg}</p>")
|
309
359
|
assert_equal('<p align=center><a href="/redirect/Xpday?url=http%3A%2F%2Fwww.agileopen.com" rel="nofollow" target="_blank"><img src="/html/Xpday/agileopen_logo.jpg" border=0 alt="agileopen_logo" ></a></p>',formatted)
|
@@ -365,7 +415,7 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
365
415
|
|
366
416
|
storage.find_it = false
|
367
417
|
formatted = formatter.format_line(" a SomeLink ")
|
368
|
-
assert_equal(" a SomeLink<a href=\"/
|
418
|
+
assert_equal(" a SomeLink<a href=\"/wikiedit/Xpday/SomeLink\" rel=\"nofollow\">?</a> ",formatted)
|
369
419
|
|
370
420
|
end
|
371
421
|
|
@@ -510,7 +560,13 @@ class TestLineFormatter < Test::Unit::TestCase
|
|
510
560
|
assert_equal('<a href="/view/Xpday/FrontPage.rbl">The dynamic page</a>',formatted)
|
511
561
|
end
|
512
562
|
|
513
|
-
|
563
|
+
def test_stack_too_deep_bug
|
564
|
+
|
565
|
+
too_long = "<a href=\" \"> </a>" * 5000
|
566
|
+
formatter = makeFormatter
|
567
|
+
formatted = formatter.format_line(too_long)
|
568
|
+
assert_equal too_long,formatted
|
569
|
+
end
|
514
570
|
|
515
571
|
|
516
572
|
|
data/test/TestRSS.rb
CHANGED
@@ -3,10 +3,10 @@ $:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
|
|
3
3
|
|
4
4
|
require 'test/unit'
|
5
5
|
|
6
|
+
require "Wiki2Go/Wiki2Go"
|
6
7
|
require "Wiki2Go/WikiFormatter"
|
7
8
|
require "Wiki2Go/Web"
|
8
9
|
require "Wiki2Go/FileStorage"
|
9
|
-
require "Wiki2Go/Wiki2Go"
|
10
10
|
require "Wiki2GoConfigForTest"
|
11
11
|
require "UnitTestFiles"
|
12
12
|
|
@@ -66,7 +66,7 @@ class TestRSS < Test::Unit::TestCase
|
|
66
66
|
wiki = Wiki2Go::Wiki.new(config)
|
67
67
|
web = Wiki2Go::Web.from_page_url("http://agilesystems.nayima.be/view/Xpday/Page","view",config)
|
68
68
|
rss = wiki.generate_rss(web,changes)
|
69
|
-
#
|
69
|
+
# puts rss
|
70
70
|
assert_same_markup_strings(expected_rss_with_absolute_urls,rss,{ '$DATE$' => Time.new.gmtime.strftime("%d %B %Y %H:%M GMT") })
|
71
71
|
end
|
72
72
|
|
@@ -117,15 +117,16 @@ END_OF_BEFORE_ITEMS_XML
|
|
117
117
|
<author>author1</author>
|
118
118
|
<pubDate>13 September 2004 22:19 GMT</pubDate>
|
119
119
|
<link>http://agilesystems.nayima.be/view/Xpday/title1</link>
|
120
|
-
<guid isPermaLink="true">Xpday/title1</guid>
|
121
|
-
<description><![CDATA[content1
|
120
|
+
<guid isPermaLink="true">http://agilesystems.nayima.be/view/Xpday/title1</guid>
|
121
|
+
<description><![CDATA[content1
|
122
|
+
<img src="http://agilesystems.nayima.be/html/Xpday/image.gif" border=0 alt="image" >]]></description>
|
122
123
|
</item>
|
123
124
|
<item>
|
124
125
|
<title>title2</title>
|
125
126
|
<author>author2</author>
|
126
127
|
<pubDate>12 September 2004 20:26 GMT</pubDate>
|
127
128
|
<link>http://agilesystems.nayima.be/view/Xpday/title2</link>
|
128
|
-
<guid isPermaLink="true">Xpday/title2</guid>
|
129
|
+
<guid isPermaLink="true">http://agilesystems.nayima.be/view/Xpday/title2</guid>
|
129
130
|
<description><![CDATA[content2]]></description>
|
130
131
|
</item>
|
131
132
|
</channel>
|
@@ -136,7 +137,7 @@ end
|
|
136
137
|
def errorlog
|
137
138
|
return <<-END_OF_LOG
|
138
139
|
I, [2005-08-13 18:19:54#1567] INFO -- : >> save.rb {"Wiki2Go_user"=>["Pascal"]}
|
139
|
-
E, [2005-08-13 18:19:54#1567] ERROR -- : Blacklisted user 192.168.0.30 because of the following urls: http://blog.nayima.be
|
140
|
+
E, [2005-08-13 18:19:54#1567] ERROR -- : <Error:> Blacklisted user 192.168.0.30 because of the following urls: http://blog.nayima.be
|
140
141
|
I, [2005-08-13 18:20:54#1567] INFO -- : << save {"Wiki2Go_user"=>["Pascal"]}
|
141
142
|
I, [2005-08-13 18:20:54#1567] INFO -- : Response cookies = {"Wiki2Go_user"=>["Pascal"]}
|
142
143
|
I, [2005-08-13 18:26:41#1592] INFO -- : Request cookies = {"Wiki2Go_user"=>["Pascal"]}
|
@@ -167,7 +168,7 @@ return <<-END_OF_EXPECTED
|
|
167
168
|
<link>http://agilesystems.nayima.be/scripts/secure/admin/show_log</link>
|
168
169
|
<author>Wiki2Go</author>
|
169
170
|
<pubDate>13 August 2005 18:19 GMT</pubDate>
|
170
|
-
<description><![CDATA[Blacklisted user 192.168.0.30 because of the following urls: http://blog.nayima.be]]></description>
|
171
|
+
<description><![CDATA[<Error:> Blacklisted user 192.168.0.30 because of the following urls: http://blog.nayima.be]]></description>
|
171
172
|
</item>
|
172
173
|
<item>
|
173
174
|
<title>errormessage</title>
|