ruwiki 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/Readme.rubygems +3 -3
  2. data/Readme.tarfile +3 -3
  3. data/bin/ruwiki_convert +1 -3
  4. data/bin/ruwiki_service.rb +1 -3
  5. data/bin/ruwiki_servlet +1 -3
  6. data/data/Default/ProjectIndex.ruwiki +2 -2
  7. data/data/Ruwiki/Antispam.ruwiki +26 -8
  8. data/data/Ruwiki/BugTracking.ruwiki +2 -2
  9. data/data/Ruwiki/ChangeLog.ruwiki +11 -2
  10. data/data/Ruwiki/Configuring_Ruwiki.ruwiki +2 -2
  11. data/data/Ruwiki/Extending_Ruwiki.ruwiki +2 -2
  12. data/data/Ruwiki/LicenseAndAuthorInfo.ruwiki +1 -1
  13. data/data/Ruwiki/ProjectIndex.ruwiki +3 -3
  14. data/data/Ruwiki/Roadmap.ruwiki +2 -2
  15. data/data/Ruwiki/RuwikiTemplatingLibrary.ruwiki +2 -2
  16. data/data/Ruwiki/RuwikiUtilities.ruwiki +6 -6
  17. data/data/Ruwiki/SandBox.ruwiki +1 -1
  18. data/data/Ruwiki/To_Do.ruwiki +2 -2
  19. data/data/Ruwiki/TroubleShooting.ruwiki +3 -3
  20. data/data/Ruwiki/WikiFeatures.ruwiki +1 -1
  21. data/data/Ruwiki/WikiMarkup.ruwiki +2 -2
  22. data/data/Tutorial/AddingPages.ruwiki +1 -1
  23. data/data/Tutorial/AddingProjects.ruwiki +1 -1
  24. data/data/Tutorial/ProjectIndex.ruwiki +2 -2
  25. data/data/Tutorial/SandBox.ruwiki +1 -1
  26. data/data/clean.uri +37 -0
  27. data/data/hostip.banned +5 -5
  28. data/data/hostip.readonly +2 -2
  29. data/lib/ruwiki.rb +8 -4
  30. data/lib/ruwiki/backend.rb +6 -6
  31. data/lib/ruwiki/backend/flatfiles.rb +1 -2
  32. data/lib/ruwiki/page.rb +3 -3
  33. data/lib/ruwiki/utils.rb +1 -3
  34. data/lib/ruwiki/utils/manager.rb +12 -3
  35. data/lib/ruwiki/utils/servletrunner.rb +4 -3
  36. data/lib/ruwiki/wiki.rb +18 -1
  37. data/lib/ruwiki/wiki/tokens.rb +95 -100
  38. data/lib/ruwiki/wiki/tokens/00default.rb +14 -16
  39. data/ruwiki.pkg +0 -0
  40. data/tests/tc_tokens.rb +17 -17
  41. metadata +4 -3
data/Readme.rubygems CHANGED
@@ -1,16 +1,16 @@
1
- Ruwiki 0.9.0
1
+ Ruwiki 0.9.1
2
2
  ------------
3
3
  Ruwiki is a simple, extensible Wiki-clone written in Ruby. It supports both
4
4
  CGI and WEBrick interfaces, templates, and CSS formatting. This Wiki differs
5
5
  from most other Wikis in that it supports project namespaces, so that two
6
6
  topics may be named the same for differing projects without colliding or
7
7
  having to resort to odd naming conventions. Please see the ::Ruwiki project in
8
- the running Wiki for more information. Ruwiki 0.9.0 has German and Spanish
8
+ the running Wiki for more information. Ruwiki 0.9.1 has German and Spanish
9
9
  translations available.
10
10
 
11
11
  Upgrading
12
12
  ---------
13
- Ruwiki 0.9.0 has a flatfile format that is incompatible with older versions of
13
+ Ruwiki 0.9.1 has a flatfile format that is incompatible with older versions of
14
14
  Ruwiki. If you are upgrading from one of these versions, you must use the
15
15
  bin/convert. The simple case will be (assuming that your data files are in
16
16
  ./data):
data/Readme.tarfile CHANGED
@@ -1,16 +1,16 @@
1
- Ruwiki 0.9.0
1
+ Ruwiki 0.9.1
2
2
  ------------
3
3
  Ruwiki is a simple, extensible Wiki-clone written in Ruby. It supports both
4
4
  CGI and WEBrick interfaces, templates, and CSS formatting. This Wiki differs
5
5
  from most other Wikis in that it supports project namespaces, so that two
6
6
  topics may be named the same for differing projects without colliding or
7
7
  having to resort to odd naming conventions. Please see the ::Ruwiki project in
8
- the running Wiki for more information. Ruwiki 0.9.0 has German and Spanish
8
+ the running Wiki for more information. Ruwiki 0.9.1 has German and Spanish
9
9
  translations available.
10
10
 
11
11
  Upgrading
12
12
  ---------
13
- Ruwiki 0.9.0 has a flatfile format that is incompatible with versions of
13
+ Ruwiki 0.9.1 has a flatfile format that is incompatible with versions of
14
14
  Ruwiki older than 0.8.0. If you are upgrading from one of these versions, you
15
15
  must use the bin/convert. The simplest case will be (assuming that your data
16
16
  files are in ./data):
data/bin/ruwiki_convert CHANGED
@@ -7,9 +7,7 @@
7
7
  #
8
8
  # Licensed under the same terms as Ruby.
9
9
  #
10
- # This file may be renamed to change the URI for the wiki.
11
- #
12
- # $Id: ruwiki_convert,v 1.1 2004/11/28 02:26:57 austin Exp $
10
+ # $Id: ruwiki_convert,v 1.2 2004/12/21 01:37:58 austin Exp $
13
11
  #++
14
12
 
15
13
  # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
@@ -7,9 +7,7 @@
7
7
  #
8
8
  # Licensed under the same terms as Ruby.
9
9
  #
10
- # This file may be renamed to change the URI for the wiki.
11
- #
12
- # $Id: ruwiki_service.rb,v 1.6 2004/11/26 12:18:46 austin Exp $
10
+ # $Id: ruwiki_service.rb,v 1.7 2004/12/21 01:37:58 austin Exp $
13
11
  #++
14
12
 
15
13
  # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
data/bin/ruwiki_servlet CHANGED
@@ -7,9 +7,7 @@
7
7
  #
8
8
  # Licensed under the same terms as Ruby.
9
9
  #
10
- # This file may be renamed to change the URI for the wiki.
11
- #
12
- # $Id: ruwiki_servlet,v 1.5 2004/11/28 02:26:57 austin Exp $
10
+ # $Id: ruwiki_servlet,v 1.6 2004/12/21 01:37:58 austin Exp $
13
11
  #++
14
12
 
15
13
  # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
@@ -10,7 +10,7 @@ page!content: = Ruwiki
10
10
  (UTF-8) is required. There are German and Spanish localisations of the
11
11
  messages included with the Ruwiki distribution.
12
12
 
13
- The current version is 0.9.0. Enhancements and changes include:
13
+ The current version is 0.9.1. Enhancements and changes include:
14
14
  * a deployment system, whereby Ruwiki deployments can be installed from a package manager like that used for RPA (rpa-base) or \RubyGems (see Ruwiki::RuwikiUtilities);
15
15
  * support for Ruwiki as a Windows service on NT, 2000, XP, and 2003 systems;
16
16
  * demotion of YAML and Marshal storage types to formats of the Flatfiles storage type;
@@ -45,5 +45,5 @@ properties!title: ProjectIndex
45
45
  properties!topic: ProjectIndex
46
46
  properties!version: 1
47
47
  ruwiki!content-version: 2
48
- ruwiki!version: 0.9.0
48
+ ruwiki!version: 0.9.1
49
49
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0 Antispam
1
+ page!content: = Ruwiki 0.9.1 Antispam
2
2
  Wiki-spam, like email spam, is a major problem. Ruwiki is going to have
3
3
  extensive configurable tools for fighting spam. As it is, there are
4
4
  several tools built into Ruwiki to assist in the fight against these
@@ -13,15 +13,21 @@ page!content: = Ruwiki 0.9.0 Antispam
13
13
  that are generated by \[ruby-talk:12345] will not be redirected through
14
14
  Google, but direct links will be.
15
15
 
16
- In future versions of Ruwiki, it will be possible to configure \URIs to
17
- be excluded from the redirect code, but it is not possible to do so at
18
- this time.
16
+ New to Ruwiki 0.9.1, \URIs may be whitelisted with
17
+ <tt>./data/clean.uri</tt>. The list of \URIs in <tt>clean.uri</tt> are
18
+ &#8220;extended&#8221; Ruby regular expressions, one optional
19
+ expression to a line. Spaces are not significant and comments are
20
+ allowed. If you want to recognise a space in your regular expression,
21
+ do so either with a character class ([ ]) or the whitespace
22
+ meta-character (\s). Hash marks must be escaped (\#) or they will be
23
+ treated as comment markers. Blank or comment-only lines are ignored.
24
+ All other lines will be joined together.
19
25
 
20
26
  As noted, this will not necessarily reduce wiki spam, but it will deny
21
27
  spammers the entire benefit of spamming a wiki implemented with Ruwiki.
22
28
 
23
29
  == Reacting to Spammers and Robots
24
- Ruwiki 0.9.0 includes the ability to present alternative versions of
30
+ Ruwiki 0.9.1 includes the ability to present alternative versions of
25
31
  itself to certain user agents and/or IP addresses based on a list. In
26
32
  the future, both the lists and the faces presented will be configurable
27
33
  (highly configurable, at that -- watch this space), but in this version
@@ -34,7 +40,7 @@ page!content: = Ruwiki 0.9.0 Antispam
34
40
  both malign and benign robots, it is up to the administrators of the
35
41
  wiki to ensure that they are kept up to date.
36
42
 
37
- The lists themselves are &ldquo;extended&rdquo; Ruby regular
43
+ The lists themselves are &#8220;extended&#8221; Ruby regular
38
44
  expressions, one optional expression to a line. Spaces are not
39
45
  significant and comments are allowed. If you want to recognise a space
40
46
  in your regular expression, do so either with a character class ([ ]) or
@@ -56,10 +62,22 @@ page!content: = Ruwiki 0.9.0 Antispam
56
62
  ./data/agents.readonly
57
63
  ./data/hostip.banned
58
64
  ./data/hostip.readonly
65
+ page!footer:
66
+ page!header:
67
+ properties!create-date: 1103593880
68
+ properties!creator:
69
+ properties!creator-ip: UNKNOWN
70
+ properties!edit-comment:
71
+ properties!edit-date: 1103593880
72
+ properties!editable: false
73
+ properties!editor:
74
+ properties!editor-ip: 127.0.0.1
75
+ properties!entropy: 0.0
76
+ properties!html-headers:
77
+ properties!indexable: false
59
78
  properties!project: Ruwiki
60
79
  properties!title: Antispam
61
80
  properties!topic: Antispam
62
81
  properties!version: 1
63
82
  ruwiki!content-version: 2
64
- ruwiki!version: 0.9.0
65
- properties!editable: false
83
+ ruwiki!version: 0.9.1
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0 Bug Tracking
1
+ page!content: = Ruwiki 0.9.1 Bug Tracking
2
2
  This page is for tracking bugs in Ruwiki. Only bugs from recent
3
3
  distributions are tracked. In addition to this source-based bug
4
4
  tracking, there is the [http://rubyforge.org RubyForge]
@@ -29,5 +29,5 @@ properties!title: BugTracking
29
29
  properties!topic: BugTracking
30
30
  properties!version: 1
31
31
  ruwiki!content-version: 2
32
- ruwiki!version: 0.9.0
32
+ ruwiki!version: 0.9.1
33
33
  properties!editable: false
@@ -1,6 +1,15 @@
1
- page!content: = Ruwiki 0.9.0 ChangeLog
1
+ page!content: = Ruwiki 0.9.1 ChangeLog
2
2
  Uncompleted to-do items can be found in To_Do. Bugs in Ruwiki are
3
3
  tracked in BugTracking.
4
+
5
+ == 0.9.1
6
+ * Fixed a couple of problems with the Ruwiki deployment system surrounding Win32::Service management.
7
+ * Added a Google redirect exclusion list to the configuration.
8
+ * Fixed a problem where last lines of code blocks may not be properly marked.
9
+ * Changed relevant timestamps to UTC.
10
+ * Fixed a problem with Google redirection not working.
11
+ * Fixed a problem with some pages not being displayed as links in the topic listing; only affected some pages created with the Wikipedia form of naming.
12
+ * Fixed a problem with tokens being redefined. Once a token is defined, its class is frozen; the token reader will silently ignore TypeError exceptions.
4
13
 
5
14
  == 0.9.0
6
15
  * Created a Ruwiki deployment system. Various steps were required to accomplish this:
@@ -98,5 +107,5 @@ properties!title: ChangeLog
98
107
  properties!topic: ChangeLog
99
108
  properties!version: 1
100
109
  ruwiki!content-version: 2
101
- ruwiki!version: 0.9.0
110
+ ruwiki!version: 0.9.1
102
111
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Configuring Ruwiki 0.9.0
1
+ page!content: = Configuring Ruwiki 0.9.1
2
2
  Ruwiki is configured similarly as both a CGI and a \WEBrick servlet.
3
3
  The biggest distinction is that because the Wiki servlet is created
4
4
  after the \WEBrick server is created (during the dispatch to the
@@ -147,5 +147,5 @@ properties!title: Configuring_Ruwiki
147
147
  properties!topic: Configuring_Ruwiki
148
148
  properties!version: 1
149
149
  ruwiki!content-version: 2
150
- ruwiki!version: 0.9.0
150
+ ruwiki!version: 0.9.1
151
151
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Extending Ruwiki 0.9.0
1
+ page!content: = Extending Ruwiki 0.9.1
2
2
  Ruwiki is relatively easily extended to support new features. There are
3
3
  four primary ways in which Ruwiki can be extended or modified by the
4
4
  end user: templates, translating Ruwiki messages and labels, markup
@@ -313,5 +313,5 @@ properties!title: Extending_Ruwiki
313
313
  properties!topic: Extending_Ruwiki
314
314
  properties!version: 1
315
315
  ruwiki!content-version: 2
316
- ruwiki!version: 0.9.0
316
+ ruwiki!version: 0.9.1
317
317
  properties!editable: false
@@ -26,5 +26,5 @@ properties!title: LicenseAndAuthorInfo
26
26
  properties!topic: LicenseAndAuthorInfo
27
27
  properties!version: 1
28
28
  ruwiki!content-version: 2
29
- ruwiki!version: 0.9.0
29
+ ruwiki!version: 0.9.1
30
30
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0
1
+ page!content: = Ruwiki 0.9.1
2
2
  This is the \ProjectIndex page for Ruwiki. For any given project, the
3
3
  \ProjectIndex topic will be the default topic for plain project links.
4
4
 
@@ -18,7 +18,7 @@ page!content: = Ruwiki 0.9.0
18
18
  The YAML backend requires Ruby 1.8.2 preview 3 or later.
19
19
 
20
20
  == Upgrading
21
- Ruwiki 0.9.0 has a flatfile format that is incompatible with versions
21
+ Ruwiki 0.9.1 has a flatfile format that is incompatible with versions
22
22
  of Ruwiki older than Ruwiki 0.8.0. If you are upgrading from one of
23
23
  these versions, you must use the bin/ruwiki_convert. The simple case
24
24
  will be (assuming that your data files are in ./data):
@@ -80,5 +80,5 @@ properties!title: ProjectIndex
80
80
  properties!topic: ProjectIndex
81
81
  properties!version: 1
82
82
  ruwiki!content-version: 2
83
- ruwiki!version: 0.9.0
83
+ ruwiki!version: 0.9.1
84
84
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0: The Road Ahead
1
+ page!content: = Ruwiki 0.9.1: The Road Ahead
2
2
  This roadmap is accurate as of the release of 0.9.0.
3
3
 
4
4
  What lies ahead for Ruwiki? The To_Do list will give a detailed list
@@ -221,5 +221,5 @@ properties!title: Roadmap
221
221
  properties!topic: Roadmap
222
222
  properties!version: 1
223
223
  ruwiki!content-version: 2
224
- ruwiki!version: 0.9.0
224
+ ruwiki!version: 0.9.1
225
225
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0 Templating
1
+ page!content: = Ruwiki 0.9.1 Templating
2
2
  Ruwiki uses a heavily modified version of the \RDoc
3
3
  &ldquo;cheap-n-cheerful&rdquo; HTML page template system. This a
4
4
  line-oriented, text-based templating system.
@@ -152,5 +152,5 @@ properties!title: RuwikiTemplatingLibrary
152
152
  properties!topic: RuwikiTemplatingLibrary
153
153
  properties!version: 1
154
154
  ruwiki!content-version: 2
155
- ruwiki!version: 0.9.0
155
+ ruwiki!version: 0.9.1
156
156
  properties!editable: false
@@ -1,10 +1,10 @@
1
- page!content: = Ruwiki 0.9.0 Utilities
2
- Ruwiki 0.9.0 provides two utilities and three sample programs for
1
+ page!content: = Ruwiki 0.9.1 Utilities
2
+ Ruwiki 0.9.1 provides two utilities and three sample programs for
3
3
  deployment.
4
4
 
5
5
  == Managing Ruwiki Deployments
6
- A major change to the way that Ruwiki 0.9.0 works as compared to
7
- versions of Ruwiki 0.8.0 or earlier is that Ruwiki 0.9.0 supports being
6
+ A major change to the way that Ruwiki 0.9.1 works as compared to
7
+ versions of Ruwiki 0.8.0 or earlier is that Ruwiki 0.9.1 supports being
8
8
  installed in a central location by one of the two major packaging
9
9
  systems available for Ruby (\RubyGems and RPA). Managing these
10
10
  deployments is accomplished with the utility appropriately enough named
@@ -119,7 +119,7 @@ page!content: = Ruwiki 0.9.0 Utilities
119
119
  : This section was formerly a separate entry in the Wiki entitled
120
120
  : &ldquo;Upgrading and Converting&rdquo;.
121
121
 
122
- The flatfile backend format in Ruwiki 0.9.0 is not compatible with that
122
+ The flatfile backend format in Ruwiki 0.9.1 is not compatible with that
123
123
  of versions of Ruwiki earlier than 0.8.0. There are a number of
124
124
  reasons for this, but because of this and that there are now three
125
125
  different backend formats, Ruwiki now has a converter utility between
@@ -153,5 +153,5 @@ properties!title: RuwikiUtilities
153
153
  properties!topic: RuwikiUtilities
154
154
  properties!version: 1
155
155
  ruwiki!content-version: 2
156
- ruwiki!version: 0.9.0
156
+ ruwiki!version: 0.9.1
157
157
  properties!editable: false
@@ -5,5 +5,5 @@ properties!title: SandBox
5
5
  properties!topic: SandBox
6
6
  properties!version: 1
7
7
  ruwiki!content-version: 2
8
- ruwiki!version: 0.9.0
8
+ ruwiki!version: 0.9.1
9
9
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0 To Do Tracking
1
+ page!content: = Ruwiki 0.9.1 To Do Tracking
2
2
  Completed to-do items can be found in the ChangeLog. Bugs in Ruwiki
3
3
  are tracked in BugTracking.
4
4
 
@@ -47,5 +47,5 @@ properties!title: To_Do
47
47
  properties!topic: To_Do
48
48
  properties!version: 1
49
49
  ruwiki!content-version: 2
50
- ruwiki!version: 0.9.0
50
+ ruwiki!version: 0.9.1
51
51
  properties!editable: false
@@ -1,5 +1,5 @@
1
- page!content: = Ruwiki 0.9.0
2
- = Ruwiki 0.9.0 Troubleshooting Tips
1
+ page!content: = Ruwiki 0.9.1
2
+ = Ruwiki 0.9.1 Troubleshooting Tips
3
3
  Following are some tips contributed by users of Ruwiki. Remember:
4
4
  Ruwiki currently requires Ruby version 1.8; the YAML backend requires
5
5
  Ruby version 1.8.2 or the latest CVS of Ruby 1.9.
@@ -29,5 +29,5 @@ properties!title: ProjectIndex
29
29
  properties!topic: ProjectIndex
30
30
  properties!version: 1
31
31
  ruwiki!content-version: 2
32
- ruwiki!version: 0.9.0
32
+ ruwiki!version: 0.9.1
33
33
  properties!editable: false
@@ -13,5 +13,5 @@ properties!title: WikiFeatures
13
13
  properties!topic: WikiFeatures
14
14
  properties!version: 1
15
15
  ruwiki!content-version: 2
16
- ruwiki!version: 0.9.0
16
+ ruwiki!version: 0.9.1
17
17
  properties!editable: false
@@ -3,7 +3,7 @@ page!content: = Ruwiki Markup
3
3
  it easy to format text without needing to know HTML. This Wiki obeys
4
4
  the following rules by default. Because Ruwiki is extensible, there may
5
5
  be additional formatting rules. These rules are those rules that apply
6
- as of Ruwiki 0.9.0.
6
+ as of Ruwiki 0.9.1.
7
7
 
8
8
  == \WikiWords, \WikiProjects, Calendars, and External Resources
9
9
  While reading stuff on this Wiki, you will see some words mashed
@@ -257,5 +257,5 @@ properties!title: WikiMarkup
257
257
  properties!topic: WikiMarkup
258
258
  properties!version: 1
259
259
  ruwiki!content-version: 2
260
- ruwiki!version: 0.9.0
260
+ ruwiki!version: 0.9.1
261
261
  properties!editable: false
@@ -12,5 +12,5 @@ properties!title: AddingPages
12
12
  properties!topic: AddingPages
13
13
  properties!version: 1
14
14
  ruwiki!content-version: 2
15
- ruwiki!version: 0.9.0
15
+ ruwiki!version: 0.9.1
16
16
  properties!editable: false
@@ -12,5 +12,5 @@ properties!title: AddingProjects
12
12
  properties!topic: AddingProjects
13
13
  properties!version: 1
14
14
  ruwiki!content-version: 2
15
- ruwiki!version: 0.9.0
15
+ ruwiki!version: 0.9.1
16
16
  properties!editable: false
@@ -1,4 +1,4 @@
1
- page!content: = Ruwiki 0.9.0 Tutorial
1
+ page!content: = Ruwiki 0.9.1 Tutorial
2
2
  This tutorial is incomplate.
3
3
 
4
4
  %topics(Tutorial)
@@ -7,5 +7,5 @@ properties!title: ProjectIndex
7
7
  properties!topic: ProjectIndex
8
8
  properties!version: 1
9
9
  ruwiki!content-version: 2
10
- ruwiki!version: 0.9.0
10
+ ruwiki!version: 0.9.1
11
11
  properties!editable: false
@@ -5,5 +5,5 @@ properties!title: SandBox
5
5
  properties!topic: SandBox
6
6
  properties!version: 1
7
7
  ruwiki!content-version: 2
8
- ruwiki!version: 0.9.0
8
+ ruwiki!version: 0.9.1
9
9
  properties!editable: false
data/data/clean.uri ADDED
@@ -0,0 +1,37 @@
1
+ #--
2
+ # Ruwiki
3
+ # Copyright � 2002 - 2004, Digikata and HaloStatue
4
+ # Alan Chen (alan@digikata.com)
5
+ # Austin Ziegler (ruwiki@halostatue.ca)
6
+ #
7
+ # Licensed under the same terms as Ruby.
8
+ #
9
+ # $Id: clean.uri,v 1.1 2004/12/21 01:37:59 austin Exp $
10
+ #
11
+ # This file contains the list of URIs or partial URIs that will not be
12
+ # redirected by the automatic redirection technique. It is recommended that the
13
+ # Regular Expression be specific and be anchored to prevent "similar" URIs from
14
+ # being handled poorly. Non HTTP/HTTPS URIs are not redirected at this time.
15
+ #
16
+ # This file is in "extended" regular expression format, one optional expression
17
+ # to a line. Spaces are not significant and comments are allowed. If you want
18
+ # to recognise a space in your regular expression, do so either with a
19
+ # character class ([ ]) or the whitespace meta-character (\s). Hash marks must
20
+ # be escaped (\#) or they will be treated as comment markers. Blank or
21
+ # comment-only lines are ignored. All other lines will be joined together:
22
+ #
23
+ # ^http://[^/]*?ruby-lang.org/?.*$
24
+ # ^http://[^/]*?rubyforge.org/?.*$
25
+ #
26
+ # becomes:
27
+ #
28
+ # %r{^http://[^/]*?ruby-lang.org/?.*$|^http://[^/]*?rubyforge.org/?.*$}
29
+ #++
30
+ (?ix-m:^http://[^/]*?ruby-lang.org/?.*$)
31
+ (?ix-m:^http://[^/]*?rubyforge.org/?.*$)
32
+ (?ix-m:^http://rubyforge.halostatue.info/?.*$)
33
+ (?ix-m:^http://[^/]*?ruwiki.org/?.*$)
34
+ (?ix-m:^http://[^/]*?ruby-doc.org/?.*$)
35
+ (?ix-m:^http://[^/]*?pragmaticprogrammers.com/?.*$)
36
+ (?ix-m:^http://127\.0\.0\.(\d|\d\d|1\d\d|2[0-4]\d|25[0-5])/?.*$)
37
+ (?ix-m:^http://localhost/?.*$)
data/data/hostip.banned CHANGED
@@ -6,12 +6,12 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: hostip.banned,v 1.1 2004/11/22 04:53:41 austin Exp $
9
+ # $Id: hostip.banned,v 1.2 2004/12/21 01:37:59 austin Exp $
10
10
  #
11
- # This file contains the list of User Agent strings which will be greeted
12
- # with "403 Forbidden" responses by Ruwiki. These are generally known email
13
- # harvesters or link directory builders for reciprocal link partners. These
14
- # may also be robots that routinely ignore the robots.txt file.
11
+ # This file contains the list of IP address strings which will be greeted with
12
+ # "403 Forbidden" responses by Ruwiki. These are generally known email
13
+ # harvesters or link directory builders for reciprocal link partners. These may
14
+ # also be robots that routinely ignore the robots.txt file.
15
15
  #
16
16
  # This file is in "extended" regular expression format, one optional
17
17
  # expression to a line. Spaces are not significant and comments are
data/data/hostip.readonly CHANGED
@@ -6,9 +6,9 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: hostip.readonly,v 1.1 2004/11/22 04:53:41 austin Exp $
9
+ # $Id: hostip.readonly,v 1.2 2004/12/21 01:37:59 austin Exp $
10
10
  #
11
- # This file contains the list of User Agent strings which will be given
11
+ # This file contains the list of IP address strings which will be given
12
12
  # readonly versions of the wiki instance.
13
13
  #
14
14
  # This file is in "extended" regular expression format, one optional
data/lib/ruwiki.rb CHANGED
@@ -6,11 +6,11 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: ruwiki.rb,v 1.45 2004/11/28 23:28:15 austin Exp $
9
+ # $Id: ruwiki.rb,v 1.46 2004/12/21 01:37:59 austin Exp $
10
10
  #++
11
11
 
12
12
  class Ruwiki
13
- VERSION = '0.9.0'
13
+ VERSION = '0.9.1'
14
14
  CONTENT_VERSION = 2
15
15
  end
16
16
 
@@ -30,7 +30,7 @@ require 'ruwiki/page'
30
30
  # it supports project namespaces, so that two pages can be named the same
31
31
  # for differing projects without colliding or having to resort to odd
32
32
  # naming conventions. Please see the ::Ruwiki project in the running Wiki
33
- # for more information. Ruwiki 0.9.0 has German and Spanish translations
33
+ # for more information. Ruwiki 0.9.1 has German and Spanish translations
34
34
  # available.
35
35
  #
36
36
  # == Quick Start (CGI)
@@ -118,6 +118,8 @@ class Ruwiki
118
118
  @banned_hostip = load_blacklist('hostip.banned')
119
119
  @readonly_agents = load_blacklist('agents.readonly')
120
120
  @readonly_hostip = load_blacklist('hostip.readonly')
121
+ # Prevent Google redirection against these URIs.
122
+ Ruwiki::Wiki.no_redirect = load_blacklist('clean.uri')
121
123
  end
122
124
 
123
125
  def load_blacklist(filename)
@@ -146,6 +148,8 @@ class Ruwiki
146
148
  else
147
149
  Regexp.new(data.join("|"), Regexp::EXTENDED)
148
150
  end
151
+ rescue
152
+ return nil
149
153
  end
150
154
 
151
155
  def check_useragent
@@ -322,7 +326,7 @@ class Ruwiki
322
326
  else
323
327
  topic_list.map! do |tt|
324
328
  uu = CGI.unescape(tt)
325
- if (uu != tt) or (tt =~ /^[A-Z][a-z]+$/)
329
+ if (uu != tt) or (tt !~ Ruwiki::Wiki::RE_WIKI_WORDS)
326
330
  "[[#{CGI.unescape(tt)}]]"
327
331
  else
328
332
  tt
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: backend.rb,v 1.24 2004/11/28 02:26:57 austin Exp $
9
+ # $Id: backend.rb,v 1.25 2004/12/16 21:05:39 austin Exp $
10
10
  #++
11
11
 
12
12
  begin
@@ -64,8 +64,8 @@ class Ruwiki
64
64
  'title' => topic,
65
65
  'topic' => topic,
66
66
  'project' => project,
67
- 'create-date' => Time.now,
68
- 'edit-date' => Time.now,
67
+ 'create-date' => Time.now.utc,
68
+ 'edit-date' => Time.now.utc,
69
69
  'editable' => true,
70
70
  'indexable' => true,
71
71
  'entropy' => 0.0,
@@ -108,7 +108,7 @@ class Ruwiki
108
108
  recent_changes = Page.new(retrieve('RecentChanges', page.project))
109
109
  end
110
110
 
111
- changeline = "\n; #{page.editor_ip} (#{Time.now.strftime(@datetime_format)}), #{page.topic} : #{page.edit_comment}"
111
+ changeline = "\n; #{page.editor_ip} (#{Time.now.utc.strftime(@datetime_format)}), #{page.topic} : #{page.edit_comment}"
112
112
 
113
113
  # add changeline to top of page
114
114
  recent_changes.content = changeline + (recent_changes.content || "")
@@ -135,7 +135,7 @@ class Ruwiki
135
135
 
136
136
  # Releases the lock on the page.
137
137
  def release_lock(page, address = 'UNKNOWN')
138
- time = Time.now.to_i
138
+ time = Time.now.utc.to_i
139
139
  @delegate.release_lock(page, time, address)
140
140
  rescue Ruwiki::Backend::BackendError
141
141
  raise Ruwiki::Backend::BackendError.new(nil), @message[:cannot_release_lock] % [page.project, page.topic]
@@ -146,7 +146,7 @@ class Ruwiki
146
146
 
147
147
  # Attempts to obtain a lock on the page. The lock
148
148
  def obtain_lock(page, address = 'UNKNOWN', timeout = 600)
149
- time = Time.now.to_i
149
+ time = Time.now.utc.to_i
150
150
  expire = time + timeout
151
151
  @delegate.obtain_lock(page, time, expire, address)
152
152
  rescue Ruwiki::Backend::BackendError
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: flatfiles.rb,v 1.25 2004/11/26 12:18:47 austin Exp $
9
+ # $Id: flatfiles.rb,v 1.26 2004/12/16 21:05:39 austin Exp $
10
10
  #++
11
11
  require 'ruwiki/exportable'
12
12
 
@@ -140,7 +140,6 @@ class Ruwiki::Backend::Flatfiles < Ruwiki::Backend
140
140
 
141
141
  # Releases the lock on the topic page.
142
142
  def release_lock(page, time, address = 'UNKNOWN')
143
- time = Time.now.to_i
144
143
  lockfile = "#{page_file(page.topic, page.project)}.lock"
145
144
 
146
145
  if lock_okay?(page, time, address)
data/lib/ruwiki/page.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: page.rb,v 1.13 2004/09/27 04:48:27 austin Exp $
9
+ # $Id: page.rb,v 1.14 2004/12/16 21:05:39 austin Exp $
10
10
  #++
11
11
  require 'ruwiki/exportable'
12
12
 
@@ -187,10 +187,10 @@ class Ruwiki::Page
187
187
  @project = props['project'] || "Default"
188
188
  @creator = props['creator'] || ""
189
189
  @creator_ip = props['creator-ip'] || "UNKNOWN"
190
- @create_date = Time.at((props['create-date'] || Time.now).to_i)
190
+ @create_date = Time.at((props['create-date'] || Time.now.utc).to_i)
191
191
  @editor = props['editor'] || ""
192
192
  @editor_ip = props['editor-ip'] || "UNKNOWN"
193
- @edit_date = Time.at((props['edit-date'] || Time.now).to_i)
193
+ @edit_date = Time.at((props['edit-date'] || Time.now.utc).to_i)
194
194
  @edit_comment = props['edit-comment'] || ""
195
195
  case props['editable']
196
196
  when "false"
data/lib/ruwiki/utils.rb CHANGED
@@ -7,9 +7,7 @@
7
7
  #
8
8
  # Licensed under the same terms as Ruby.
9
9
  #
10
- # This file may be renamed to change the URI for the wiki.
11
- #
12
- # $Id: utils.rb,v 1.2 2004/09/27 04:48:27 austin Exp $
10
+ # $Id: utils.rb,v 1.3 2004/12/21 01:37:59 austin Exp $
13
11
  #++
14
12
 
15
13
  # So that Ruwiki doesn't have to be loaded in full to use the bloody thing.
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # This file may be renamed to change the URI for the wiki.
11
11
  #
12
- # $Id: manager.rb,v 1.10 2004/11/28 02:26:57 austin Exp $
12
+ # $Id: manager.rb,v 1.13 2004/12/17 20:56:19 austin Exp $
13
13
  #++
14
14
 
15
15
  require 'optparse'
@@ -302,7 +302,8 @@ module Ruwiki::Utils::Manager
302
302
  @ruwiki_servlet_cmd = File.join(@shared, "bin", "ruwiki_servlet.cmd")
303
303
  @ruwiki_service = File.join(@shared, "bin", "ruwiki_service.rb")
304
304
  @ruwiki_cgi = File.join(@shared, "bin", "ruwiki.cgi")
305
- @ruwiki_pkg = File.join(@shared, Ruwiki::Utils::Manager::DEFAULT_PACKAGE_NAME)
305
+ @ruwiki_pkg = File.join(@shared, "share", "ruwiki",
306
+ Ruwiki::Utils::Manager::DEFAULT_PACKAGE_NAME)
306
307
  end
307
308
 
308
309
  def with(obj)
@@ -522,6 +523,14 @@ module Ruwiki::Utils::Manager
522
523
 
523
524
  if options['data']
524
525
  unpackage(Ruwiki::Utils::Manager.ruwiki_pkg, dest)
526
+ if options['service']
527
+ cfn = File.join(dest, 'ruwiki.conf')
528
+ cfg = nil
529
+ File.open(cfn, "rb") { |f| cfg = f.read }
530
+ cfg.gsub!(%r{\./data}, File.join(File.expand_path(dest), "data"))
531
+ cfg.gsub!(%r{\./templates}, File.join(File.expand_path(dest), "templates"))
532
+ File.open(cfn, "wb") { |f| f.write(cfg) }
533
+ end
525
534
  end
526
535
  end
527
536
 
@@ -566,7 +575,7 @@ module Ruwiki::Utils::Manager
566
575
  svc.dependencies = [] # Required because of a bug in Win32::Service
567
576
  end
568
577
  service.close
569
- ioe[:output] << Manager.manager(:manager_service_installed) % [ service_name ] << "\n"
578
+ ioe[:output] << Ruwiki::Utils::Manager.message(:manager_service_installed) % [ service_name ] << "\n"
570
579
  end
571
580
 
572
581
  if options[:service_start]
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # This file may be renamed to change the URI for the wiki.
11
11
  #
12
- # $Id: servletrunner.rb,v 1.8 2004/11/26 12:18:47 austin Exp $
12
+ # $Id: servletrunner.rb,v 1.9 2004/12/21 01:37:59 austin Exp $
13
13
  #++
14
14
 
15
15
  # Customize this if you put the RuWiki files in a different location.
@@ -37,7 +37,7 @@ Ruwiki #{Ruwiki::VERSION}
37
37
 
38
38
  Licensed under the same terms as Ruby.
39
39
 
40
- $Id: servletrunner.rb,v 1.8 2004/11/26 12:18:47 austin Exp $
40
+ $Id: servletrunner.rb,v 1.9 2004/12/21 01:37:59 austin Exp $
41
41
  COPYRIGHT
42
42
 
43
43
  class WEBrickConfig
@@ -288,8 +288,9 @@ COPYRIGHT
288
288
  Ruwiki::Servlet.config = @rc
289
289
 
290
290
  server.mount(@sc.mount, Ruwiki::Servlet)
291
- trap("INT") { server.shutdown; return }
291
+ trap("INT") { server.shutdown; return 0 }
292
292
  server.start
293
+ return 0
293
294
  end
294
295
  end
295
296
  end
data/lib/ruwiki/wiki.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: wiki.rb,v 1.14 2004/11/28 05:27:32 austin Exp $
9
+ # $Id: wiki.rb,v 1.15 2004/12/21 01:37:59 austin Exp $
10
10
  #++
11
11
  # Ruwiki's Wiki markup class. This will convert the Wiki markup known by
12
12
  # Ruwiki (defined by Token classes). The algorithm is as follows:
@@ -86,6 +86,23 @@ class Ruwiki::Wiki
86
86
  @title = title
87
87
  end
88
88
 
89
+ # A regular expression that will prevent redirection.
90
+ class << self
91
+ attr_accessor :no_redirect
92
+
93
+ def redirect(uri)
94
+ if uri =~ %r{^https?://}
95
+ if self.no_redirect and uri =~ self.no_redirect
96
+ uri
97
+ else
98
+ "http://www.google.com/url?sa=D&amp;q=#{CGI.escape(uri)}"
99
+ end
100
+ else
101
+ uri
102
+ end
103
+ end
104
+ end
105
+
89
106
  private
90
107
  # Find HTML tags
91
108
  SIMPLE_TAG_RE = %r{<[^<>]+?>} # Ensure that only the tag is grabbed.
@@ -6,116 +6,110 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: tokens.rb,v 1.8 2004/11/26 12:18:47 austin Exp $
9
+ # $Id: tokens.rb,v 1.9 2004/12/21 01:37:59 austin Exp $
10
10
  #++
11
- class Ruwiki
12
- class Wiki
13
- # The base Token class. All Token classes must inherit from Token and
14
- # *must* implement the following methods:
15
- #
16
- # [self.regexp] The regular expression that the Token will be
17
- # replacing.
18
- # [replace] The mechanism for replacing the Token with the desired
19
- # results.
20
- #
21
- # Token classes <i>should</i> implement the following method:
22
- # [self.rank] Default: <tt>5000</tt>. Affects the sort order.
23
- # Must return an integer.
24
- #
25
- # Token classes <i>may</i> implement the following methods:
26
- # [restore] Restores the token without replacement.
27
- # Implements the results of the escape character.
28
- # NOTE: each Token class is responsible for its own
29
- # restore. Tokens that are anchored to the
30
- # beginning of a line are the most likely to need
31
- # to reimplement this.
32
- # [self.post_replace] Performs any necessary massaging of the data. See
33
- # the implementation of Ruwiki::Wiki::Lists for
34
- # more information.
35
- class Token
36
- @@tokenlist = []
37
- @@sorted = false
11
+ # The base Token class. All Token classes must inherit from Token and
12
+ # *must* implement the following methods:
13
+ #
14
+ # [self.regexp] The regular expression that the Token will be replacing.
15
+ # [replace] The mechanism for replacing the Token with the desired
16
+ # results.
17
+ #
18
+ # Token classes <i>should</i> implement the following method:
19
+ # [self.rank] Default: <tt>5000</tt>. Affects the sort order.
20
+ # Must return an integer.
21
+ #
22
+ # Token classes <i>may</i> implement the following methods:
23
+ # [restore] Restores the token without replacement. Implements
24
+ # the results of the escape character. NOTE: each
25
+ # Token class is responsible for its own restore.
26
+ # Tokens that are anchored to the beginning of a line
27
+ # are the most likely to need to reimplement this.
28
+ # [self.post_replace] Performs any necessary massaging of the data. See
29
+ # the implementation of Ruwiki::Wiki::Lists for more
30
+ # information.
31
+ class Ruwiki::Wiki::Token
32
+ @@tokenlist = []
33
+ @@sorted = false
38
34
 
39
- class << self
40
- # Tokens should define rank if they must be first or last in
41
- # processing. Otherwise, they are sorted in the order defined.
42
- def rank
43
- 5000
44
- end
45
-
46
- # The Wiki parsing routine uses Token.tokenlist to determine the
47
- # tokens that are processed, and the order in which they are
48
- # processed. See Token.rank for more information.
49
- def tokenlist
50
- unless @@sorted
51
- head = @@tokenlist.shift
52
- @@tokenlist.sort! { |aa, bb| aa.rank <=> bb.rank }
53
- @@tokenlist.unshift(head)
54
- sorted = true
55
- end
56
- @@tokenlist
57
- end
58
-
59
- def inherited(child_class) #:nodoc:
60
- @@tokenlist << Token if @@tokenlist.empty?
35
+ class << self
36
+ # Tokens should define rank if they must be first or last in
37
+ # processing. Otherwise, they are sorted in the order defined.
38
+ def rank
39
+ 5000
40
+ end
61
41
 
62
- # Make the child class post_replace a blank function because we
63
- # don't want to propogate the currently defined post_replace.
64
- # The current post_replace is specific to Token_Base only.
65
- class << child_class
66
- def self.post_replace(content)
67
- content
68
- end
69
- end
42
+ # The Wiki parsing routine uses Token.tokenlist to determine the
43
+ # tokens that are processed, and the order in which they are
44
+ # processed. See Token.rank for more information.
45
+ def tokenlist(sort = true)
46
+ if sort and not @@sorted
47
+ head = @@tokenlist.shift
48
+ @@tokenlist.sort! { |aa, bb| aa.rank <=> bb.rank }
49
+ @@tokenlist.unshift(head)
50
+ @@sorted = true
51
+ end
52
+ @@tokenlist
53
+ end
70
54
 
71
- @@tokenlist << child_class
72
- @@sorted = false
73
- end
55
+ def inherited(child_class) #:nodoc:
56
+ @@tokenlist << Ruwiki::Wiki::Token if @@tokenlist.empty?
74
57
 
75
- # The replacement regular expression.
76
- def regexp
77
- /TOKEN_(\d*)/
58
+ # Make the child class post_replace a blank function because we
59
+ # don't want to propogate the currently defined post_replace. The
60
+ # current post_replace is specific to Token_Base only.
61
+ class << child_class
62
+ def self.post_replace(content)
63
+ content
78
64
  end
79
65
  end
80
66
 
81
- # All Token classes must match this header signature if they define
82
- # #initialize.
83
- #
84
- # [match] The MatchData object for this Token.
85
- # [project] The project being processed.
86
- # [backend] The backend for the wiki. This is used to determine if
87
- # the page or project exists. The object passed must
88
- # respond to #project_exists?(project) and
89
- # #page_exists?(page, project).
90
- # [script] The URI to the script.
91
- # [message] The message hash for localized messages.
92
- # [title] The title of the Wiki.
93
- def initialize(match, project, backend, script, message, title)
94
- @match = match
95
- @project = project
96
- @backend = backend
97
- @script = script
98
- @message = message
99
- @title = title
100
- end
67
+ @@tokenlist << child_class
68
+ @@sorted = false
69
+ end
101
70
 
102
- # The replacement method. Uses @match to replace the token with the
103
- # appropriate values.
104
- def replace
105
- "TOKEN_#{@match[1]}"
106
- end
71
+ # The replacement regular expression.
72
+ def regexp
73
+ /TOKEN_(\d*)/o
74
+ end
75
+ end
107
76
 
108
- # Restores the token without replacement. By default, replaces
109
- # "dangerous" HTML characters.
110
- def restore
111
- Ruwiki.clean_entities(@match[0])
112
- end
77
+ # All Token classes must match this header signature if they define
78
+ # #initialize.
79
+ #
80
+ # [match] The MatchData object for this Token.
81
+ # [project] The project being processed.
82
+ # [backend] The backend for the wiki. This is used to determine if
83
+ # the page or project exists. The object passed must
84
+ # respond to #project_exists?(project) and
85
+ # #page_exists?(page, project).
86
+ # [script] The URI to the script.
87
+ # [message] The message hash for localized messages.
88
+ # [title] The title of the Wiki.
89
+ def initialize(match, project, backend, script, message, title)
90
+ @match = match
91
+ @project = project
92
+ @backend = backend
93
+ @script = script
94
+ @message = message
95
+ @title = title
96
+ end
113
97
 
114
- # The content may need massaging after processing.
115
- def self.post_replace(content)
116
- content
117
- end
118
- end
98
+ # The replacement method. Uses @match to replace the token with the
99
+ # appropriate values.
100
+ def replace
101
+ "TOKEN_#{@match[1]}"
102
+ end
103
+
104
+ # Restores the token without replacement. By default, replaces
105
+ # "dangerous" HTML characters.
106
+ def restore
107
+ Ruwiki.clean_entities(@match[0])
108
+ end
109
+
110
+ # The content may need massaging after processing.
111
+ def self.post_replace(content)
112
+ content
119
113
  end
120
114
  end
121
115
 
@@ -128,9 +122,10 @@ $LOAD_PATH.each do |path|
128
122
  Dir::glob("#{target}/*.rb") do |token|
129
123
  begin
130
124
  require token
131
- rescue LoadError
125
+ rescue LoadError, TypeError
132
126
  nil
133
127
  end
134
128
  end
135
129
  end
130
+ Ruwiki::Wiki::Token.tokenlist.each { |tk| tk.freeze }
136
131
  end
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # Licensed under the same terms as Ruby.
8
8
  #
9
- # $Id: 00default.rb,v 1.16 2004/11/28 23:59:18 austin Exp $
9
+ # $Id: 00default.rb,v 1.19 2004/12/21 02:08:51 austin Exp $
10
10
  #++
11
11
 
12
12
  # $debug = File.open("output.txt", "wb")
@@ -54,7 +54,8 @@ class Ruwiki::Wiki
54
54
 
55
55
  # Matches indented text. %r{^(\s+\S?.*)$}
56
56
  def self.regexp
57
- %r{^([ \t]+[^\n]*)\n}
57
+ # %r{^(\s+.*)$}
58
+ %r{^([ \t]+[^\n]*)\n?}
58
59
  end
59
60
 
60
61
  # Replaces the text to <pre>content</pre>.
@@ -79,22 +80,19 @@ class Ruwiki::Wiki
79
80
  RE_URI_PATH = %r{[^\s<>\]]}
80
81
  RE_URI_TEXT = %r{[^\]]*}
81
82
 
82
- def self.redirect(uri)
83
- "http://www.google.com/url?sa=D;q=#{CGI.escape(uri)}"
83
+ class << self
84
+ def increment_numbered_links
85
+ @numbered_links_count ||= 0
86
+ @numbered_links_count += 1
87
+ end
88
+
89
+ def reset_numbered_links
90
+ @numbered_links_count = 0
91
+ end
84
92
  end
85
93
 
86
94
  # Converts URLs in the form of [url] to numbered links.
87
95
  class NumberedLinks < Ruwiki::Wiki::Token
88
- class << self
89
- def increment
90
- @count ||= 0
91
- @count += 1
92
- end
93
-
94
- def reset
95
- @count = 0
96
- end
97
- end
98
96
 
99
97
  def self.rank
100
98
  2
@@ -107,7 +105,7 @@ class Ruwiki::Wiki
107
105
  def replace
108
106
  extlink = @match.captures[0]
109
107
 
110
- name = "[#{NumberedLinks.increment}]"
108
+ name = "[#{Ruwiki::Wiki.increment_numbered_links}]"
111
109
 
112
110
  %Q{<a class="rwtk_NumberedLinks" href="#{Ruwiki::Wiki.redirect(extlink)}">#{name}</a>}
113
111
  end
@@ -132,7 +130,7 @@ class Ruwiki::Wiki
132
130
  end
133
131
 
134
132
  unless options['numbered'].nil? or options['numbered'] == "false"
135
- options['title'] = %Q("[#{NumberedLinks.increment}]")
133
+ options['title'] = %Q("[#{Ruwiki::Wiki.increment_numbered_links}]")
136
134
  options.delete('numbered')
137
135
  end
138
136
 
data/ruwiki.pkg CHANGED
Binary file
data/tests/tc_tokens.rb CHANGED
@@ -7,7 +7,7 @@
7
7
  #
8
8
  # Licensed under the same terms as Ruby.
9
9
  #
10
- # $Id: tc_tokens.rb,v 1.12 2004/11/22 04:53:41 austin Exp $
10
+ # $Id: tc_tokens.rb,v 1.15 2004/12/21 02:08:51 austin Exp $
11
11
  #++
12
12
 
13
13
  $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
@@ -151,34 +151,34 @@ class TokenTestCases < Test::Unit::TestCase
151
151
 
152
152
  def test_NumberedLinks
153
153
  token = Ruwiki::Wiki::NumberedLinks
154
- Ruwiki::Wiki::NumberedLinks.reset
155
- content = "[http://www.ruby-lang.org] \\[http://www.rubyforge.org]"
156
- tkv = "TOKEN_0 \\TOKEN_1"
157
- uri = CGI.escape("http://www.ruby-lang.org")
158
- rpv = %Q{<a class="rwtk_NumberedLinks" href="http://www.google.com/url?sa=D;q=#{uri}">[1]</a> [http://www.rubyforge.org]}
159
- res = %Q{<a class="rwtk_NumberedLinks" href="http://www.google.com/url?sa=D;q=#{uri}">[1]</a> [http://www.rubyforge.org]}
154
+ Ruwiki::Wiki.reset_numbered_links
155
+ content = "[http://www.yahoo.com] [http://www.ruby-lang.org] \\[http://www.rubyforge.org]"
156
+ tkv = "TOKEN_0 TOKEN_1 \\TOKEN_2"
157
+ uri = CGI.escape("http://www.yahoo.com")
158
+ rpv = %Q{<a class="rwtk_NumberedLinks" href="http://www.google.com/url?sa=D&amp;q=#{uri}">[1]</a> <a class="rwtk_NumberedLinks" href="http://www.ruby-lang.org">[2]</a> [http://www.rubyforge.org]}
159
+ res = %Q{<a class="rwtk_NumberedLinks" href="http://www.google.com/url?sa=D&amp;q=#{uri}">[1]</a> <a class="rwtk_NumberedLinks" href="http://www.ruby-lang.org">[2]</a> [http://www.rubyforge.org]}
160
160
 
161
161
  __process(token, content, tkv, rpv, res)
162
162
  end
163
163
 
164
164
  def test_NamedLinks
165
165
  token = Ruwiki::Wiki::NamedLinks
166
- content = "[http://www.ruby-lang.org Ruby] \\[http://www.rubyforge.org RubyForge]"
167
- tkv = "TOKEN_0 \\TOKEN_1"
168
- uri = CGI.escape("http://www.ruby-lang.org")
169
- rpv = %Q{<a class="rwtk_NamedLinks" href="http://www.google.com/url?sa=D;q=#{uri}">Ruby</a> [http://www.rubyforge.org RubyForge]}
170
- res = %Q{<a class="rwtk_NamedLinks" href="http://www.google.com/url?sa=D;q=#{uri}">Ruby</a> [http://www.rubyforge.org RubyForge]}
166
+ content = "[http://www.yahoo.com Yahoo!] [http://www.ruby-lang.org Ruby] \\[http://www.rubyforge.org RubyForge]"
167
+ tkv = "TOKEN_0 TOKEN_1 \\TOKEN_2"
168
+ uri = CGI.escape("http://www.yahoo.com")
169
+ rpv = %Q{<a class="rwtk_NamedLinks" href="http://www.google.com/url?sa=D&amp;q=#{uri}">Yahoo!</a> <a class="rwtk_NamedLinks" href="http://www.ruby-lang.org">Ruby</a> [http://www.rubyforge.org RubyForge]}
170
+ res = %Q{<a class="rwtk_NamedLinks" href="http://www.google.com/url?sa=D&amp;q=#{uri}">Yahoo!</a> <a class="rwtk_NamedLinks" href="http://www.ruby-lang.org">Ruby</a> [http://www.rubyforge.org RubyForge]}
171
171
 
172
172
  __process(token, content, tkv, rpv, res)
173
173
  end
174
174
 
175
175
  def test_ExternalLinks
176
176
  token = Ruwiki::Wiki::ExternalLinks
177
- content = "http://www.ruby-lang.org \\http://www.rubyforge.org"
178
- tkv = "TOKEN_0 \\TOKEN_1"
179
- uri = CGI.escape("http://www.ruby-lang.org")
180
- rpv = %Q{<a class="rwtk_ExternalLinks" href="http://www.google.com/url?sa=D;q=#{uri}">http://www.ruby-lang.org</a> http://www.rubyforge.org}
181
- res = %Q{<a class="rwtk_ExternalLinks" href="http://www.google.com/url?sa=D;q=#{uri}">http://www.ruby-lang.org</a> http://www.rubyforge.org}
177
+ content = "http://www.yahoo.com http://www.ruby-lang.org \\http://www.rubyforge.org"
178
+ tkv = "TOKEN_0 TOKEN_1 \\TOKEN_2"
179
+ uri = CGI.escape("http://www.yahoo.com")
180
+ rpv = %Q{<a class="rwtk_ExternalLinks" href="http://www.google.com/url?sa=D&amp;q=#{uri}">http://www.yahoo.com</a> <a class="rwtk_ExternalLinks" href="http://www.ruby-lang.org">http://www.ruby-lang.org</a> http://www.rubyforge.org}
181
+ res = %Q{<a class="rwtk_ExternalLinks" href="http://www.google.com/url?sa=D&amp;q=#{uri}">http://www.yahoo.com</a> <a class="rwtk_ExternalLinks" href="http://www.ruby-lang.org">http://www.ruby-lang.org</a> http://www.rubyforge.org}
182
182
 
183
183
  __process(token, content, tkv, rpv, res)
184
184
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: ruwiki
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.0
7
- date: 2004-11-28
6
+ version: 0.9.1
7
+ date: 2004-12-20
8
8
  summary: "A simple, extensible, and fast Wiki-clone."
9
9
  require_paths:
10
10
  - lib
@@ -12,7 +12,7 @@ author: Austin Ziegler and Alan Chen
12
12
  email: ruwiki-discuss@rubyforge.org
13
13
  homepage: http://ruwiki.rubyforge.org/
14
14
  rubyforge_project: ruwiki
15
- description: "Ruwiki is a simple, extensible Wiki-clone written in Ruby. It supports both CGI and WEBrick interfaces, templates, and CSS formatting. This Wiki differs from most other Wikis in that it supports project namespaces, so that two topics may be named the same for differing projects without colliding or having to resort to odd naming conventions. Please see the ::Ruwiki project in the running Wiki for more information. Ruwiki 0.9.0 has German and Spanish translations available."
15
+ description: "Ruwiki is a simple, extensible Wiki-clone written in Ruby. It supports both CGI and WEBrick interfaces, templates, and CSS formatting. This Wiki differs from most other Wikis in that it supports project namespaces, so that two topics may be named the same for differing projects without colliding or having to resort to odd naming conventions. Please see the ::Ruwiki project in the running Wiki for more information. Ruwiki %RV#% has German and Spanish translations available."
16
16
  autorequire: ruwiki
17
17
  default_executable:
18
18
  bindir: bin
@@ -44,6 +44,7 @@ files:
44
44
  - contrib/rublog_integrator.rb
45
45
  - data/agents.banned
46
46
  - data/agents.readonly
47
+ - data/clean.uri
47
48
  - data/Default
48
49
  - data/hostip.banned
49
50
  - data/hostip.readonly