Wiki2Go 1.17.0 → 1.17.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Wiki2Go/Install/templates/admin_pages/edit.txt +9 -2
- data/test/TestDot.rb +10 -5
- data/test/UnitTestFiles.rb +20 -0
- metadata +3 -5
@@ -1,7 +1,12 @@
|
|
1
1
|
<%
|
2
2
|
require 'Wiki2Go/WikiFormatter'
|
3
|
+
|
4
|
+
def show_directory(dirname,label)
|
5
|
+
"<a href=\"#{ @formatter.make_verb_url('admin','editfiles')}?dir=#{CGI::escape(dirname)}\">>#{label}</a>"
|
6
|
+
end
|
7
|
+
|
3
8
|
|
4
|
-
formatter = Wiki2Go::Formatter.new(@web,@config.storage,@config,true,@config.editable?(@web))
|
9
|
+
@formatter = Wiki2Go::Formatter.new(@web,@config.storage,@config,true,@config.editable?(@web))
|
5
10
|
|
6
11
|
message = ''
|
7
12
|
file = @request.parameter('file',nil)
|
@@ -28,7 +33,9 @@
|
|
28
33
|
%>
|
29
34
|
<h3>Edit File</h3>
|
30
35
|
<%= message %>
|
31
|
-
<
|
36
|
+
<hr>
|
37
|
+
<%= show_directory(File.dirname(file),"Back to #{File.dirname(file)}") %>
|
38
|
+
<form action="<%= @formatter.make_verb_url('admin','edit')%>" method="post">
|
32
39
|
<input type="hidden" name="file" value="<%= file %>">
|
33
40
|
<textarea name="text" rows="35" cols="96"><%= content %></textarea><br>
|
34
41
|
<button type="submit" name="update" value="update">
|
data/test/TestDot.rb
CHANGED
@@ -47,7 +47,7 @@ class TestDot < Test::Unit::TestCase
|
|
47
47
|
graphics = Wiki2Go::DotGraphics.new('')
|
48
48
|
processed = graphics.save(@config,@web,content)
|
49
49
|
expected = expected_mapped_file
|
50
|
-
|
50
|
+
assert_same_strings_as_regexp(expected,processed)
|
51
51
|
assert(File.exists?(outfile))
|
52
52
|
end
|
53
53
|
|
@@ -61,10 +61,15 @@ class TestDot < Test::Unit::TestCase
|
|
61
61
|
graphics = Wiki2Go::DotGraphics.new('')
|
62
62
|
processed = graphics.save(@config,@web,content)
|
63
63
|
expected = expected_rewritten_urls
|
64
|
-
|
64
|
+
assert_same_strings_as_regexp(expected,processed)
|
65
65
|
assert(File.exists?(outfile))
|
66
66
|
end
|
67
67
|
|
68
|
+
def test_expr
|
69
|
+
assert "hello 123" =~ Regexp.new(" \\d")
|
70
|
+
assert '<area shape="rect" href="http://wiki2go.nayima.be" title="Hello" alt="" coords="9,7,87,55" />' =~ Regexp.new('<area shape="rect" href="http://wiki2go.nayima.be" title="Hello" alt="" coords="\d,7,87,55" />') ;
|
71
|
+
end
|
72
|
+
|
68
73
|
private
|
69
74
|
|
70
75
|
def content_for_mapping
|
@@ -80,7 +85,7 @@ digraph G {
|
|
80
85
|
return <<-END_OF_EXPECTED
|
81
86
|
<img src="Wiki2Go/graphics/test.gif" border=0 alt="test.gif" usemap="#test">
|
82
87
|
<map id="test" name="test">
|
83
|
-
<area shape="rect" href="http://wiki2go.nayima.be" title="Hello" alt="" coords="
|
88
|
+
<area shape="rect" href="http://wiki2go.nayima.be" title="Hello" alt="" coords="\\d+,\\d+,\\d+,\\d+" />
|
84
89
|
</map>
|
85
90
|
END_OF_EXPECTED
|
86
91
|
end
|
@@ -100,8 +105,8 @@ END_OF_CONTENT
|
|
100
105
|
return <<-END_OF_EXPECTED
|
101
106
|
<img src="Wiki2Go/graphics/test.gif" border=0 alt="test.gif" usemap="#test">
|
102
107
|
<map id="test" name="test">
|
103
|
-
<area shape="rect" href="http://localhost/redirect/Wiki2Go
|
104
|
-
<area shape="rect" href="http://localhost/Wiki2Go/Some/WikiPage.html" title="World" alt="" coords="
|
108
|
+
<area shape="rect" href="http://localhost/redirect/Wiki2Go\\?url=http%3A%2F%2Fwiki2go.nayima.be" title="Hello" alt="" coords="\\d+,\\d+,\\d+,\\d+" />
|
109
|
+
<area shape="rect" href="http://localhost/Wiki2Go/Some/WikiPage.html" title="World" alt="" coords="\\d+,\\d+,\\d+,\\d+" />
|
105
110
|
</map>
|
106
111
|
END_OF_EXPECTED
|
107
112
|
end
|
data/test/UnitTestFiles.rb
CHANGED
@@ -60,10 +60,30 @@ module UnitTestFiles
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def assert_same_regexp(expected_lines,actual_lines,replace=nil)
|
64
|
+
# assert_equal(expected_lines.length,actual_lines.length,"Files to compare have different length")
|
65
|
+
for i in 0...expected_lines.length
|
66
|
+
expected = expected_lines[i]
|
67
|
+
actual = actual_lines[i]
|
68
|
+
if ! replace.nil? then
|
69
|
+
replace.each do |key,value |
|
70
|
+
expected.gsub!(key,value)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
expected_regexp = Regexp.new(expected.strip)
|
75
|
+
assert(actual.strip =~ expected_regexp,"Line #{i}:\n'#{actual}' does not match \n#{expected_regexp.inspect}")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
63
79
|
def assert_same_strings(expected,actual,replace=nil)
|
64
80
|
assert_same_content(expected.split($/),actual.split($/),replace)
|
65
81
|
end
|
66
82
|
|
83
|
+
def assert_same_strings_as_regexp(expected,actual,replace=nil)
|
84
|
+
assert_same_regexp(expected.split($/),actual.split($/),replace)
|
85
|
+
end
|
86
|
+
|
67
87
|
def assert_same_markup_strings(expected,actual,replace=nil)
|
68
88
|
expected = expected.split($/).collect {|line| line.strip }
|
69
89
|
actual = actual.split($/).collect {|line| line.strip }
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.10
|
3
3
|
specification_version: 1
|
4
4
|
name: Wiki2Go
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.17.
|
7
|
-
date: 2005-
|
6
|
+
version: 1.17.1
|
7
|
+
date: 2005-12-09
|
8
8
|
summary: Wiki2Go is a Ruby Wiki
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -26,8 +26,6 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
26
26
|
version: 0.0.0
|
27
27
|
version:
|
28
28
|
platform: ruby
|
29
|
-
signing_key:
|
30
|
-
cert_chain:
|
31
29
|
authors:
|
32
30
|
- Pascal Van Cauwenberghe
|
33
31
|
files:
|