Soks 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +22 -20
- data/bin/soks-create-wiki.rb +11 -2
- data/contrib/{redcloth-3.0.1.rb → redcloth-3.0.3.rb} +161 -66
- data/lib/authenticators.rb +2 -2
- data/lib/helpers/mail2wiki-helper.rb +101 -0
- data/lib/helpers/rss2wiki-helper.rb +48 -0
- data/lib/soks-model.rb +7 -5
- data/lib/soks-servlet.rb +8 -19
- data/lib/soks-view.rb +70 -162
- data/lib/soks.rb +20 -2
- data/templates/default/attachment/favicon.ico +0 -0
- data/templates/default/attachment/logo_thumb.bmp +0 -0
- data/templates/default/attachment/robots.txt +5 -0
- data/templates/default/attachment/stylesheet.css +1 -0
- data/templates/default/content/Attached%20ruby%20logo.textile +1 -0
- data/templates/default/content/Attached%20test%20thing.textile +1 -0
- data/templates/default/content/Automatic%20Summaries.textile +1 -1
- data/templates/default/content/Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20picture%2.textile +1 -0
- data/templates/default/content/Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20appear.textile +1 -1
- data/templates/default/content/Bug%3A%20External%20links%20incorrectly%20include%20trailing%20pu.textile +1 -1
- data/templates/default/content/Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +1 -1
- data/templates/default/content/Bug%3A%20Page%20titles%20cannot%20have%20html%20tags%20in%20them.textile +1 -1
- data/templates/default/content/Bug%3A%20Punctuation%20in%20page%20titles%20still%20problematic.textile +7 -0
- data/templates/default/content/Bug%3A%20Search%20includes%20leading%20and%20trailing%20spaces.textile +1 -0
- data/templates/default/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile +1 -0
- data/templates/default/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile +1 -0
- data/templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +1 -0
- data/templates/default/content/Fixed%20Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20p.textile +34 -0
- data/templates/default/content/Fixed%20Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20.textile +3 -0
- data/templates/default/content/Fixed%20Bug%3A%20External%20links%20incorrectly%20include%20trail.textile +3 -0
- data/templates/default/content/Fixed%20Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +4 -0
- data/templates/default/content/Fixed%20Bug%3A%20Search%20includes%20leading%20and%20trailing%20s.textile +3 -0
- data/templates/default/content/Fixed%20Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fba.textile +3 -0
- data/templates/default/content/Home%20Page.textile +2 -2
- data/templates/default/content/How%20to%20administrate%20this%20wiki.textile +1 -1
- data/templates/default/content/How%20to%20report%20a%20bug.textile +8 -0
- data/templates/default/content/Instructions%20and%20Howtos.textile +1 -0
- data/templates/default/content/Known%20bugs.textile +4 -5
- data/templates/default/content/List%20of%20changes.textile +32 -0
- data/templates/default/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile +1 -0
- data/templates/default/content/Picture%20of%20powered%20by%20ruby%20logo.textile +1 -0
- data/templates/default/content/Planned%20Features.textile +19 -0
- data/templates/default/content/README.textile +22 -20
- data/templates/default/content/Recent%20Changes%20to%20This%20Site.textile +123 -8
- data/templates/default/content/SOKS%20features.textile +5 -1
- data/templates/default/content/Site%20Index.textile +11 -6
- data/templates/default/start.rb +17 -6
- data/templates/default/version.txt +1 -1
- data/templates/default/views/Page_edit.rhtml +7 -6
- data/templates/default/views/Page_meta.rhtml +5 -5
- data/templates/default/views/Page_revisions.rhtml +4 -3
- data/templates/default/views/Page_search_results.rhtml +3 -3
- data/templates/default/views/Page_view.rhtml +2 -2
- data/templates/default/views/UploadPage_edit.rhtml +6 -6
- data/templates/default/views/frame.rhtml +15 -14
- data/templates/instiki/content/Attached%20ruby%20logo.textile +1 -0
- data/templates/instiki/content/Attached%20test%20thing.textile +1 -0
- data/templates/instiki/content/Automatic%20Summaries.textile +1 -1
- data/templates/instiki/content/Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20picture%2.textile +1 -0
- data/templates/instiki/content/Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20appear.textile +1 -1
- data/templates/instiki/content/Bug%3A%20External%20links%20incorrectly%20include%20trailing%20pu.textile +1 -1
- data/templates/instiki/content/Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +1 -1
- data/templates/instiki/content/Bug%3A%20Page%20titles%20cannot%20have%20html%20tags%20in%20them.textile +1 -1
- data/templates/instiki/content/Bug%3A%20Punctuation%20in%20page%20titles%20still%20problematic.textile +7 -0
- data/templates/instiki/content/Bug%3A%20Search%20includes%20leading%20and%20trailing%20spaces.textile +1 -0
- data/templates/instiki/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile +1 -0
- data/templates/instiki/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile +1 -0
- data/templates/instiki/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +1 -0
- data/templates/instiki/content/Fixed%20Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20p.textile +34 -0
- data/templates/instiki/content/Fixed%20Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20.textile +3 -0
- data/templates/instiki/content/Fixed%20Bug%3A%20External%20links%20incorrectly%20include%20trail.textile +3 -0
- data/templates/instiki/content/Fixed%20Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +4 -0
- data/templates/instiki/content/Fixed%20Bug%3A%20Search%20includes%20leading%20and%20trailing%20s.textile +3 -0
- data/templates/instiki/content/Fixed%20Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fba.textile +3 -0
- data/templates/instiki/content/Home%20Page.textile +2 -2
- data/templates/instiki/content/How%20to%20administrate%20this%20wiki.textile +1 -1
- data/templates/instiki/content/How%20to%20report%20a%20bug.textile +8 -0
- data/templates/instiki/content/Instructions%20and%20Howtos.textile +1 -0
- data/templates/instiki/content/Known%20bugs.textile +4 -5
- data/templates/instiki/content/List%20of%20changes.textile +32 -0
- data/templates/instiki/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile +1 -0
- data/templates/instiki/content/Picture%20of%20powered%20by%20ruby%20logo.textile +1 -0
- data/templates/instiki/content/Planned%20Features.textile +19 -0
- data/templates/instiki/content/README.textile +22 -20
- data/templates/instiki/content/Recent%20Changes%20to%20This%20Site.textile +123 -8
- data/templates/instiki/content/SOKS%20features.textile +5 -1
- data/templates/instiki/content/Site%20Index.textile +11 -6
- data/templates/instiki/version.txt +1 -1
- data/templates/rails/content/Attached%20ruby%20logo.textile +1 -0
- data/templates/rails/content/Attached%20test%20thing.textile +1 -0
- data/templates/rails/content/Automatic%20Summaries.textile +1 -1
- data/templates/rails/content/Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20picture%2.textile +1 -0
- data/templates/rails/content/Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20appear.textile +1 -1
- data/templates/rails/content/Bug%3A%20External%20links%20incorrectly%20include%20trailing%20pu.textile +1 -1
- data/templates/rails/content/Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +1 -1
- data/templates/rails/content/Bug%3A%20Page%20titles%20cannot%20have%20html%20tags%20in%20them.textile +1 -1
- data/templates/rails/content/Bug%3A%20Punctuation%20in%20page%20titles%20still%20problematic.textile +7 -0
- data/templates/rails/content/Bug%3A%20Search%20includes%20leading%20and%20trailing%20spaces.textile +1 -0
- data/templates/rails/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile +1 -0
- data/templates/rails/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile +1 -0
- data/templates/rails/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +1 -0
- data/templates/rails/content/Fixed%20Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20p.textile +34 -0
- data/templates/rails/content/Fixed%20Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20.textile +3 -0
- data/templates/rails/content/Fixed%20Bug%3A%20External%20links%20incorrectly%20include%20trail.textile +3 -0
- data/templates/rails/content/Fixed%20Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +4 -0
- data/templates/rails/content/Fixed%20Bug%3A%20Search%20includes%20leading%20and%20trailing%20s.textile +3 -0
- data/templates/rails/content/Fixed%20Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fba.textile +3 -0
- data/templates/rails/content/Home%20Page.textile +2 -2
- data/templates/rails/content/How%20to%20administrate%20this%20wiki.textile +1 -1
- data/templates/rails/content/How%20to%20report%20a%20bug.textile +8 -0
- data/templates/rails/content/Instructions%20and%20Howtos.textile +1 -0
- data/templates/rails/content/Known%20bugs.textile +4 -5
- data/templates/rails/content/List%20of%20changes.textile +32 -0
- data/templates/rails/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile +1 -0
- data/templates/rails/content/Picture%20of%20powered%20by%20ruby%20logo.textile +1 -0
- data/templates/rails/content/Planned%20Features.textile +19 -0
- data/templates/rails/content/README.textile +22 -20
- data/templates/rails/content/Recent%20Changes%20to%20This%20Site.textile +123 -8
- data/templates/rails/content/SOKS%20features.textile +5 -1
- data/templates/rails/content/Site%20Index.textile +11 -6
- data/templates/rails/version.txt +1 -1
- metadata +64 -5
- data/contrib/redcloth-2.0.11.rb +0 -896
- /data/lib/{soks-helpers.rb → helpers/default-helpers.rb} +0 -0
data/lib/soks-model.rb
CHANGED
@@ -60,14 +60,15 @@ class Page
|
|
60
60
|
# Revises the content of this page, creating a new revision class that stores the changes
|
61
61
|
def revise( new_content, author )
|
62
62
|
return nil if new_content == @content
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
#I've abandoned this, because it tends to confuse users.
|
64
|
+
#if the_same_author_recently_revised_this_page( author )
|
65
|
+
# changes = changes_between( previous_content, new_content )
|
66
|
+
# @revisions[-1] = Revision.new( self, @revisions.length - 1, changes , author )
|
67
|
+
#else
|
67
68
|
changes = changes_between( @content, new_content )
|
68
69
|
return nil if changes.empty?
|
69
70
|
@revisions << Revision.new( self, @revisions.length, changes , author )
|
70
|
-
end
|
71
|
+
#end
|
71
72
|
@content = new_content
|
72
73
|
@revisions.last
|
73
74
|
end
|
@@ -115,6 +116,7 @@ class Page
|
|
115
116
|
old_content.split("\n").diff( new_content.split("\n") ).map { |changeset| changeset.map { |change| change.to_a } }
|
116
117
|
end
|
117
118
|
|
119
|
+
# This is no longer used, because I've found it confuses people.
|
118
120
|
def the_same_author_recently_revised_this_page( author )
|
119
121
|
return false if empty?
|
120
122
|
return false unless author == self.author
|
data/lib/soks-servlet.rb
CHANGED
@@ -2,22 +2,7 @@
|
|
2
2
|
require 'authenticators'
|
3
3
|
require 'yaml'
|
4
4
|
|
5
|
-
|
6
|
-
:name => 'test',
|
7
|
-
:description => 'A Soks Wiki',
|
8
|
-
:root_directory => 'soks-wiki',
|
9
|
-
:check_files_every => 60, # Seconds
|
10
|
-
:url => 'http://localhost:8000',
|
11
|
-
:port => 8000,
|
12
|
-
:dont_frame_templates => ['print','rss'],
|
13
|
-
:strict_html_removal => true, # True to prevent users from adding html.
|
14
|
-
:authenticators => [ [ %r{/(view|rss|print|find|meta)/.*}, WEBrick::HTTPAuth::NoAuthenticationRequired.new ],
|
15
|
-
# [ %r{/upload/.*}, WEBrick::HTTPAuth::NotPermitted.new ],
|
16
|
-
# [ %r{/(edit|save)/home page}, WEBrick::HTTPAuth::SiteWidePassword.new('password','You need to enter the site wide password to edit the home page') ],
|
17
|
-
# [ %r{/(view|edit|save)/private.*},WEBrick::HTTPAuth::BasicAuth.new( :UserDB => htpasswd, :Realm => realm ) ], # See webrick documentation
|
18
|
-
[ %r{.*}, WEBrick::HTTPAuth::AskForUserName.new( 'No password, just enter a name') ]
|
19
|
-
]
|
20
|
-
}
|
5
|
+
# Default settings moved to soks.rb
|
21
6
|
|
22
7
|
class WikiServlet < WEBrick::HTTPServlet::AbstractServlet
|
23
8
|
|
@@ -27,6 +12,10 @@ class WikiServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
27
12
|
|
28
13
|
def service( request, response )
|
29
14
|
case request.path
|
15
|
+
# Redirect some requests to static file servlet
|
16
|
+
when '/robots.txt', '/favicon.ico' ;
|
17
|
+
response.set_redirect(WEBrick::HTTPStatus::Found, "#{@wikiurl}/attachment#{request.path}")
|
18
|
+
# If request of the form /verb/pagename then execute the approriate method
|
30
19
|
when /\/(\w+?)\/(.+)/
|
31
20
|
verb, pagename = $1, $2
|
32
21
|
authenticate request, response
|
@@ -35,8 +24,8 @@ class WikiServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
35
24
|
else
|
36
25
|
response.body = @wiki.view( pagename, verb, request.user )
|
37
26
|
end
|
38
|
-
when /\/(.+)/ ; redirect( response, $1, 'view' ) # No
|
39
|
-
when "/"
|
27
|
+
when /\/(.+)/ ; redirect( response, $1, 'view' ) # No verb given
|
28
|
+
when "/" ; redirect( response, "Home Page", 'view' ) # No page or verb given
|
40
29
|
end
|
41
30
|
|
42
31
|
response['Content-Type'] ||= "text/html"
|
@@ -63,7 +52,7 @@ class WikiServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
63
52
|
end
|
64
53
|
|
65
54
|
def doFind( request, response, pagename, person )
|
66
|
-
response.body = @wiki.find( request.query['regex'] )
|
55
|
+
response.body = @wiki.find( request.query['regex'].strip )
|
67
56
|
end
|
68
57
|
|
69
58
|
def doSave( request, response, pagename, person )
|
data/lib/soks-view.rb
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# This module is used to extend each erb page to provide helper methods
|
2
|
+
module ErbHelper
|
3
|
+
|
4
|
+
def url( name, view = 'view' )
|
5
|
+
"#{$SETTINGS[:url]}/#{view}/#{name}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def file( name )
|
9
|
+
"#{$SETTINGS[:url]}/attachment/#{name}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# This class records all the links between pages
|
1
14
|
class Links
|
2
15
|
def initialize
|
3
16
|
@links = Hash.new
|
@@ -110,130 +123,55 @@ end
|
|
110
123
|
# * Automaticlly links anytime the title of another page appears in the text
|
111
124
|
# * Automatically links things that look like email addresses and urls
|
112
125
|
class WikiRedCloth < RedCloth
|
113
|
-
|
114
|
-
|
126
|
+
|
127
|
+
RULES = [:refs_soks_bracketed_link, :textile, :markdown, :inline_soks ]
|
128
|
+
|
129
|
+
def initialize( wiki, page, string )
|
115
130
|
@wiki, @page = wiki, page
|
116
|
-
@
|
131
|
+
@internal_links_from_page = []
|
132
|
+
super(insert_sub_strings( string.dup ), [ :no_span_caps])
|
133
|
+
end
|
134
|
+
|
135
|
+
def to_html
|
136
|
+
super( *RULES )
|
117
137
|
end
|
118
138
|
|
119
|
-
def
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
@urlrefs = {}
|
127
|
-
@shelf = []
|
128
|
-
@internal_links_from_page = [] # NEW
|
129
|
-
|
130
|
-
no_textile text
|
131
|
-
insert_sub_strings text # NEW
|
132
|
-
no_textile text # NEW (again in case any sub pages had it, BODGE doesn't work recursively)
|
133
|
-
clean_white_space text
|
134
|
-
pre_list = rip_offtags text # NEW wasteful to duplicate, but reduces overloading
|
135
|
-
|
136
|
-
hide_tags text # NEW
|
137
|
-
hide_textile_links text # NEW
|
138
|
-
hide_textile_image_tags text # NEW
|
139
|
-
inline_soks_bracketed_link text # NEW
|
140
|
-
inline_soks_external_link text # NEW
|
141
|
-
inline_soks_automatic_link text # NEW
|
142
|
-
|
143
|
-
@wiki.links.set_links_from( @page, @internal_links_from_page ) # NEW
|
144
|
-
unhide_textile text # NEW
|
145
|
-
smooth_offtags text, pre_list # NEW wasteful to duplicate
|
146
|
-
|
147
|
-
incoming_entities text
|
148
|
-
get_refs text
|
149
|
-
inline text
|
150
|
-
|
151
|
-
unless @lite
|
152
|
-
fold text
|
153
|
-
block text
|
154
|
-
end
|
155
|
-
|
156
|
-
retrieve text
|
157
|
-
|
158
|
-
text.gsub!( /<\/?notextile>/, '' )
|
159
|
-
text.gsub!( /x%x%/, '&' )
|
160
|
-
text.gsub!( /<br \/>/, "<br />\n" )
|
161
|
-
text.strip!
|
162
|
-
|
163
|
-
clean_html text if $SETTINGS[:strict_html_removal]
|
164
|
-
|
139
|
+
def inline_soks( text )
|
140
|
+
hide_html_links text
|
141
|
+
hide_html_tags text
|
142
|
+
inline_soks_external_link text
|
143
|
+
inline_soks_automatic_link text
|
144
|
+
unhide text
|
145
|
+
@wiki.links.set_links_from( @page, @internal_links_from_page )
|
165
146
|
text
|
166
147
|
end
|
167
148
|
|
168
149
|
private
|
150
|
+
|
151
|
+
def hide_html_links( text )
|
152
|
+
text.gsub!(/<a.*?<\/a.*?>/i) { |m| hide m }
|
153
|
+
end
|
169
154
|
|
170
|
-
def
|
171
|
-
text.gsub!(/<.*?>/) { |m|
|
155
|
+
def hide_html_tags( text )
|
156
|
+
text.gsub!(/<.*?>/) { |m| hide m }
|
172
157
|
end
|
158
|
+
|
159
|
+
def unhide( text )
|
160
|
+
hidden.each_with_index do |r, i|
|
161
|
+
text.gsub!( / --!!#{ i + 1 }!!-- /, r )
|
162
|
+
end
|
163
|
+
text
|
164
|
+
end
|
173
165
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
'b' => nil,
|
183
|
-
'pre' => nil,
|
184
|
-
'kbd' => nil,
|
185
|
-
'code' => ['lang'],
|
186
|
-
'cite' => nil,
|
187
|
-
'strong' => nil,
|
188
|
-
'em' => nil,
|
189
|
-
'ins' => nil,
|
190
|
-
'sup' => nil,
|
191
|
-
'sub' => nil,
|
192
|
-
'del' => nil,
|
193
|
-
'table' => [ 'class', 'style' ],
|
194
|
-
'tr' => [ 'class', 'style' ],
|
195
|
-
'td' => [ 'class', 'style' ],
|
196
|
-
'th' => [ 'class', 'style' ],
|
197
|
-
'ol' => nil,
|
198
|
-
'ul' => nil,
|
199
|
-
'li' => nil,
|
200
|
-
'p' => [ 'class', 'style' ],
|
201
|
-
'h1' => nil,
|
202
|
-
'h2' => nil,
|
203
|
-
'h3' => nil,
|
204
|
-
'h4' => nil,
|
205
|
-
'h5' => nil,
|
206
|
-
'h6' => nil,
|
207
|
-
'blockquote' => ['cite'],
|
208
|
-
'div' => [ 'class', 'id', 'style' ],
|
209
|
-
'span' => [ 'class', 'id','style'],
|
210
|
-
}
|
166
|
+
def hidden
|
167
|
+
@hidden ||= []
|
168
|
+
end
|
169
|
+
|
170
|
+
def hide( text )
|
171
|
+
hidden << text
|
172
|
+
" --!!#{hidden.length}!!-- "
|
173
|
+
end
|
211
174
|
|
212
|
-
## Method which cleans the String of HTML tags
|
213
|
-
## and attributes outside of the allowed list.
|
214
|
-
def clean_html( text, tags = BASIC_TAGS )
|
215
|
-
text.gsub!( /<(\/*)(\w+)([^>\/]*?)( *\/*)>/ ) do
|
216
|
-
raw = $~
|
217
|
-
tag = raw[2].downcase
|
218
|
-
if tags.has_key? tag
|
219
|
-
pcs = [tag]
|
220
|
-
tags[tag].each do |prop|
|
221
|
-
['"', "'", ''].each do |q|
|
222
|
-
q2 = ( q != '' ? q : '\s' )
|
223
|
-
if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i
|
224
|
-
pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\""
|
225
|
-
break
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end if tags[tag]
|
229
|
-
"<#{raw[1]}#{pcs.join " "}#{raw[4]}>"
|
230
|
-
else
|
231
|
-
" "
|
232
|
-
end
|
233
|
-
end
|
234
|
-
text
|
235
|
-
end
|
236
|
-
|
237
175
|
def insert_sub_strings( text, count = 0 )
|
238
176
|
return text if count > 5 # Stops us getting locked into a cycle if people mess up the insert
|
239
177
|
text.gsub!(/\[\[\s*insert (.+?)\]\]/i) do |m|
|
@@ -244,17 +182,17 @@ class WikiRedCloth < RedCloth
|
|
244
182
|
end
|
245
183
|
insert_sub_strings( "#{inserted_page.textile}\n", count + 1 )
|
246
184
|
end
|
247
|
-
|
185
|
+
text
|
248
186
|
end
|
249
187
|
|
250
188
|
def inline_soks_external_link( text )
|
251
|
-
text.gsub!(/http
|
252
|
-
text.gsub!(/https
|
253
|
-
text.gsub!(/www
|
254
|
-
text.gsub!(/[A-Za-z0-9.]+?@[A-Za-z0-9.]
|
189
|
+
text.gsub!(/http:\/\/\S*\w\/?/i) { |m| link m }
|
190
|
+
text.gsub!(/https:\/\/\S*\w\/?/i) { |m| link m }
|
191
|
+
text.gsub!(/www\.\S*\w\/?/i) { |m| link( "http://#{m}", m) }
|
192
|
+
text.gsub!(/[A-Za-z0-9.]+?@[A-Za-z0-9.]*[A-Za-z]/) { |m| link( "mailto:#{m}", m) }
|
255
193
|
end
|
256
194
|
|
257
|
-
def
|
195
|
+
def refs_soks_bracketed_link( text )
|
258
196
|
text.gsub!(/\[\[\s*(.*?)\s*(|=>\s*(.*?)\s*)\]\]/) do |m|
|
259
197
|
title, pagename = $1, $3
|
260
198
|
pagename ||= title
|
@@ -281,58 +219,24 @@ class WikiRedCloth < RedCloth
|
|
281
219
|
@internal_links_from_page << @wiki.page( pagename )
|
282
220
|
css_class ||= ''
|
283
221
|
end
|
284
|
-
link(
|
222
|
+
link( url_for(pagename), title, css_class || 'missing')
|
285
223
|
end
|
286
224
|
|
287
225
|
def link( url, title = url, css_class = '' )
|
288
226
|
shelve "<a href='#{url}' class='#{css_class}'>#{title}</a>"
|
289
227
|
end
|
290
228
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
# a pagename (e.g. /edit/home page ) in which case the command should not
|
295
|
-
# be encoded.
|
296
|
-
def url_encode_pagename( pagename )
|
297
|
-
if pagename =~ /\/(\w+)\/(.*)/
|
298
|
-
return "/#{$1}/#{$2.url_encode}"
|
299
|
-
end
|
300
|
-
return pagename.url_encode
|
301
|
-
end
|
302
|
-
|
303
|
-
def hide_textile_image_tags( text )
|
304
|
-
text.gsub!( IMAGE_RE ) do |match|
|
305
|
-
hide_textile match
|
306
|
-
end
|
307
|
-
text
|
308
|
-
end
|
309
|
-
|
310
|
-
def hide_textile_links( text )
|
311
|
-
text.gsub!( LINK_RE ) do |match|
|
312
|
-
hide_textile match
|
313
|
-
end
|
314
|
-
text
|
315
|
-
end
|
316
|
-
|
317
|
-
def unhide_textile( text )
|
318
|
-
hidden_textile.each_with_index do |r, i|
|
319
|
-
text.gsub!( " <$%#{ i + 1 }%$> ", r )
|
320
|
-
end
|
321
|
-
text
|
322
|
-
end
|
323
|
-
|
324
|
-
def hide_textile( text )
|
325
|
-
hidden_textile << text
|
326
|
-
" <$%#{hidden_textile.length}%$> "
|
327
|
-
end
|
328
|
-
|
329
|
-
def hidden_textile
|
330
|
-
@hidden_textile_links ||= []
|
229
|
+
def url_for( pagename, view = 'view' )
|
230
|
+
view, pagename = $1, $2 if pagename =~ /\/(\w+)\/(.*)/
|
231
|
+
"#{$SETTINGS[:url]}/#{view}/#{pagename}"
|
331
232
|
end
|
332
233
|
|
333
234
|
end
|
334
235
|
|
335
236
|
class View
|
237
|
+
|
238
|
+
include ErbHelper
|
239
|
+
|
336
240
|
attr_reader :rollingmatch, :links
|
337
241
|
|
338
242
|
def initialize( wiki, name )
|
@@ -377,7 +281,7 @@ class View
|
|
377
281
|
|
378
282
|
def move( oldpagename, person, newpagename )
|
379
283
|
unless newpagename == oldpagename
|
380
|
-
@wiki.revise( newpagename, "#{$MESSAGES[:content_moved_from]} [[#{
|
284
|
+
@wiki.revise( newpagename, "#{$MESSAGES[:content_moved_from]} [[#{oldpagename}]]", 'AutomaticPageMover')
|
381
285
|
@wiki.revise( newpagename, @wiki.page( oldpagename ).content, person)
|
382
286
|
@wiki.revise( oldpagename, "#{$MESSAGES[:content_moved_to]} [[#{newpagename}]]", person)
|
383
287
|
end
|
@@ -414,7 +318,11 @@ class View
|
|
414
318
|
def erb_filename( klass, view )
|
415
319
|
$stderr.puts "Looking for #{path_for( klass, view)}"
|
416
320
|
until File.exists?( path_for( klass, view ) )
|
417
|
-
|
321
|
+
if klass.superclass
|
322
|
+
klass = klass.superclass
|
323
|
+
else
|
324
|
+
raise WEBrick::HTTPStatus::NotFound
|
325
|
+
end
|
418
326
|
end
|
419
327
|
path_for( klass, view )
|
420
328
|
end
|
data/lib/soks.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'webrick'
|
4
4
|
require 'erb'
|
5
|
-
require 'redcloth-
|
5
|
+
require 'redcloth-3.0.3'
|
6
6
|
require 'ftools'
|
7
7
|
require 'diff/lcs'
|
8
8
|
require 'diff/lcs/array'
|
@@ -15,7 +15,25 @@ require 'soks-storage'
|
|
15
15
|
require 'soks-model'
|
16
16
|
require 'soks-view'
|
17
17
|
require 'soks-servlet'
|
18
|
-
require '
|
18
|
+
require 'helpers/default-helpers'
|
19
19
|
|
20
20
|
Thread.abort_on_exception = true
|
21
21
|
Socket.do_not_reverse_lookup = true
|
22
|
+
|
23
|
+
# These are the default settings. Can be overriden in the call to soks-servlet.rb#start_wiki
|
24
|
+
$SETTINGS = {
|
25
|
+
:name => 'test',
|
26
|
+
:description => 'A Soks Wiki',
|
27
|
+
:root_directory => 'soks-wiki',
|
28
|
+
:check_files_every => 60, # Seconds
|
29
|
+
:url => 'http://localhost:8000',
|
30
|
+
:port => 8000,
|
31
|
+
:dont_frame_templates => ['print','rss'],
|
32
|
+
:strict_html_removal => true, # True to prevent users from adding html.
|
33
|
+
:authenticators => [ [ %r{/(view|rss|print|find|meta)/.*}, WEBrick::HTTPAuth::NoAuthenticationRequired.new ],
|
34
|
+
# [ %r{/upload/.*}, WEBrick::HTTPAuth::NotPermitted.new ],
|
35
|
+
# [ %r{/(edit|save)/home page}, WEBrick::HTTPAuth::SiteWidePassword.new('password','You need to enter the site wide password to edit the home page') ],
|
36
|
+
# [ %r{/(view|edit|save)/private.*},WEBrick::HTTPAuth::BasicAuth.new( :UserDB => htpasswd, :Realm => realm ) ], # See webrick documentation
|
37
|
+
[ %r{.*}, WEBrick::HTTPAuth::AskForUserName.new( 'No password, just enter a name') ]
|
38
|
+
]
|
39
|
+
}
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
page deleted
|
@@ -0,0 +1 @@
|
|
1
|
+
content moved to [[Attached ruby logo]]
|
@@ -61,7 +61,7 @@ AutomaticSummary.new( wiki, {
|
|
61
61
|
|
62
62
|
You might also use it to construct a basic blog class:
|
63
63
|
<code>
|
64
|
-
AutomaticSummary.new( wiki, {
|
64
|
+
AutomaticSummary.new( wiki, {
|
65
65
|
:regexp_for_title => /^Blog:.*/ # Match all pages starting with blog
|
66
66
|
:pagename => 'Recent Blog Entries',
|
67
67
|
:author => 'Automatic Blog Watcher',
|
@@ -0,0 +1 @@
|
|
1
|
+
content moved to [[Fixed Bug: [FATAL] When renaming upload / picture pages]]
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
content moved to [[Fixed Bug: Duplicate links-to a page sometimes appear]]
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
content moved to [[Fixed Bug: External links incorrectly include trailing punctuation]]
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
content moved to [[Fixed Bug: No robots.txt or favicon.ico]]
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
page deleted
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Not sure if this is general, but if using apache to proxy forward onto the webrick server (as occurs on http://soks.counsell.org ), punctuation in the title sometimes stops apache from forwarding the request.
|
2
|
+
|
3
|
+
E.g. Bug: [FATAL] When renaming upload / picture pages exists, but apache doesn't even pass the request
|
4
|
+
|
5
|
+
To be specific:
|
6
|
+
|
7
|
+
Slashes, and colons definitely work, quesion marks and square brackets definitely don't. Others sometimes work.
|
@@ -0,0 +1 @@
|
|
1
|
+
content moved to [[Fixed Bug: Search includes leading and trailing spaces]]
|
data/templates/default/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
content moved to [[Bug: Search includes leading and trailing spaces]]
|
data/templates/default/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
content moved to [[Fixed Bug: no superclass method `_deprecated_base64]]
|
data/templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Page inserts like @[ [insert other page]]@ should not insert another page if they are surrounded by notextile tags (or code, or pre?).
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Fixed in v-0-0-5
|
2
|
+
|
3
|
+
<pre>
|
4
|
+
ERROR NoMethodError: undefined method `pagename' for #<Wiki:0x2ae7c94c>
|
5
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-view.rb:441:in `send'
|
6
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-view.rb:441:in `method_missing'
|
7
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-view.rb:380:in `move'
|
8
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-servlet.rb:92:in `doUpload'
|
9
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-servlet.rb:34:in `send'
|
10
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-servlet.rb:34:in `service'
|
11
|
+
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:97:in `service'
|
12
|
+
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:58:in `run'
|
13
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:153:in `start_thread'
|
14
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:147:in `start'
|
15
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:147:in `start_thread'
|
16
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:97:in `start'
|
17
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `each'
|
18
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `start'
|
19
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'
|
20
|
+
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'
|
21
|
+
/usr/local/lib/ruby/gems/1.8/gems/Soks-0.0.4/lib/soks-servlet.rb:143:in `start_wiki'
|
22
|
+
start.rb:26:in `start'
|
23
|
+
</pre>
|
24
|
+
|
25
|
+
Fix is that line 380 of Soks-view.rb should be changed from:
|
26
|
+
<code>
|
27
|
+
@wiki.revise( newpagename, "#{$MESSAGES[:content_moved_from]} [[#{pagename}]]", 'AutomaticPageMover')
|
28
|
+
<code>
|
29
|
+
To:
|
30
|
+
<code>
|
31
|
+
@wiki.revise( newpagename, "#{$MESSAGES[:content_moved_from]} [[#{oldpagename}]]", 'AutomaticPageMover')
|
32
|
+
<code>
|
33
|
+
|
34
|
+
Will fix in the next release
|
@@ -0,0 +1,3 @@
|
|
1
|
+
On the right hand side of a page are normally links to other pages that link to this page. In some cases these might have several copies of the same link.
|
2
|
+
|
3
|
+
Not seen this recently. May have been fixed when added the code to make sure two threads couldn't edit the same page at the same time.
|
@@ -2,7 +2,7 @@ h1. Congratulations, you have installed SOKS
|
|
2
2
|
|
3
3
|
Welcome to Soks. It is yet another wiki, written in ruby. Please bear in mind that it is alpha, and therefore do not trust your mission critical sites to it. Please feel free to use and adapt, the soks licence is free and liberal (although if you feel like contributing towards a new mac for the author that would be apreciated).
|
4
4
|
|
5
|
-
p{background:yellow;padding:10px;}. A limited selection of help and bug reports are included here. For more information, and to share experiences, please visit http://soks.counsell.org
|
5
|
+
p{background:yellow;padding:10px;}. A limited selection of help and bug reports are included here. For more information, and to share experiences, please visit http://soks.counsell.org. If you are upgrading, you may wish to look at the list of changes.
|
6
6
|
|
7
7
|
[[insert SOKS features]]
|
8
8
|
|
@@ -13,7 +13,7 @@ p{background:yellow;padding:10px;}. A limited selection of help and bug reports
|
|
13
13
|
h2. Feedback
|
14
14
|
|
15
15
|
* Please send me your feedback. tamc@rubyforge.com.
|
16
|
-
* Or
|
16
|
+
* Or add to the list of known bugs.
|
17
17
|
* To keep track of developments, you may wish to subscribe to the mailing list at http://rubyforge.org/projects/soks.
|
18
18
|
|
19
19
|
[[insert picture of a pair of soks]]
|
@@ -0,0 +1,8 @@
|
|
1
|
+
h1. How to report a bug
|
2
|
+
|
3
|
+
I really appreciate bug reports.
|
4
|
+
|
5
|
+
Please go to http://soks.counsell.org and create a new page whose title starts with bug:, e.g. @bug: does not make tea@.
|
6
|
+
|
7
|
+
In that page, please give as much information as you can and leave some contact details.
|
8
|
+
|
@@ -5,12 +5,11 @@ p{font-size: x-small;}. Known bugs was created automatically from pages whose ti
|
|
5
5
|
<automaticsummary>
|
6
6
|
|
7
7
|
* [[ Bug: Does not make use of if-modified-since request headers ]] revised on 2005 Jan 25 18:23 by AutomaticImport
|
8
|
-
* [[ Bug: Duplicate links-to a page sometimes appear ]] revised on 2005 Jan 25 18:23 by AutomaticImport
|
9
|
-
* [[ Bug: External links incorrectly include trailing punctuation ]] revised on 2005 Jan 25 18:23 by AutomaticImport
|
10
8
|
* [[ Bug: Uploads are not password protected ]] revised on 2005 Jan 25 18:23 by AutomaticImport
|
11
|
-
* [[ Bug: Page titles cannot have html tags in them ]] revised on 2005 Jan 26 08:11 by tamc2
|
12
|
-
* [[ Bug: No robots.txt or favicon.ico ]] revised on 2005 Jan 26 08:12 by tamc2
|
13
9
|
* [[ Bug: GEM limits title lengths ]] revised on 2005 Jan 26 08:55 by tamc2
|
14
|
-
|
10
|
+
* [[ Bug: Punctuation in page titles still problematic ]] revised on 2005 Feb 12 10:08 by tamc2
|
11
|
+
* [[ Bug: notextile does not prevent page inserts ]] revised on 2005 Feb 12 12:00 by tamc2
|
15
12
|
|
16
13
|
</automaticsummary>
|
14
|
+
|
15
|
+
How to report a bug
|