summaryrefslogtreecommitdiff
path: root/ruwiki/tags/release-0.6
diff options
context:
space:
mode:
Diffstat (limited to 'ruwiki/tags/release-0.6')
-rw-r--r--ruwiki/tags/release-0.6/Default/ProjectIndex17
-rw-r--r--ruwiki/tags/release-0.6/README48
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/BugTracking17
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/ChangeLog23
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/Configuring_Ruwiki161
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/Extending_Ruwiki171
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/LicenseAndAuthorInfo21
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/ProjectIndex28
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/RuwikiTemplatingLibrary5
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/SandBox5
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/To_Do37
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/WikiFeatures13
-rw-r--r--ruwiki/tags/release-0.6/Ruwiki/WikiMarkup179
-rw-r--r--ruwiki/tags/release-0.6/lib/algorithm/diff.rb220
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki.rb263
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/abbreviations.rb16
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/backend.rb126
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/backend/flatfiles.rb175
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/config.rb81
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/handler.rb207
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/markup.rb35
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/markup/meta.rb37
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/page.rb144
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/servlet.rb34
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/template.rb223
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki.rb84
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens.rb128
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/00default.rb239
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/abbreviations.rb38
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/headings.rb41
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/lists.rb114
-rw-r--r--ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/rubylists.rb47
-rw-r--r--ruwiki/tags/release-0.6/ruwiki.cgi38
-rw-r--r--ruwiki/tags/release-0.6/ruwiki_servlet.rb48
-rw-r--r--ruwiki/tags/release-0.6/templates/default/body.tmpl9
-rw-r--r--ruwiki/tags/release-0.6/templates/default/content.tmpl4
-rw-r--r--ruwiki/tags/release-0.6/templates/default/controls.tmpl3
-rw-r--r--ruwiki/tags/release-0.6/templates/default/edit.tmpl14
-rw-r--r--ruwiki/tags/release-0.6/templates/default/error.tmpl4
-rw-r--r--ruwiki/tags/release-0.6/templates/default/ruwiki.css31
-rw-r--r--ruwiki/tags/release-0.6/templates/default/save.tmpl5
-rw-r--r--ruwiki/tags/release-0.6/tests/debugger.rb41
-rw-r--r--ruwiki/tags/release-0.6/tests/tc_backend.rb112
-rw-r--r--ruwiki/tags/release-0.6/tests/tc_markup.rb84
-rw-r--r--ruwiki/tags/release-0.6/tests/tc_page.rb67
-rw-r--r--ruwiki/tags/release-0.6/tests/tc_ruwiki.rb59
-rw-r--r--ruwiki/tags/release-0.6/tests/test_utils.rb39
47 files changed, 0 insertions, 3535 deletions
diff --git a/ruwiki/tags/release-0.6/Default/ProjectIndex b/ruwiki/tags/release-0.6/Default/ProjectIndex
deleted file mode 100644
index f25bc36..0000000
--- a/ruwiki/tags/release-0.6/Default/ProjectIndex
+++ /dev/null
@@ -1,17 +0,0 @@
-id: 0
-topic: ProjectIndex
-version: 0
-#EHDR
-= Ruwiki
-Ruwiki is a simple, extensible Wiki written in Ruby. It supports both CGI and
-WEBrick interfaces, templates, and CSS formatting. Additionally, it supports project namespaces, so that two pages can be named the same for differing projects without
-colliding or having to resort to odd naming conventions. Please see ::Ruwiki for
-more information.
-
-The current version is 0.6.
-
-Projects:
-* ::Default
-* ::Ruwiki
-
-Please go to ::Ruwiki if you are unfamiliar with the concept of Wikis in general. If you want to play with \WikiFormatting, use the Ruwiki::SandBox.
diff --git a/ruwiki/tags/release-0.6/README b/ruwiki/tags/release-0.6/README
deleted file mode 100644
index 696d2dd..0000000
--- a/ruwiki/tags/release-0.6/README
+++ /dev/null
@@ -1,48 +0,0 @@
-Ruwiki 0.6.0
-------------
-Ruwiki is a simple, extensible Wiki written in Ruby. It supports both CGI and
-WEBrick interfaces, templates, and CSS formatting. Additionally, it supports
-project namespaces, so that two pages can be named the same for differing
-projects without colliding or having to resort to odd naming conventions.
-Please see ::Ruwiki in the running Wiki for more information.
-
-Quick Install (CGI)
--------------------
-1. Place the Ruwiki directory in a place that your webserver can execute CGI
- programs. Ensure that ruwiki.cgi is executable on your webserver. You may
- wish to protect templates/, data/, and lib/ from casual access.
-2. Modify the following lines in ruwiki.cgi:
- wiki.config.webmaster = ...
- wiki.config.title = ...
-3. Point your web browser to the appropriate URL.
-
-Quick Install (WEBrick)
------------------------
-1. Modify the following lines in ruwiki_servlet.rb:
- $config.webmaster = ...
- $config.title = ...
-2. Run ruwiki_servlet.rb to start a WEBrick instance on localhost:8808 with
- ruwiki bound to the root path (e.g., http://localhost:8808/).
-3. Point your web browser to the appropriate URL.
-
-Use
----
-Ruwiki is able to be called with one of several URI forms:
-
- http://domain.com/ruwiki.cgi?PageName
- http://domain.com/ruwiki.cgi?PageName&project=Project
- http://domain.com/ruwiki.cgi/PageName
- http://domain.com/ruwiki.cgi/Project/
- http://domain.com/ruwiki.cgi/Project/PageName
-
-Copyright: Copyright © 2003 - 2003, Alan Chen and Austin Ziegler
-Authors: Alan Chen (alan@digikata.com)
- Austin Ziegler (ruwiki@halostatue.ca)
-Licence: Ruby's
-
-* This software includes algorithm/diff by Lars Christensen, available for
- download from the RAA at: http://raa.ruby-lang.org/list.rhtml?name=diff
-* This software includes template.rb from Dave Thomas's rdoc system, available
- for download from SourceForge: http://rdoc.sourceforge.net
-
-$Id$
diff --git a/ruwiki/tags/release-0.6/Ruwiki/BugTracking b/ruwiki/tags/release-0.6/Ruwiki/BugTracking
deleted file mode 100644
index 6c3a337..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/BugTracking
+++ /dev/null
@@ -1,17 +0,0 @@
-id: 0
-topic: BugTracking
-version: 1
-#EHDR
-= Ruwiki 0.6.0 Bug Tracking
-This page is for tracking bugs in the Ruwiki project. Because of the extensive
-nature of the changes between Ruwiki 0.3.0 and Ruwiki 0.5.0 (and 0.6.0), the
-previously listed bugs have been erased.
-
-You may also be interested in the Ruwiki::To_Do list.
-
-----
-== Closed Bugs
-
-----
-== Open Bugs
-* Not all formatting is applied consistently. The token rankings may need adjusting.
diff --git a/ruwiki/tags/release-0.6/Ruwiki/ChangeLog b/ruwiki/tags/release-0.6/Ruwiki/ChangeLog
deleted file mode 100644
index 8bb604b..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/ChangeLog
+++ /dev/null
@@ -1,23 +0,0 @@
-id: 0
-version: 1
-topic: ChangeLog
-#EHDR
-= Ruwiki 0.6.0 ChangeLog
-Uncompleted to-do items can be found in To_Do. Bugs in Ruwiki are tracked in
-BugTracking.
-
-== Version 0.6.0
-* Added Ruby mailing list support (e.g., \[ruby-talk:12345]).
-* Reorganised the code (again) to better support alternative frontends. Based, in part, on [http://sourceforge.net/projects/rdoc-wiki RDoc Wiki] by Dave Thomas.
-* Added a [http://www.webrick.org WEBrick] servlet interface. Based, in part, on the WEBrick servlet interface provided with RDoc Wiki by Chad Fowler.
-* Added templates, using the [http://rdoc.sourceforge.net RDoc] template.rb library.
-* Changed the default topic to be \ProjectIndex instead of \DefaultProject.
-* Added a new \WikiWord format, \Wiki_Word_with_Spaces.
-* Completed lots of Ruwiki documentation.
-* Updated the save page.
-* Fixed a problem with the linking of project specific pages.
-
-== Version 0.5.0
-* Reorganized the code significantly to be easier to edit and extend.
-* Added abbreviation capabilities.
-* Cleaned up a lot of tokenizing code.
diff --git a/ruwiki/tags/release-0.6/Ruwiki/Configuring_Ruwiki b/ruwiki/tags/release-0.6/Ruwiki/Configuring_Ruwiki
deleted file mode 100644
index 0bd93e1..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/Configuring_Ruwiki
+++ /dev/null
@@ -1,161 +0,0 @@
-id: 0
-topic: Configuring_Ruwiki
-version: 1
-#EHDR
-= Configuring Ruwiki 0.6.0
-Ruwiki is configured similarly for both CGI and WEBrick modes. The biggest
-distinction is that because the Wiki is created after WEBrick server is
-created (during the dispatch to the servlet), it is necessary to configure the
-wiki with a global \Ruwiki::Config object, <i>$config</i>. Thus, in the
-examples below, replace <i>wiki.config</i> with <i>$config</i> where
-necessary.
-
-== wiki.config Options
-
-=== wiki.config.title
-This configuration option names the Wiki, by default this is <tt>Ruwiki</tt>.
-This affects the display of the home link and the &lt;title&gt; element of
-pages.
-
-=== wiki.config.webmaster
-The email address for the webmaster. This is used in generating error reports
-that can be emailed to the wiki's webmaster.
-
-=== wiki.config.default_page, wiki.config.default_project
-These options indicate what will happen when the wiki's URL is specified
-without any parameters (the default page in the default project is opened),
-when a topic is specified without a project (the topic is opened in the
-default project), and when a project is specified without a topic (the default
-page is opened in the project).
-
-=== wiki.config.storage_type
-This specifies the back-end storage mechanism as a Ruby Symbol. Currently,
-only <tt>:flatfiles</tt> is implemented. See Extending_Ruwiki for more
-information.
-
-=== wiki.config.data_path, wiki.config.template_path
-These specify the paths where Wiki data and templates will be found. The
-process running the Wiki must have read/write acccess to the data_path and
-read access to the template_path.
-
-=== wiki.config.template_set, wiki.config.css
-These two options indicate which template set will be used. Only one template
-set is provided in the release package, "default". The only CSS file used
-initially is "ruwiki.css". Templates work such that they will be found in
-<i>template_path</i>/<i>template_set</i>. All CSS files are loaded from the
-template set directory and emitted as part of the output stream.
-
-: The bad news is that this means that the CSS never caches on the client side
-: as it would if it were a separate file. However, because the templates may
-: not be in a web-accessible directory, this is necessary.
-
-== Templates
-Templating is done with the RDoc template.rb library, included in the
-distribution of Ruwiki. The templating library allows for nested templates,
-and this is used extensively in Ruwiki. This library is documented in
-RuwikiTemplatingLibrary.
-
-There are four major templates: content, edit, save, and error. Each of these
-has a slightly different combination of template files used, and this means
-that there are different sets of variables available.
-
-The major templates are combined templates that are defined as follows:
-; content : body.tmpl, content.tmpl, controls.tmpl
-; edit : body.tmpl, edit.tmpl
-; save : body.tmpl, save.tmpl, controls.tmpl
-; error : body.tmpl, error.tmpl
-
-=== body.tmpl
-The body template knows two template keys (<tt>%wiki_title%</tt> and
-<tt>%css_link%</tt>) and includes one other template. The values for
-%wiki_title% key differs depending on context, but no other key should be
-used or expected in the body template.
-
- <html>
- <head>
- <title>%wiki_title%</title>
- %css_link%
- </head>
- <body>
- !INCLUDE!
- </body>
- </html>
-
-=== content.tmpl
-The content template knows one template key (<tt>%content%</tt>) and includes
-one other template. (This may change moving forward so that there's a footer
-as well as a control header.)
-
- !INCLUDE!
- <!-- topic content -->
- %content%
- <!-- topic content -->
-
-=== controls.tmpl
-The controls template offers a navigation bar. It knows four template keys:
-; %cgi_url% : The URL to the wiki, suitable for building further links from.
-; %home_link% : The root topic of the wiki.
-; %page_project% : The project for the current page topic.
-; %page_topic% : The topic of the current page.
-
- <div class="rw_nav">
- %home_link% |
- Topic: <b>%page_topic%</b> Project: <a href="%cgi_url%/%page_project%/"><b>%page_project%</b></a> |
- <a href="%cgi_url%?action=edit&amp;project=%page_project%&amp;%page_topic%">Edit</a>
- </div>
-
-=== edit.tmpl
-The edit template is the most complex template with the most keys. Of
-necessity, it provides a restricted form of the navigation bar, the edit form,
-the raw body of the page, and the formatted body of the page.
-
-; %cgi_url% : The URL to the wiki, suitable for building further links from.
-; %home_link% : The root topic of the wiki.
-; %orig_page% : The unedited original page encoded as Base64.
-; %page_content% : The editable page content.
-; %page_old_version% : The old version number of the page.
-; %page_project% : The project for the current page topic being edited.
-; %page_topic% : The topic of the current page being edited.
-; %page_version% : The new version number of the page.
-; %pre_page_content% : The unedited original page content for display in a &lt;pre&gt; tagset.
-; %unedited_page_content% : The formatted unedited orignal page content.
-
- <div class="rw_nav">%home_link% | <i>Editing</i> Topic: <b>%page_topic%</b> Project: <b>%page_project%</b></div><br />
- <form class="rw_edit_form" action="%cgi_url%/%page_project%/%page_topic%" method="post">
- <textarea name="newpage" rows="15" cols="90">%page_content%</textarea>
- <input type="hidden" name="origpage" value="%orig_page%" />
- <input type="hidden" name="topic" value="%page_topic%" />
- <input type="hidden" name="project" value="%page_project%" />
- <input type="hidden" name="old_version" value="%page_old_version%" />
- <input type="hidden" name="version" value="%page_version%" /><br />
- <input type="submit" name="action" value="Save" />
- <input type="submit" name="action" value="Cancel" />
- </form>
- <div class="rw_edit_raw"><h2>Raw Original Value</h2><pre>%pre_page_content%</pre></div>
- <div class="rw_edit_format"><h2>Formatted Version</h2>%unedited_page_content%</div>
-
-=== save.tmpl
-An alternative content page for use when a page is saved after editing. This
-knows <tt>%page_project%</tt>, <tt>%page_tolink%</tt> (used to link directly
-to the page), and <tt>%content%</tt>.
-
- !INCLUDE!
- Saved page %page_project%::%page_tolink%<hr />
- <!-- topic content -->
- %content%
- <!-- topic content -->
-
-=== error.tmpl
-This template is used for reporting errors to the user and offering an
-opportunity to the user to send a report to the wiki webmaster.
-
-; %backtrace% : The error backtrace.
-; %backtrace_email% : The error backtrace in a format suitable for email.
-; %home_link% : The root topic of the wiki.
-; %name% : The name of the error.
-; %webmaster% : The email address of the wiki webmaster.
-
- <div class="rw_nav">%home_link%</div>
- <h1>%name%</h1>
- <p>Send the webmaster a report by <a href="mailto:%webmaster%?subject=%name%&amp;body=%backtrace_email%">email</a>.</p>
- <p>%backtrace%</p>
diff --git a/ruwiki/tags/release-0.6/Ruwiki/Extending_Ruwiki b/ruwiki/tags/release-0.6/Ruwiki/Extending_Ruwiki
deleted file mode 100644
index 8c1a57d..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/Extending_Ruwiki
+++ /dev/null
@@ -1,171 +0,0 @@
-id: 0
-topic: Extending_Ruwiki
-version: 1
-#EHDR
-= Extending Ruwiki 0.6.0
-
-Ruwiki is relatively easily extended to support new features. There are two
-primary ways in which Ruwiki can be extended by the end user: markup and
-backends.
-
-== Extending Ruwiki Markup
-
-Ruwiki's WikiMarkup can be extended by creating a new Ruwiki::Wiki::Token.
-Tokens will be automatically loaded if they are placed in
-<i>ruwiki/wiki/tokens</i>.
-
-The
-following Ruwiki::Wiki::Token class will convert strings in the forms of
-\[ruby-talk:12345] to links.
-
- class RubyTalkLinks < Ruwiki::Wiki::Token
- def self.rank
- 2
- end
-
- def self.regexp
- %r{\[ruby-talk:(\d+)\]}
- end
-
- def replace
- lm = @match.captures[0]
- %Q(<a class="rw_extlink" href="http://www.ruby-talk.org/#{lm}">#{@match[0]}</a>)
- end
- end
-
-=== Required Methods
-==== ::regexp
-
-Ruwiki tokens are matched only through regular expression matches. As shown in
-the example above, the regular expression for ruby-talk mailing list posts is
-<tt>%r{\[ruby-talk:(\d+)\]}</tt>. The purpose of the ::regexp method is to
-return the regexp for matching.
-
-For most inline matches, Ruwiki will ensure that the escape character (\)
-works automatically. For whole-line matches, it is necessary to match the
-escape character manually and provide a #restore method.
-
-As an example, the HRule class implements these methods.
-
- def self.regexp
- %r|^\\?-{4,}|
- end
-
- def restore
- @match[0][1 .. -1]
- end
-
-It may also be necessary to match escapes manually on inline matches that must
-be along word boundaries where the regular expression includes characters that
-normally match word boundaries. The project index match (e.g., \::Ruwiki)
-regular expression does this <tt>%r{(\B|\\)::([A-Z][a-z]+)}</tt>.
-
-==== #replace
-
-This returns the formatted token. In the \RubyTalkLinks class above, the
-matched regular expression will be replaced with a hyperlink. The text of the
-hyperlink will be the matched text; the target of the hyperlink will include
-the first captured value.
-
- def replace
- lm = @match.captures[0]
- %Q(<a class="rw_extlink" href="http://www.ruby-talk.org/#{lm}">#{@match[0]}</a>)
- end
-
-=== Optional Methods
-==== ::rank
-
-By default, a token will be processed in the order created. Tokens may be
-given a specific rank to ensure that they are processed in a particular order.
-The default rank is <tt>9999</tt>.
-
-==== #restore
-
-Restores the token without replacement. Implements the results of the escape
-character. Each Token class is responsible for its own restoration. As noted
-in #regexp, whole-line tokens are most likely to need a #restore
-implementation.
-
-==== #post_replace
-
-Performs any necessary massaging of the data. The Lists token uses this to
-ensure that lists are collapsed together; the Paragraph token uses this to
-ensure that there are no empty paragraph tag pairs (&lt;p&gt;&lt;/p&gt;).
-
-== Extending Ruwiki Backends
-
-Ruwiki can support varying backends, as the backend interface has been
-abstracted completely from the data store. The backend <b>must</b>:
-
-# reside in <i>ruwiki/backends/</i> as <i>backend_name</i>.rb.
-# be registered by adding the <i>backend_name</i> as a symbol (e.g., :<i>backend_name</i>) to Ruwiki::Backend::BACKENDS.
-# inherit from Ruwiki::Backend.
-# exist as Ruwiki::Backend::<i>\Backend_name</i>.
-
-=== Required Methods
-==== #initialize(ruwiki)
-
-The backend may only obtain its configuration information from the provided
-ruwiki instance (through Ruwiki#config) and must set @ruwiki (this can be
-achieved by calling <tt>super ruwiki</tt>).
-
-==== #load(topic, project)
-
-The backend will be provided the name of the topic and project and must return
-the selected page as an array, one row per line. If the backend you have
-chosen returns the page as a single text block, it will be necessary to do a
-String#split("\n") on it.
-
-==== #save(page)
-
-This method must store the provided page in the backend. Note that the return
-value of the Page#rawtext method must be stored. This method may call
-Backend#make_diff to generate the differences hash.
-
- diff = {
- 'old_version' => page.old_version,
- 'new_version' => page.version,
- 'change_date' => Time.now,
- 'change_ip' => page.change_ip,
- 'change_id' => page.change_id,
- 'diff' => Diff.diff(oldpage, newpage)
- }
-
-==== #obtain_lock(page)
-
-Obtains an exclusive lock on the page. The lock should have a ten minute (600
-second) timeout and permit access from the same IP address without
-restriction. This should <b>not</b> be a filesystem lock.
-
-==== #release_lock(page)
-
-Releases the exclusive lock on the page. The lock should not be released
-unless the IP address on the lock is the same or the lock has expired (600
-seconds).
-
-==== #project_exists?(project)
-
-Returns <tt>true</tt> if the project exists.
-
-==== #page_exists?(topic, project = 'Default')
-Returns <tt>true</tt> if the page exists within the specified project.
-
-=== Optional Methods
-
-Note that these methods are currently optional (they are not yet called from
-Ruwiki), but will become required moving forward as the functions are
-implemented in Ruwiki.
-
-==== #destroy(page)
-
-Removes the page from the wiki. This should <b>not</b> remove the change
-history of the topic (in the event that the page has been removed
-maliciously). There will be a separate method to remove the page history.
-
-==== #create_project(project)
-
-Attempts to create the project.
-
-==== #destroy_project(project)
-
-Attempts to destroy the project.
diff --git a/ruwiki/tags/release-0.6/Ruwiki/LicenseAndAuthorInfo b/ruwiki/tags/release-0.6/Ruwiki/LicenseAndAuthorInfo
deleted file mode 100644
index 8cfb9fc..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/LicenseAndAuthorInfo
+++ /dev/null
@@ -1,21 +0,0 @@
-id: 0
-topic: LicenseAndAuthorInfo
-version: 1
-#EHDR
-Ruwiki is copyright © 2002 - 2003 [mailto:alan@digikata.com Alan Chen] and
-[mailto:ruwiki@halostatue.ca Austin Ziegler].
-
-Ruwiki is provided free of use and without any warranty express or implied. You may use,
-distribute, or modify Ruwiki under the conditions of Ruby's licence or the
-[http://www.gnu.org/copyleft/gpl.html GNU General Public Licence].
-
-* Ruwiki includes algorithm/diff by Lars Christensen, available for download from the RAA at: http://raa.ruby-lang.org/list.rhtml?name=diff
-* Ruwiki includes template.rb from Dave Thomas's RDoc system, available for download from SourceForge: http://rdoc.sourceforge.net
-
-Austin has also released several other projects available on the RAA that you
-may be interested in:
-* [http://raa.ruby-lang.org/list.rhtml?name=mime-types MIME::Types]
-* [http://raa.ruby-lang.org/list.rhtml?name=pdf-writer PDF::Writer]
-* [http://raa.ruby-lang.org/list.rhtml?name=text-format Text::Format]
-* [http://raa.ruby-lang.org/list.rhtml?name=trans-simple Transaction::Simple]
-* [http://raa.ruby-lang.org/list.rhtml?name=uninheritable Uninheritable]
diff --git a/ruwiki/tags/release-0.6/Ruwiki/ProjectIndex b/ruwiki/tags/release-0.6/Ruwiki/ProjectIndex
deleted file mode 100644
index 2d02ecf..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/ProjectIndex
+++ /dev/null
@@ -1,28 +0,0 @@
-id: 0
-topic: ProjectIndex
-version: 1
-#EHDR
-= Ruwiki 0.6.0
-This is the \ProjectIndex page for Ruwiki. For any given project, the
-\ProjectIndex topic will be the default topic for plain project links. As of
-Ruwiki 0.6.0, \ProjectIndex it is also the standard default page (not
-\DefaultPage).
-----
-== Features and Information
-* This wiki supports a variety of WikiFeatures that you may be interested in. The rules for WikiMarkup are similar to some other wikis, but there are a few unique markup capabilities in Ruwiki.
-* Configuring_Ruwiki is simple.
-* Extending_Ruwiki is almost as simple.
-* Who wrote Ruwiki? Look at the LicenseAndAuthorInfo.
-
-== Tracking Ruwiki Development
-The development progress of Ruwiki is kept in the wiki itself.
-* The BugTracking page in Ruwiki keeps track of open and closed bugs in Ruwiki.
-* The To_Do list keeps track of major development goals for Ruwiki.
-----
-== Different Features?
-If this wiki doesn't have the right combination of features, (or if it just
-doesn't feel right) try these other Ruby-based Wikis:
-
-* Amrita Wiki - http://www.walrus-ruby.org/amrita/cgi-bin/aswiki/aswiki.cgi
-* RWiki - http://rwiki.jin.gr.jp/cgi-bin/rw-cgi.rb?cmd=view;name=top
-* \MiniRubyWiki - http://www.xpsd.com/MiniRubyWiki
diff --git a/ruwiki/tags/release-0.6/Ruwiki/RuwikiTemplatingLibrary b/ruwiki/tags/release-0.6/Ruwiki/RuwikiTemplatingLibrary
deleted file mode 100644
index 14506d9..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/RuwikiTemplatingLibrary
+++ /dev/null
@@ -1,5 +0,0 @@
-id: 0
-topic: RuwikiTemplatingLibrary
-version: 1
-#EHDR
-s
diff --git a/ruwiki/tags/release-0.6/Ruwiki/SandBox b/ruwiki/tags/release-0.6/Ruwiki/SandBox
deleted file mode 100644
index 21e6a36..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/SandBox
+++ /dev/null
@@ -1,5 +0,0 @@
-id: 0
-topic: SandBox
-version: 1
-#EHDR
-This page is intended for users to play with freely to practice their \WikiFormatting.
diff --git a/ruwiki/tags/release-0.6/Ruwiki/To_Do b/ruwiki/tags/release-0.6/Ruwiki/To_Do
deleted file mode 100644
index 9f8c0f9..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/To_Do
+++ /dev/null
@@ -1,37 +0,0 @@
-id: 0
-topic: To_Do
-version: 1
-#EHDR
-= Ruwiki 0.6.0 To Do Tracking
-Completed to-do items can be found in the ChangeLog. Bugs in Ruwiki are
-tracked in BugTracking.
-
-== Well-Defined To Do Items
-; Topic renaming : add the ability to rename a topic within a project. Topic change history should be maintained.
-; Topic moving : add the ability to move and/or rename a topic between projects. Topic change history should be maintained.
-; Preview button : add a preview button to the save page.
-; Complete documentation : Complete the documentation of Ruwiki.
-; Versioning : complete the change history. Change history is currently stored in a file <i>topic</i>.rdiff. There is no way to display the change history at this point.
-; Escape HTML Entities : HTML Entities such as &amp;, &lt;, and &gt; are not currently escaped. This may cause problems with some browsers and should be fixed <b>without</b> impairing the ability to add at least some raw HTML. Note that the current engine does not check raw HTML and thus could potentially be vulnerable to cross-site-scripting attacks.
-
-== General To Do Items
-; Alternative templating systems : not as high priority now that there's a real templating system in place.
-; In-project topic search : searches for mentions of the topic in the other topics for the project.
-; Project topic listing : provide a special link (perhaps Project::Project) that displays the list of topics known to that project.
-; Project listing : provide a special link (perhaps ::*) that displays the list of known projects.
-; Project/topic security : allow certain projects to be restricted/authenticated for read/write based on user.
-; Track last <i>n</i> links/topics : ?
-; Write a markup debugger : ?
-; Validate topic formatting from cgi : ?
-; Validate project from cgi : ?
-; Project-based backend : Allow different projects to have different backends.
-; Hierachical project namespaces : ?
-
-== Future To Do Items
-; E-mail gateway : accept topic appends via e-mail.
-; alternative backends : access other wiki data storage, or other formats, e.g. e-mail boxes in mh or mbox formats
-; backend-to-backend storage format conversion : as noted
-; bug tracker backend : with alternate markup
-; add setup and user config methods : for backend plugin classes, then we can use them with an interactive or gui tool frontend to setup data storage backends. The user might have to run as root or other user with database create permissions.
-; add id="" to various markup elements (make id specific to topic) : Later we can allow users to tweak a page using uploaded css fragments which might get appended onto the standard css contents.
-; ruby action : upload a ruby code fragment to add a smart "action" to that wiki page. Need some sort of security + approval system to handle this safely.
diff --git a/ruwiki/tags/release-0.6/Ruwiki/WikiFeatures b/ruwiki/tags/release-0.6/Ruwiki/WikiFeatures
deleted file mode 100644
index 162c436..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/WikiFeatures
+++ /dev/null
@@ -1,13 +0,0 @@
-id: 0
-version: 1
-topic: WikiFeatures
-#EHDR
-Ruwiki is a [http://www.ruby-lang.org Ruby]-based wiki. It is ideal for
-personal or small team use.
-
-Ruwiki:
-* Uses the [http://www.ruby-lang.org Ruby] language.
-* Runs quickly and easily as a CGI or WEBrick servlet.
-* Uses a simple templating system and CSS for presentation.
-* Has flatfile storage with simple versioning.
-* Offers project namespaces. Different projects can have the same topic names and not collide. Thus, \Default::ReadMe and \Project::ReadMe are two different pages.
diff --git a/ruwiki/tags/release-0.6/Ruwiki/WikiMarkup b/ruwiki/tags/release-0.6/Ruwiki/WikiMarkup
deleted file mode 100644
index a9ddb49..0000000
--- a/ruwiki/tags/release-0.6/Ruwiki/WikiMarkup
+++ /dev/null
@@ -1,179 +0,0 @@
-id: 0
-topic: WikiMarkup
-version: 3
-#EHDR
-= Wiki Markup
-A [http://c2.com/cgi/wiki Wiki] obeys certain formatting rules to make it easy
-to format text without needing to know HTML. This Wiki obeys the following
-rules by default. Because Ruwiki is extensible, there may be additional
-formatting rules.
-
-== \WikiWords, \WikiProjects, Links, and Images
-While reading stuff on this Wiki, you will see some words mashed together with
-capitalisation (like \WikiWords). While this may seem odd at first, this
-feature allows internal links to be created across the Wiki.
-
-There are two allowable forms for \WikiWords. The first form has two or more words
-concatenated; each word must begin with a capital letter and be followed by
-one or more lowercase letters. Thus, \FooBar is a valid \WikiWord, while
-CPlusPlus is not. The second form has two or more words separated by
-underscores. This would make \Wiki_Phrases a valid \WikiWord. \WikiWords that
-are separated by underscores will be shown separated with spaces instead of
-underscores. That is, \Wiki_Phrases will be displayed as "Wiki Phrases".
-\WikiWords match the following regular expression:
-
- %r{\b([A-Z][a-z]+([A-Z][a-z]+|_[A-Z]?[a-z]+)+)\b}
-
-If a \WikiWord is found that does not have a page defining the \WikiWord, then
-the word will be shown with a hyperlink question mark following it, allowing
-the \WikiWord to be created.
-
-=== \WikiProjects
-This Wiki supports "projects." Within each project, a given \WikiWord is
-unique. Thus, if you have a Default project and a Ruwiki project, you can have
-two pages called \ReadMe. Any given \WikiWord refers only to topics within its
-project. That is, if I have \WikiWord in the \ReadMe topic of the Default
-project, it will refer to the \WikiWord topic of the Default project. (Another
-term for this capability is "namespaces.")
-
-A cross-project link is composed of the project's name, two colons (::), and
-the \WikiWord desired. Thus, from \Default::ReadMe, I can have \Ruwiki::ReadMe
-as a link. The project index can be referred to with \::Project. This is the
-same as doing \Project::ProjectIndex. Thus, \::Ruwiki becomes ::Ruwiki, which
-is the same as \Ruwiki::ProjectIndex (Ruwiki::ProjectIndex).
-
-=== External Links and Resources
-URLs to external resources are automatically detected for web addresses, FTP
-addresses, newsgroups, and email links. They are automatically converted to
-clickable URLs.
-
-* \http://www.ruby-lang.org becomes http://www.ruby-lang.org
-
-URLs may be named with the [url name] syntax. If the name is omitted, the URL will be numbered.
-
-* \[http://www.rubygarden.org RubyGarden] becomes [http://www.rubygarden.org RubyGarden].
-* \[http://www.halostatue.ca] and \[http://www.halostatue.ca/ruby] become [http://www.halostatue.ca] and [http://www.halostatue.ca/ruby].
-
-=== Images
-If URLs are to JPEG (.jpg, .jpeg), PNG (.png), or GIF (.gif) resources, they will be rendered as inline images. This works with automatically converted URLs, named URLs, or numbered URLs. Named and numbered URLs affect the TITLE and ALT attribute of the image.
-
-* \http://www.halostatue.ca/graphics/maple_leaf.gif http://www.halostatue.ca/graphics/maple_leaf.gif
-* \[http://www.halostatue.ca/graphics/maple_leaf.gif Maple Leaf] [http://www.halostatue.ca/graphics/maple_leaf.gif Maple Leaf]
-* \[http://www.halostatue.ca/graphics/maple_leaf.gif] [http://www.halostatue.ca/graphics/maple_leaf.gif]
-
-=== Ruby Mailing Lists
-If a Ruby mailing list message tag is provided, it will be converted appropriately.
-
-* \[ruby-talk:12345] will become [ruby-talk:12345]
-* \[ruby-core:12345] will become [ruby-core:12345]
-* \[ruby-doc:12345] will become [ruby-doc:12345]
-
-== Headings and Lists
-=== Headings
-Use equals signs (=) for headings. Up to six equals signs can be used for HTML
-headings 1 - 6.
-
-\===== Heading five<br />
-\====== Heading six
-
-===== Heading five
-====== Heading six
-
-=== Lists
-==== Bulleted Lists
-Use asterisks (*) to create bulleted lists. More asterisks means more levels.
-
-\* level 1<br />
-\** level 2<br />
-\*** level 3
-
-* level 1
-** level 2
-*** level 3
-==== Numbered Lists
-Use hash marks (#) for numbered lists. More hash marks means deeper levels.
-
-\# level 1<br />
-\## level 2<br />
-\### level 3<br />
-\# level 1.2
-
-# level 1
-## level 2
-### level 3
-# level 1.2
-==== Definition Lists
-Definitions can be created similar to other lists. Unlike "standard" lists,
-though, definition lists have both the term and the definition. They are
-specified like so. As with other lists, repeating the first item (;) will
-increase the indentation level.
-
-\; term : definition<br />
-\;; term2 : definition<br />
-\;;; term3 : definition
-
-; term : definition
-;; term2 : definition
-;;; term3 : definition
-== Paragraph Formatting
-=== Rules
-Four or more dashes ("----") on a line by itself makes a horizontal rule, like
-so:
-
-\----
-----
-=== Paragraphs
-A blank line (it may have whitespace on it) marks a new paragraph. All other
-lines are joined together (excepting headers, lists, and rules).
-
-This line is a new paragraph.
-=== Block Indent Paragraphs
-Paragraphs can be indented by beginning the paragraph with one or more colons
-(:).
-
-\: Indent Level 1<br />
-\:: Indent Level 2<br />
-\::: Indent Level 3
-
-: Indent Level 1
-:: Indent Level 2
-::: Indent Level 3
-=== Code
-Text that is indented will be presented as formatted in a monospaced font. The
-only change is to escape HTML entities &lt; (<), &gt; (>), and &amp; (&).
-
- def replace
- content = @match[1]
- %Q{<pre>#{content}</pre>}
- end
-
-== Miscellaneous Formatting
-=== HTML
-The Ruwiki engine passes through HTML without changes. Thus,
-&lt;b&gt;bold&lt;/b&gt; would be shown as <b>bold</b>. <b><i>Note:</i></b>
-This capability could be very dangerous as it could expose the Wiki to
-cross-site scripting (XSS) vulnerabilities. This will be remedied prior to the
-1.0 release of Ruwiki.
-
-=== Abbreviations
-Certain abbreviations may be known to the Wiki. While there is not yet any way
-for a user to query what abbreviations are known, if the abbreviations are
-told to the users, they may be used. Abbreviations are presented with @{key},
-where <i>key</i> is the abbreviation desired. This Wiki, for example, knows
-that \@{PM} means @{PM}. The special form \@{} will produce the current list
-of known abbreviations. Unknown abbreviations will simply be put back into the
-data stream unchanged. Thus, \@{unknownkey} results in @{unknownkey}.
-
-==== Known Abbreviations
-@{}
-
-=== Preventing Formatting
-If you wish to prevent a word or sequence from being interpreted, put a
-backslash (\) in front of it. This works on all formatting options except
-paragraph positioning. Thus, if I want to prevent a \WikiWord from being
-turned into a hyperlink, I need to backslash it: \\WikiWord.
-
-=== Other Possible Considerations
-I'm looking at adding styles similar to what is shown on the Wiki below.
-
-* http://www.pmichaud.com/wiki/PmWiki/WikiStyles
diff --git a/ruwiki/tags/release-0.6/lib/algorithm/diff.rb b/ruwiki/tags/release-0.6/lib/algorithm/diff.rb
deleted file mode 100644
index af36214..0000000
--- a/ruwiki/tags/release-0.6/lib/algorithm/diff.rb
+++ /dev/null
@@ -1,220 +0,0 @@
-#
-# algorith/diff - a Ruby module to compute difference sets between two
-# objects. Copyright (c) 2001-2002 Lars Christensen.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-#
-
-module Diff
-
- VERSION = 0.4
-
- attr_reader :diffs
-
- def Diff.lcs(a, b)
- astart = 0
- bstart = 0
- afinish = a.length-1
- bfinish = b.length-1
- mvector = []
-
- # First we prune off any common elements at the beginning
- while (astart <= afinish && bstart <= afinish && a[astart] == b[bstart])
- mvector[astart] = bstart
- astart += 1
- bstart += 1
- end
-
- # now the end
- while (astart <= afinish && bstart <= bfinish && a[afinish] == b[bfinish])
- mvector[afinish] = bfinish
- afinish -= 1
- bfinish -= 1
- end
-
- bmatches = b.reverse_hash(bstart..bfinish)
- thresh = []
- links = []
-
- (astart..afinish).each { |aindex|
- aelem = a[aindex]
- next unless bmatches.has_key? aelem
- k = nil
- bmatches[aelem].reverse_each { |bindex|
- if k && (thresh[k] > bindex) && (thresh[k-1] < bindex)
- thresh[k] = bindex
- else
- k = thresh.replacenextlarger(bindex, k)
- end
- links[k] = [ k!=0 && links[k-1], aindex, bindex ] if k
- }
- }
-
- if !thresh.empty?
- link = links[thresh.length-1]
- while link
- mvector[link[1]] = link[2]
- link = link[0]
- end
- end
-
- return mvector
- end
-
- def Diff.makediff(a, b)
- mvector = Diff.lcs(a, b)
- ai = bi = 0
- while ai < mvector.length
- bline = mvector[ai]
- if bline
- while bi < bline
- yield :+, bi, b[bi]
- bi += 1
- end
- bi += 1
- else
- yield :-, ai, a[ai]
- end
- ai += 1
- end
- while ai < a.length
- yield :-, ai, a[ai]
- ai += 1
- end
- while bi < b.length
- yield :+, bi, b[bi]
- bi += 1
- end
- 1
- end
-
- def Diff.diff(a, b, &block)
- isstring = b.kind_of? String
- diffs = []
-
- block ||= proc { |action, index, element|
- prev = diffs[-1]
- if prev && prev[0] == action &&
- prev[1] + prev[2].length == index
- prev[2] << element
- else
- diffs.push [ action, index, isstring ? element.chr : [element] ]
- end
- }
-
- Diff.makediff(a, b, &block)
-
- return diffs
- end
-
-end
-
-module Diffable
- def diff(b)
- Diff.diff(self, b)
- end
-
- # Create a hash that maps elements of the array to arrays of indices
- # where the elements are found.
-
- def reverse_hash(range = (0...self.length))
- revmap = {}
- range.each { |i|
- elem = self[i]
- if revmap.has_key? elem
- revmap[elem].push i
- else
- revmap[elem] = [i]
- end
- }
- return revmap
- end
-
- # Replace the first element which is larger than value. Assumes that
- # the element indexed by high, if given is larger than value.
-
- def replacenextlarger(value, high = nil)
- high ||= length
- low = 0
- index = found = nil
- while low < high
- index = (high+low) >> 1
- found = self[index]
- if value > found # this first, most common case
- low = index + 1
- elsif value == found
- return nil
- else
- high = index
- end
- end
- self[low] = value
- return low
- end
-
- # Patches self with the given set of differences.
-
- def patch(diffs)
- newary = nil
- kindofstring = kind_of? String
- if kindofstring
- newary = self.class.new('')
- else
- newary = self.class.new
- end
- ai = 0
- bi = 0
- diffs.each { |action,position,elements|
- case action
- when :-
- while ai < position
- newary << self[ai]
- ai += 1
- bi += 1
- end
- ai += elements.length
- when :+
- while bi < position
- newary << self[ai]
- ai += 1
- bi += 1
- end
- if kindofstring
- newary << elements
- else
- newary.push *elements
- end
- bi += elements.length
- else
- raise "Unknown diff action"
- end
- }
- while ai < self.length
- newary << self[ai]
- ai += 1
- bi += 1
- end
- return newary
- end
-end
-
-class Array
- include Diffable
-end
-
-class String
- include Diffable
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki.rb b/ruwiki/tags/release-0.6/lib/ruwiki.rb
deleted file mode 100644
index 91d9566..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki.rb
+++ /dev/null
@@ -1,263 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (austin@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-require 'cgi'
-require 'ruwiki/handler'
-require 'ruwiki/template'
-require 'ruwiki/config'
-require 'ruwiki/backend'
-require 'ruwiki/wiki'
-require 'ruwiki/page'
-require 'ruwiki/abbreviations'
-
- # = Ruwiki
- # Ruwiki is a simple, extensible Wiki written in Ruby. It supports both CGI
- # and WEBrick interfaces, templates, and CSS formatting. Additionally, it
- # supports project namespaces, so that two pages can be named the same for
- # differing projects without colliding or having to resort to odd naming
- # conventions. Please see ::Ruwiki in the running Wiki for more information.
- #
- # == Quick Install (CGI)
- # 1. Place the Ruwiki directory in a place that your webserver can execute
- # CGI programs. Ensure that ruwiki.cgi is executable on your webserver.
- # You may wish to protect templates/, data/, and lib/ from casual access.
- # 2. Modify the following lines in ruwiki.cgi:
- # wiki.config.webmaster = ...
- # wiki.config.title = ...
- # 3. Point your web browser to the appropriate URL.
- #
- # == Quick Install (WEBrick)
- # 1. Modify the following lines in ruwiki_servlet.rb:
- # $config.webmaster = ...
- # $config.title = ...
- # 2. Run ruwiki_servlet.rb to start a WEBrick instance on localhost:8808 with
- # ruwiki bound to the root path (e.g., http://localhost:8808/).
- # 3. Point your web browser to the appropriate URL.
- #
- # == Use
- # Ruwiki is able to be called with one of several URI forms:
- #
- # http://domain.com/ruwiki.cgi?PageName
- # http://domain.com/ruwiki.cgi?PageName&project=Project
- # http://domain.com/ruwiki.cgi/PageName
- # http://domain.com/ruwiki.cgi/Project/
- # http://domain.com/ruwiki.cgi/Project/PageName
- #
- # Copyright:: Copyright © 2003 - 2003, Digikata and HaloStatue, Ltd.
- # Authors:: Alan Chen (alan@digikata.com)
- # Austin Ziegler (ruwiki@halostatue.ca)
- # Licence:: Ruby's
-class Ruwiki
- VERSION = '0.6.0.0'
-
- ALLOWED_ACTIONS = ['edit', 'save', 'cancel']
- POST_VARS = ['newpage', 'pagename', 'project']
- RESERVED = ['action', ALLOWED_ACTIONS, POST_VARS].flatten
-
- # Returns the known abbreviations.
- attr_accessor :abbr
- # Returns the current configuration object.
- attr_reader :config
- # Returns the current Response object.
- attr_reader :response
- # Returns the current Request object.
- attr_reader :request
- # Returns the current Markup object.
- attr_reader :markup
- # Returns the current Backend object.
- attr_reader :backend
-
- # Sets the configuration object to a new configuration object.
- def config=(c)
- raise "Configuration must be of class Ruwiki::Config." unless c.kind_of?(Ruwiki::Config)
- @config = c
- end
-
- # Initializes Ruwiki.
- def initialize(handler)
- @request = handler.request
- @response = handler.response
-
- @config = Ruwiki::Config.new
- @abbr = Ruwiki::ABBREVIATIONS
- @request = request
- @response = response
- @path_info = @request.determine_request_path
-
- @type = nil
- @error = {}
-
- @markup = Ruwiki::Wiki.new(self)
- end
-
- # Initializes the backend for Ruwiki.
- def set_backend
- @backend = Backend[@config.storage_type, self]
- end
-
- # Runs the steps to process the wiki.
- def run
- @config.verify
- set_backend
- set_page
- process_page
- render
- rescue Exception => e
- render(:error, e)
- ensure
- output
- end
-
- # Initializes current page for Ruwiki.
- def set_page
- if @path_info.nil? or @path_info.empty? or @path_info == "/"
- @request.each_parameter do |key, val|
- next if RESERVED.include?(key)
- @page_name = key
- end
- @project_name = @request.parameters['project']
- @project_name ||= @config.default_project
- @page_name ||= @config.default_page
- else
- pi = @path_info.split("/", -1)
- case pi.size
- when 1
- @page_name = @config.default_page
- @project_name = @config.default_project
- when 2
- if pi[1].nil? or pi[1].empty?
- @page_name = @config.default_page
- else
- @page_name = pi[1]
- end
- @project_name = @config.default_project
- else
- if pi[2].nil? or pi[2].empty?
- @page_name = @config.default_page
- @project_name = pi[1]
- else
- @page_name = pi[2]
- @project_name = pi[1]
- end
- end
- end
- end
-
- # Processes the page through the necessary steps. This is where the edit,
- # save, cancel, and display actions are present.
- def process_page
- content = nil
- @page = @backend.retrieve(@page_name, @project_name)
- @type = :content
-
- if @request.parameters['action']
- case @request.parameters['action'].downcase.intern
- when :edit
- @backend.obtain_lock(@page)
- content = nil
- @type = :edit
- when :save
- @page.topic = @request.parameters['topic']
- @page.project = @request.parameters['project']
- @page.content = @request.parameters['newpage']
- @page.old_version = @request.parameters['old_version'].to_i + 1
- @page.version = @request.parameters['version'].to_i + 1
-
- content = @page.to_html
- @backend.store(@page)
- @backend.release_lock(@page)
- @type = :save
- when :cancel
- @page.topic = @request.parameters['topic']
- @page.project = @request.parameters['project']
- @page.content = @request.parameters['origpage'].unpack("m*")[0]
- @page.old_version = @request.parameters['old_version'].to_i
- @page.version = @request.parameters['version'].to_i
- content = @page.to_html
- @backend.release_lock(@page)
- end
- else
- content = @page.to_html
- end
- rescue Exception => e
- @type = :error
- if e.kind_of?(Ruwiki::Backend::BackendError)
- @error[:name] = "Error: #{e.to_s}"
- else
- @error[:name] = "Complete and Utter Failure: #{e.to_s}"
- end
- @error[:backtrace] = e.backtrace.join
- content = nil
- ensure
- @content = content
- end
-
- # Renders the page.
- def render(*args)
- if args.empty?
- type = @type
- error = @error
- else
- raise ArgumentError, "#render must be called with zero or two arguments." unless args.size == 2
- type = args[0]
- error = {}
- error[:name] = args[1].inspect.gsub(/&/, '&amp;').gsub(/</, '&lt;').gsub(/>/, '&gt;')
- error[:backtrace] = args[1].backtrace.join("<br />\n")
- end
-
- @rendered_page = ""
- values = { "css_link" => @config.css_link,
- "home_link" => %Q(<a href="#{@request.script_url}">#{@config.title}</a>) }
-
- case type
- when :content, :save
- values["wiki_title"] = "Error - #{@config.title}" if @page.nil?
- values["wiki_title"] ||= "#{@page.project}::#{@page.topic} - #{@config.title}"
- values["page_tolink"] = @page.to_link
- values["page_topic"] = @page.topic
- values["page_project"] = @page.project
- values["cgi_url"] = @request.script_url
- values["content"] = @content
- if type == :content
- template = TemplatePage.new(@config.template(:body), @config.template(:content), @config.template(:controls))
- else
- template = TemplatePage.new(@config.template(:body), @config.template(:save), @config.template(:controls))
- end
- when :edit
- template = TemplatePage.new(@config.template(:body), @config.template(:edit))
- values["wiki_title"] = "Editing: #{@page.project}::#{@page.topic} - #{@config.title}"
- values["page_topic"] = @page.topic
- values["page_project"] = @page.project
- values["cgi_url"] = @request.script_url
- values["page_content"] = @page.content
- values["orig_page"] = [@page.content].pack("m*")
- values["page_old_version"] = @page.old_version.to_s
- values["page_version"] = @page.version.to_s
- values["unedited_page_content"] = @page.to_html
- values["pre_page_content"] = CGI.escapeHTML(@page.content)
- when :error
- template = TemplatePage.new(@config.template(:body), @config.template(:error))
- values["wiki_title"] = "Error - #{@config.title}"
- values["name"] = error[:name]
- values["backtrace"] = error[:backtrace]
- values["backtrace_email"] = error[:backtrace].gsub(/<br \/>/, '')
- values["webmaster"] = @config.webmaster
- end
-
- template.write_html_on(@rendered_page, values)
- end
-
- # Outputs the page.
- def output
- @response.add_header("Content-type", "text/html")
- @response.write_headers
- @response << @rendered_page
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/abbreviations.rb b/ruwiki/tags/release-0.6/lib/ruwiki/abbreviations.rb
deleted file mode 100644
index b57acac..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/abbreviations.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- # Default abbreviations
- ABBREVIATIONS = {
- "PM" => "PocoMail"
- }
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/backend.rb b/ruwiki/tags/release-0.6/lib/ruwiki/backend.rb
deleted file mode 100644
index 35ba201..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/backend.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-require 'algorithm/diff'
-
-class Ruwiki
- # The Ruwiki backend abstract class and factory.
- class Backend
- BACKENDS = [:flatfiles] # :postgresql, :mysql, :odbc]
-
- STORE_ERROR = "No access to store topic.<br />\nThis is probably a RuWiki configuration error."
-
- class ProjectExists < StandardError #:nodoc:
- end
- class BackendError < StandardError #:nodoc:
- end
-
- # The default initializer for backend classes.
- def initialize(ruwiki)
- @ruwiki = ruwiki
- end
-
- # The Backend Factory. Requires and initializes the backend requested.
- def self.[](backend, ruwiki)
- raise RuntimeError, "Unknown Backend #{backend}" unless BACKENDS.include?(backend)
- befile = backend.to_s
- beconst = befile.capitalize
-
- require "ruwiki/backend/#{befile}"
-
- be = eval("Ruwiki::Backend::#{beconst}")
- be.new(ruwiki)
- end
-
- # Retrieve the specified topic and project page. Calls Backend#load
- # after verifying that the project exists.
- def retrieve(topic, project = 'Default')
- unless page_exists?(topic, project)
- if project_exists?(project)
- return Ruwiki::Page.new(@ruwiki,
- :content => "",
- :topic => topic,
- :project => project)
- else
- return Ruwiki::Page.new(@ruwiki,
- :content => "Project #{project} doesn't exist",
- :topic => topic,
- :project => project)
- end
- end
-
- buffer = load(topic, project)
- Ruwiki::Page.new(@ruwiki,
- :rawtext => buffer.join(''),
- :project => project,
- :topic => topic)
- end
-
- # Creates the current diff object.
- def make_diff(page, oldpage, newpage)
- {
- 'old_version' => page.old_version,
- 'new_version' => page.version,
- 'change_date' => Time.now,
- 'change_ip' => page.change_ip,
- 'change_id' => page.change_id,
- 'diff' => Diff.diff(oldpage, newpage)
- }
- end
-
- # Stores the specified topic and project page. Calls Backend#save.
- def store(page)
- save(page)
- end
-
- # Destroies the specified topic and project page.
- def destroy(page)
- raise
- end
-
- # Releases the lock on the page.
- def release_lock(page)
- raise
- end
-
- # Attempts to obtain a lock on the page.
- def obtain_lock(page)
- raise
- end
-
- # Checks to see if the project exists.
- def project_exists?(project)
- raise
- end
-
- # Checks to see if the page exists.
- def page_exists?(topic, project = 'Default')
- raise
- end
-
- # Attempts to create the project.
- def create_project(project)
- raise
- end
-
- # Attempts to destroy the project.
- def destroy_project(project)
- raise
- end
-
- def load(topic, project) #:nodoc:
- raise
- end
-
- def save(page) #:nodoc
- raise
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/backend/flatfiles.rb b/ruwiki/tags/release-0.6/lib/ruwiki/backend/flatfiles.rb
deleted file mode 100644
index b8da32f..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/backend/flatfiles.rb
+++ /dev/null
@@ -1,175 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-require 'algorithm/diff'
-
-class Ruwiki
- class Backend
- # Stores Ruwiki pages as flatfiles.
- class Flatfiles < Ruwiki::Backend
- # Initializes the flatfile backend.
- def initialize(ruwiki)
- ruwiki.config.data_path << "/" unless (ruwiki.config.data_path[-1] == ?/)
- raise Ruwiki::Backend::StandardError,
- "data directory #{ruwiki.config.data_path} does not exist." unless File.exists?(ruwiki.config.data_path)
- @data_path = ruwiki.config.data_path
- super ruwiki
- end
-
- # Loads the topic page from disk.
- def load(topic, project)
- pagefile = page_file(topic, project)
- buffer = File.readlines(pagefile)
- rescue Errno::EACCES
- raise Ruwiki::Backend::BackendError,
- "No access to retrieve the topic."
- rescue Exception => e
- raise Ruwiki::Backend::BackendError,
- "Cannot retrieve project [#{project}] topic [#{topic}] (file #{pf}): #{e}"
- end
-
-
- # Saves the topic page -- and its difference with the previous version
- # -- to disk.
- def save(page)
- pf = page_file(page.topic, page.project)
- cf = "#{pf}.rdiff"
-
- oldfile = File.readlines(pf) rescue []
- oldfile.collect! { |e| e.chomp }
- newfile = page.rawtext.split("\n")
-
- diff = make_diff(page, oldfile, newfile)
- diffs = []
- File.open(cf, 'rb') { |f| diffs = Marshal.load(f) } if File.exists?(cf)
- diffs << diff
- changes = Marshal.dump(diffs)
-
- File.open(cf, 'wb') { |cfh| cfh.print changes }
- File.open(pf, 'wb') { |pfh| pfh.puts page.rawtext }
- rescue Errno::EACCES
- raise BackendError, Ruwiki::Backend::STORE_ERROR
- rescue Exception => e
- raise BackendError, "Error storing page project [#{page.project}] topic [#{page.topic}]: #{e}<br />#{e.backtrace.join("<br />")}"
- end
-
- # Destroys the topic page.
- def destroy(page)
- pf = page_file(page.topic, page.project)
- File.unlink(pf) if File.exists?(pf)
- rescue Errno::EACCES
- raise BackendError, "No access to destroy topic."
- rescue Exception => e
- raise BackendError, "Unable to destroy project [#{project}] topic [#{topic}]: #{e}"
- end
-
- # Checks to see if the project exists.
- def project_exists?(project)
- pd = project_directory(project)
- File.exists?(pd) and File.directory?(pd)
- end
-
- # Checks to see if the page exists.
- def page_exists?(topic, project = 'Default')
- pf = page_file(topic, project)
- project_exists?(project) and File.exists?(pf)
- end
-
- # Tries to create the project.
- def create_project(project)
- pd = project_directory(project)
- raise ProjectExists, "Project #{project} already exists." if File.exists?(pd)
- Dir.mkdir(pd)
- rescue Errno::EACCES
- raise BackendError, "No access to create project."
- rescue Exception => e
- raise BackendError, "Unable to create project [#{project}]: #{e}"
- end
-
- # Tries to destroy the project.
- def destroy_project(project)
- pd = project_directory(project)
- Dir.rmdir(pd) if File.exists?(pd) and File.directory?(pd)
- rescue Errno::EACCES
- raise BackendError, "No access to destroy project."
- rescue Exception => e
- raise BackendError, "Unable to destroy project [#{project}]: #{e}"
- end
-
- # Attempts to obtain a lock on the topic page.
- def obtain_lock(page)
- lf = "#{page_file(page.topic, page.project)}.lock"
-
- lock_okay = false
- # See if we have the lock already.
- if File.exists?(lf)
- data = File.readlines(lf)
- # If the lock belongs to this address, we don't care how old it
- # is. Thus, release it.
- lock_okay ||= (data[0].chomp == @ruwiki.request.environment['REMOTE_ADDR'])
- # If the lock is older than 10 minutes, release it.
- lock_okay ||= ((data[1].to_i + 600) < Time.now.to_i)
- else
- lock_okay = true
- end
-
- if lock_okay
- open(lf, 'w') { |lfh| lfh.puts "#{@ruwiki.request.environment['REMOTE_ADDR']}\n#{Time.now.to_i + 600}" }
- else
- raise BackendError, "Unable to obtain a lock on page project [#{page.project}] topic [#{page.topic}]. Try again in ten minutes."
- end
- rescue Errno::EACCES
- raise BackendError, "unable to create lock on page project [#{page.project}] topic [#{page.topic}]."
- rescue BackendError
- raise
- rescue Exception => e
- raise BackendError, "Error storing page project [#{page.project}] topic [#{page.topic}]: #{e}"
- end
-
- # Releases the lock on the topic page.
- def release_lock(page)
- lf = "#{page_file(page.topic, page.project)}.lock"
-
- lock_okay = false
- if File.exists?(lf)
- data = File.readlines(lf)
- # If the lock belongs to this address, then we can safely remove
- # it.
- lock_okay ||= (data[0].chomp == @ruwiki.request.environment['REMOTE_ADDR'])
- # If the lock is older than 10 minutes, release it.
- lock_okay ||= (data[1].to_i < Time.now.to_i)
- else
- lock_okay = true
- end
-
- if lock_okay
- File.unlink(lf) if File.exists?(lf)
- else
- raise BackendError, "Unable to release the lock on page project [#{page.project}] topic [#{page.topic}]. Try again in ten minutes."
- end
- rescue Errno::EACCES
- raise BackendError, "unable to create lock on page [#{page.project}] topic [#{page.topic}]."
- rescue BackendError
- raise
- rescue Exception => e
- raise BackendError, "Error storing page project [#{page.project}] topic [#{page.topic}]: #{e}"
- end
-
- private
- def project_directory(project)
- "#{@data_path}#{project}"
- end
-
- def page_file(topic, project = 'Default')
- "#{project_directory(project)}/#{topic}"
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/config.rb b/ruwiki/tags/release-0.6/lib/ruwiki/config.rb
deleted file mode 100644
index c2d66c4..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/config.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- # Ruwiki configuration.
- class Config
- TEMPLATES = [ :body, :content, :error, :edit, :controls, :save ]
-
- # Adds additional information to the (rare) error reports. Defaults to
- # +false+.
- attr_accessor :debug
- # The default page for display when Ruwiki is called without any
- # arguments. Defaults to +ProjectIndex+
- attr_accessor :default_page
- # The default project for display when Ruwiki is called without any
- # arguments or a project specification. Defaults to +Default+
- attr_accessor :default_project
- # The storage type as a Symbol. Corresponds to a filename that will be
- # found in ruwiki/backend. In this version of Ruwiki, only flatfiles.rb
- # (e.g., :flatfiles) is defined. Defaults to <tt>:flatfiles</tt>.
- attr_accessor :storage_type
- # The path for flatfile storage. Defaults to <tt>./data/</tt>.
- attr_accessor :data_path
- # The path for templates. Defaults to <tt>./templates/</tt>.
- attr_accessor :template_path
- # The name of the Wiki. Defaults to <tt>ruwiki</tt>
- attr_accessor :title
- # The email address of the webmaster for the Wiki. Defaults to +nil+.
- attr_accessor :webmaster
- # The name of the Ruwiki CSS file. Defaults to <tt>ruwiki.css</tt>.
- attr_accessor :css
- # The template set. Templates are always named as
- # <template_path>/<template_set>/<template_kind>.
- #Template filename. Must be reachable by File#read.
- attr_accessor :template_set
-
- # Returns the template string
- def template(kind = :body)
- raise ConfigError, "No template for #{kind.inspect} in template set #{@template_set}" unless TEMPLATES.include?(kind)
- File.read(File.join(@template_path, @template_set, "#{kind.to_s}.tmpl"))
- end
-
- # Returns the CSS stylesheet content for the Wiki. This previously
- # returned the <link> to the stylesheet, but instead returns a <style>
- # block in the head so that the CSS is kept with the template set, which
- # may be kept outside of the HTML area.
- def css_link
- %Q[<style>#{File.read(File.join(@template_path, @template_set, @css))}</style>]
- end
-
- # Creates a new configuration object.
- def initialize
- @debug = false
- @default_project = "Default"
- @default_page = "ProjectIndex"
- @storage_type = :flatfiles
- @data_path = "./data/"
- @template_path = "./templates/"
- @template_set = "default"
- @css = "ruwiki.css"
- @webmaster = nil
- @title = "Ruwiki"
- end
-
- # Verifies that required configuration options are actually set. Right
- # now, it only checks the values that are defaulted to +nil+.
- def verify
- raise ConfigError, "Configuration error: Webmaster is unset." if @webmaster.nil?
- end
-
- class ConfigError < StandardError #:nodoc:
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/handler.rb b/ruwiki/tags/release-0.6/lib/ruwiki/handler.rb
deleted file mode 100644
index 2bf24a5..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/handler.rb
+++ /dev/null
@@ -1,207 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Handler
- class << self
- # Generate a new Handler pair from a CGI request.
- def from_cgi(cgi, output_stream = $stdout)
- Ruwiki::Handler.new do |o|
- o.request = Ruwiki::Handler::CGIRequest.new(cgi)
- o.response = Ruwiki::Handler::CGIResponse.new(cgi, output_stream)
- end
- end
-
- # Generate a new Handler pair from a WEBrick request.
- def from_webrick(req, res)
- Ruwiki::Handler.new do |o|
- o.request = Ruwiki::Handler::WEBrickRequest.new(req)
- o.response = Ruwiki::Handler::WEBrickResponse.new(res)
- end
- end
- end
-
- # Returns the handler's request object.
- attr_accessor :request
- # Returns the handler's response object.
- attr_accessor :response
-
- # Creates the handler pair.
- def initialize(&block) #:yields: self
- @request = nil
- @response = nil
- yield self if block_given?
- end
-
- # REpresents an abstract incoming request. This insulates the rest of
- # the code from knowing whether parameters are passed as part of the
- # path, as parameters in the URL, or in some other fashion.
- class AbstractRequest
- def initialize(*args)
- end
- end
-
- # Handles all requests from web applications.
- #
- # Subclasses should provide:
- # @parameters:: Hash-like object that responds to #[] and #hash_key?]
- # @environment:: Hash-like object that responds to #[]
- class AbstractWebRequest < AbstractRequest
- # The parameters provided via the web request.
- attr_reader :parameters
- # The environment provided to the web request.
- attr_reader :environment
- # The request path.
- attr_reader :path
-
- # Yields each parameter key in succession.
- def each_parameter #:yields: key, value
- @parameters.each { |k, v| yield k, v }
- end
-
- def each_environment #:yields: key, value
- @environment.each { |k, v| yield k, v }
- end
-
- # Return the URL of our server.
- def server_url
- res = "http://" # should detect whether we're in secure server mode.
- if @environment['HTTP_HOST']
- res << @environment['HTTP_HOST']
- else
- res << "#{@environment['SERVER_NAME']}:#{@environment['SERVER_PORT']}"
- end
- end
-
- # Return the URL of this script.
- def script_url
- server_url << @environment['SCRIPT_NAME'].to_s
- end
-
- # Return the URL of this request.
- def request_url
- res = script_url
- res << @environment['PATH_INFO'] if @environment['PATH_INFO']
- query = @environment['QUERY_STRING']
- res << "?#{@environment['QUERY_STRING']}" if query && !query.empty?
- res
- end
-
- # Convert a file path into a URL
- def make_url(project, path)
- "#{server_url}/#{project}/#{path}"
- end
-
- def determine_request_path
- @path = ""
- return @path if @environment['PATH_INFO'].nil?
- @path = @environment['PATH_INFO'].dup
- end
- end
-
- # Request for CGI-based activity to ruwiki.
- class CGIRequest < AbstractWebRequest
- def initialize(cgi, output_stream = $stdout)
- @environment = ENV
- @cgi = cgi
- @parameters = {}
- cgi.params.each { |k, v| @parameters[k] = v[0] }
- super
- end
- end
-
- # Request for WEBrick based servlet activity to ruwiki.
- class WEBrickRequest < AbstractWebRequest
- def initialize(req)
- @environment = req.meta_vars
- @parameters = req.query
- super
- end
- end
-
- # Used to write responses in different execution environments such as
- # CGI and Webrick.
- #
- # If you want to create a new response object, you'll need to implement
- # #add_header, #write_headers, and #<<.
- #
- # The Response object is instantiated with an output stream which must
- # supply +<<+ and +puts+ methods.
- class AbstractResponse
- # Add to the list of headers to be sent back to the client.
- def add_header(key, value)
- raise "Not implemented"
- end
-
- # Write the accumulated headers back to the client.
- def write_headers
- raise "Not implemented"
- end
-
- # Write the string to the client.
- def <<(string)
- raise "Not implemented"
- end
-
- # output_stream must respond to #<< and #puts.
- def initialize(output_stream = $stdout)
- @headers = {}
- @output_stream = output_stream
- end
- end
-
- # CGIResponse is the response object for CGI mode.
- class CGIResponse < AbstractResponse
- # output_stream must respond to #<< and #puts.
- def initialize(cgi, output_stream = $stdout)
- @cgi = cgi
- super(output_stream)
- end
-
- # Add the header pair for later output as a CGI header.
- def add_header(key, value)
- @headers[key] = value
- end
-
- # Write the headers to the stream. The headers can only be written
- # once.
- def write_headers
- return if @written
- @headers.each { |key, value| @output_stream.puts "#{key}: #{value}\r\n" }
- @output_stream.puts
- @written = true
- end
-
- # Output the string to the stream provided.
- def <<(string)
- @output_stream << string
- end
- end
-
- # WEBrickResponse is the response object for WEBrick servlet mode.
- class WEBrickResponse < AbstractResponse
- def initialize(webrick_response)
- @response = webrick_response
- end
-
- def add_header(key,value)
- @response[key] = value
- end
-
- def write_headers
- # Webrick will take care of this on its own.
- end
-
- def <<(string)
- @response.body << string
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/markup.rb b/ruwiki/tags/release-0.6/lib/ruwiki/markup.rb
deleted file mode 100644
index c572d8e..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/markup.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-require 'ruwiki/markup/meta'
-
-class Ruwiki
- # The abstract markup class. Probably unnecessary.
- class Markup
- # Creates the markup class.
- def initialize(ruwiki)
- @ruwiki = ruwiki
- end
-
- # Returns a topic/projec combination as a viewable link.
- def view_link(topic, project, content = nil)
- content = topic if content.nil?
- project = (project == @ruwiki.config.default_project) ? "" : "#{project}/"
- %Q{<a class="rw_pagelink" href="#{@ruwiki.request.script_url}/#{project}#{topic}">#{content.gsub(/_/, ' ')}</a>}
- end
-
- # Returns a topic/projec combination as an edit link.
- def edit_link(topic, project, content = nil)
- content = topic if content.nil?
- project = (project == @ruwiki.config.default_project) ? "" : "project=#{project}&amp;"
- %Q{<span class="rw_edittext">#{content.gsub(/_/, ' ')}</span><a class="rw_pagelink" href="#{@ruwiki.request.script_url}?action=edit&amp;#{project}#{topic}">?</a>}
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/markup/meta.rb b/ruwiki/tags/release-0.6/lib/ruwiki/markup/meta.rb
deleted file mode 100644
index 3438fcd..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/markup/meta.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Markup
- # Stores metadata generated during the parsing process.
- class Meta
- # links to external sites
- attr_reader :external
- # links to internal sites
- attr_reader :internal
-
- # Initializes the metadata object.
- def initialize(ruwiki)
- @ruwiki = ruwiki
- @internal = []
- @external = []
- end
-
- # Adds a link to the appropriate bucket in the metadata.
- def add_link(link, style = :internal)
- if style == :internal
- @internal << link unless @internal.include?(link)
- elsif style == :external
- @external << link unless @external.include?(link)
- end
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/page.rb b/ruwiki/tags/release-0.6/lib/ruwiki/page.rb
deleted file mode 100644
index 3b3d846..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/page.rb
+++ /dev/null
@@ -1,144 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- # A generic page for Ruwiki.
- class Page
- # The page ID.
- attr_accessor :page_id
- # The current version of the page.
- attr_accessor :version
- # The previous version of the page.
- attr_accessor :old_version
- # The page topic (the name of the page).
- attr_accessor :topic
- # The project of the page.
- attr_accessor :project
- # Unformatted page text.
- attr_reader :content
- # Formatted page text.
- attr_accessor :formatted
-
- # The internal links known to the page.
- attr_accessor :internal
- # The external links known to the page.
- attr_accessor :external
-
- # The IP address of the person who made the last change.
- def change_ip
- %Q<#{@ruwiki.request.environment['REMOTE_HOST']} (#{@ruwiki.request.environment['REMOTE_ADDR']})>
- end
-
- # The ID, if present, of the person who made the last change. Not yet
- # implemented.
- def change_id
- nil
- end
-
- # Creates a Ruwiki page.
- def initialize(ruwiki, init = {})
- @ruwiki = ruwiki
- @internal = []
- @external = []
-
- @project = init[:project] || @ruwiki.config.default_project
- @topic = init[:topic] || "NewTopic"
- @content = init[:content] || ""
- @page_id = init[:page_id] || 0
- @version = init[:version] || 0
- @old_version = @version - 1
-
- if init.has_key?(:rawtext)
- @rawtext = init[:rawtext].dup
- @content = parse_header(@rawtext.dup)
- @formatted = parse_content(@content, @project)
- elsif not @content.empty?
- @formatted = parse_content(@content.dup, @project)
- else
- @formatted = ""
- end
- @content.gsub!(/\r/, "")
- end
-
- # The content of the page.
- def content=(content)
- @content = content.gsub(/\r/, "")
- @formatted = parse_content(content, @project)
- end
-
- # Output raw header and raw page context for saving.
- def rawtext
- return <<-EOS
-id: #{@page_id}
-topic: #{@topic}
-version: #{@version}
-#EHDR
-#{@content}
- EOS
- end
-
- # Outputs the HTML version of the page.
- def to_html
- @formatted
- end
-
- # Produces a link to the current page.
- def to_link(css_class = "rw_pagelink")
- css_class = %Q{class="#{css_class} "} unless css_class.nil?
- project = (@project == @ruwiki.config.default_project) ? "" : "#{@project}/"
- %Q{<a #{css_class}href="#{@ruwiki.request.script_url}/#{project}#{@topic}">#{@topic}</a>}
- end
-
- private
- HEADER_RE = /^([a-z]+)\s*:\s*(.*)$/
- HEADER_END_RE = /^#EHDR$/
-
- # Parse the header.
- def parse_header(rawtext)
- rawbuf = rawtext.split("\n")
-
- loop do
- break if rawbuf.nil? or rawbuf.empty?
-
- if rawbuf[0] =~ HEADER_END_RE
- rawbuf.shift
- break
- end
-
- match = HEADER_RE.match(rawbuf[0])
-
- if match
- case match[1].intern
- when :id
- @page_id = match[2].to_i
- when :topic
- @topic = match[2]
- when :version
- @version = match[2].to_i
- @old_version = @version - 1
- end
- rawbuf.shift
- end
- end
-
- rawbuf.join("\n")
- end
-
- # Parse the content.
- def parse_content(content, project)
- parsed, meta = @ruwiki.markup.parse(content, project)
-
- @internal = meta.internal
- @external = meta.external
-
- parsed
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/servlet.rb b/ruwiki/tags/release-0.6/lib/ruwiki/servlet.rb
deleted file mode 100644
index 3144b23..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/servlet.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-require 'webrick'
-
-class Ruwiki
- class Servlet < WEBrick::HTTPServlet::AbstractServlet
- def initialize(config)
- @config = config
- end
-
- # Converts a POST into a GET.
- def do_POST(req, res)
- do_GET(req, res)
- end
-
- def do_GET(req, res)
- # Generate the reponse handlers for Ruwiki from the request and response
- # objects provided.
- wiki = Ruwiki.new(Ruwiki::Handler.from_webrick(req, res))
-
- # Configuration defaults to certain values. This overrides the defaults.
- wiki.config = $config unless $config.nil?
- wiki.run
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/template.rb b/ruwiki/tags/release-0.6/lib/ruwiki/template.rb
deleted file mode 100644
index a285eed..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/template.rb
+++ /dev/null
@@ -1,223 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# This file is originally from rdoc by Dave Thomas (dave@pragprog.com).
-#
-# $Id$
-#++
-class Ruwiki
- # RDoc's cheap-n-cheerful HTML page template system. You create a template
- # containing:
- #
- # * variable names between percent signs (<tt>%fred%</tt>)
- # * blocks of repeating stuff:
- # START:key
- # ... stuff
- # END:key
- #
- # You feed the code a hash. For simple variables, the values are resolved
- # directly from the hash. For blocks, the hash entry corresponding to +key+
- # will be an array of hashes. The block will be generated once for each
- # entry. Blocks can be nested arbitrarily deeply.
- #
- # The template may also contain:
- # IF:key
- # ... stuff
- # ENDIF:key
- #
- # _stuff_ will only be included in the output if the corresponding key is
- # set in the value hash.
- #
- # Usage: Given a set of templates <tt>T1, T2,</tt> etc
- # values = { "name" => "Dave", state => "TX" }
- # t = TemplatePage.new(T1, T2, T3)
- # File.open(name, "w") {|f| t.write_html_on(f, values)}
- # or
- # res = ''
- # t.write_html_on(res, values)
- #
- class TemplatePage
-
- # A context holds a stack of key/value pairs (like a symbol table). When
- # asked to resolve a key, it first searches the top of the stack, then
- # the next level, and so on until it finds a match (or runs out of
- # entries).
- class Context
- def initialize
- @stack = []
- end
-
- def push(hash)
- @stack.push(hash)
- end
-
- def pop
- @stack.pop
- end
-
- # Find a scalar value, throwing an exception if not found. This method
- # is used when substituting the %xxx% constructs
- def find_scalar(key)
- @stack.reverse_each do |level|
- if val = level[key]
- return val unless val.kind_of? Array
- end
- end
- raise "Template error: can't find variable '#{key}'"
- end
-
- # Lookup any key in the stack of hashes
- def lookup(key)
- @stack.reverse_each do |level|
- val = level[key]
- return val if val
- end
- nil
- end
- end
-
- # Simple class to read lines out of a string
- class LineReader
- # we're initialized with an array of lines
- def initialize(lines)
- @lines = lines
- end
-
- # read the next line
- def read
- @lines.shift
- end
-
- # Return a list of lines up to the line that matches a pattern. That
- # last line is discarded.
- def read_up_to(pattern)
- res = []
- while line = read
- if pattern.match(line)
- return LineReader.new(res)
- else
- res << line
- end
- end
- raise "Missing end tag in template: #{pattern.source}"
- end
-
- # Return a copy of ourselves that can be modified without affecting us
- def dup
- LineReader.new(@lines.dup)
- end
- end
-
- # +templates+ is an array of strings containing the templates. We start at
- # the first, and substitute in subsequent ones where the string
- # <tt>!INCLUDE!</tt> occurs. For example, we could have the overall page
- # template containing
- #
- # <html><body>
- # <h1>Master</h1>
- # !INCLUDE!
- # </bost></html>
- #
- # and substitute subpages in to it by passing [master, sub_page]. This
- # gives us a cheap way of framing pages
- def initialize(*templates)
- result = "!INCLUDE!"
- templates.each do |content|
- result.sub!(/!INCLUDE!/, content)
- end
- @lines = LineReader.new(result.split($/))
- end
-
- # Render the templates into HTML, storing the result on +op+ using the
- # method <tt><<</tt>. The <tt>value_hash</tt> contains key/value pairs
- # used to drive the substitution (as described above)
- def write_html_on(op, value_hash)
- @context = Context.new
- op << substitute_into(@lines, value_hash).tr("\000", '\\')
- end
-
- # Substitute a set of key/value pairs into the given template. Keys with
- # scalar values have them substituted directly into the page. Those with
- # array values invoke <tt>substitute_array</tt> (below), which examples a
- # block of the template once for each row in the array.
- #
- # This routine also copes with the <tt>IF:</tt>_key_ directive, removing
- # chunks of the template if the corresponding key does not appear in the
- # hash, and the START: directive, which loops its contents for each value
- # in an array
- def substitute_into(lines, values)
- @context.push(values)
- skip_to = nil
- result = []
-
- while line = lines.read
-
- case line
-
- when /^IF:(\w+)/
- lines.read_up_to(/^ENDIF:#$1/) unless @context.lookup($1)
-
- when /^IFNOT:(\w+)/
- lines.read_up_to(/^ENDIF:#$1/) if @context.lookup($1)
-
- when /^ENDIF:/
- ;
-
- when /^START:(\w+)/
- tag = $1
- body = lines.read_up_to(/^END:#{tag}/)
- inner_values = @context.lookup(tag)
- raise "unknown tag: #{tag}" unless inner_values
- raise "not array: #{tag}" unless inner_values.kind_of?(Array)
- inner_values.each do |vals|
- result << substitute_into(body.dup, vals)
- end
- else
- result << expand_line(line.dup)
- end
- end
-
- @context.pop
-
- result.join("\n")
- end
-
- # Given an individual line, we look for %xxx% constructs and
- # HREF:ref:name: constructs, substituting for each.
- def expand_line(line)
- # Generate a cross reference if a reference is given,
- # otherwise just fill in the name part
-
- line.gsub!(/HREF:(\w+?):(\w+?):/) do
- ref = @context.lookup($1)
- name = @context.find_scalar($2)
-
- if ref and !ref.kind_of?(Array)
- "<a href=\"#{ref}\">#{name}</a>"
- else
- name
- end
- end
-
- # Substitute in values for %xxx% constructs. This is made complex
- # because the replacement string may contain characters that are
- # meaningful to the regexp (like \1)
-
- line = line.gsub(/%([a-zA-Z]\w*)%/) do
- val = @context.find_scalar($1)
- val.tr('\\', "\000")
- end
-
- line
- rescue Exception => e
- $stderr.puts "Error in template: #{e}"
- $stderr.puts "Original line: #{line}"
- exit
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki.rb
deleted file mode 100644
index e54d88c..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-require 'ruwiki/markup'
-
-class Ruwiki
- # Ruwiki's Wiki markup class. This will convert the Wiki markup known by
- # Ruwiki (defined by Token classes). The algorithm is as follows:
- #
- # 1. For each known Token class, match each instance of it in the content
- # stream. Replace each instance in the content stream with a Token
- # marker: TOKEN_x or \TOKEN_x, where x is a digit representing the
- # Token. (\TOKEN_x is a special case of token matching. See
- # Ruwiki::Markup::Token for more information.) Store the Token for
- # later processing.
- # 2. Go back through the content, replacing each instance of \TOKEN_x
- # with the Token's defined restore value (which should be the same
- # value as was originally matched).
- # 3. Go through the content, replacing each instance of TOKEN_x with the
- # Token's defined replacement value.
- # 4. Go through the tokens, in reverse, and execute the post replacement
- # routine defined by the Token. (This may be necessary to collapse
- # consecutive HTML structures.)
- # 5. Return the parsed content and the collected metadata.
- #
- # == Tokens
- # Look at Ruwiki::Markup::Token describes how to create Token objects.
- class Wiki < Ruwiki::Markup
- def parse(content, project = nil)
- content = content.dup
- meta = Ruwiki::Markup::Meta.new(@ruwiki)
- tokens = []
- project ||= @ruwiki.config.default_project
-
- Token.tokenlist.each do |token|
- content.gsub!(token.regexp) do |m|
- match = Regexp.last_match
- tc = token.new(@ruwiki, match, meta, project)
- tokens << tc
- if m[0, 1] == '\\'
- "\\TOKEN_#{tokens.size - 1}"
- else
- "TOKEN_#{tokens.size - 1}"
- end
- end
- end
-
- replaced = []
- s = true
- loop do
- break if replaced.size >= tokens.size
- break if s.nil?
- s = content.gsub!(/\\TOKEN_(\d+)/) { |m|
- match = Regexp.last_match
- itoken = match[1].to_i
- replaced << itoken
- tokens[itoken].restore
- }
-
- s = content.gsub!(/TOKEN_(\d+)/) { |m|
- match = Regexp.last_match
- itoken = match[1].to_i
- replaced << itoken
- tokens[itoken].replace
- }
- end
-
- 3.times do
- tokens.reverse_each { |token| token.post_replace(content) }
- end
-
- [content, meta]
- end
- end
-end
-
-require 'ruwiki/wiki/tokens'
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens.rb
deleted file mode 100644
index 189a8a3..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens.rb
+++ /dev/null
@@ -1,128 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Wiki
- # The base Token class. All Token classes must inherit from Token and
- # *must* implement the following methods:
- #
- # [self.regexp] The regular expression that the Token will be
- # replacing.
- # [replace] The mechanism for replacing the Token with the desired
- # results.
- #
- # Token classes <i>should</i> implement the following method:
- # [self.rank] Default: <tt>5000</tt>. Affects the sort order. Must
- # return an integer.
- #
- # Token classes <i>may</i> implement the following methods:
- # [restore] Restores the token without replacement. Implements the
- # results of the escape character. NOTE: each Token
- # class is responsible for its own restore. Tokens that
- # are anchored to the beginning of a line are the most
- # likely to need to reimplement this.
- # [post_replace] Performs any necessary massaging of the data. See the
- # implementation of Ruwiki::Wiki::Lists for more
- # information.
- class Token
- @@tokenlist = []
- @@sorted = false
-
- class << self
- # Tokens should define rank if they must be first or last in
- # processing. Otherwise, they are sorted in the order defined.
- def rank
- 5000
- end
-
- # The Wiki parsing routine uses Token.tokenlist to determine the
- # tokens that are processed, and the order in which they are
- # processed. See Token.rank for more information.
- def tokenlist
- unless @@sorted
- head = @@tokenlist.shift
- @@tokenlist.sort! { |a, b| a.rank <=> b.rank }
- @@tokenlist.unshift(head)
- sorted = true
- end
- @@tokenlist
- end
-
- def inherited(child_class) #:nodoc:
- @@tokenlist << Token if @@tokenlist.empty?
-
- # Make the child class post_replace a blank function because we
- # don't want to propogate the currently defined post_replace.
- # The current post_replace is specific to Token_Base only.
- class << child_class
- def post_replace(content)
- content
- end
- end
-
- @@tokenlist << child_class
- @@sorted = false
- end
-
- # The replacement regular expression.
- def regexp
- /TOKEN_(\d*)/
- end
- end
-
- # All Token classes must match this header signature if they define
- # #initialize.
- #
- # [ruwiki] The owner Ruwiki object.
- # [match] The MatchData object for this Token.
- # [meta] The metadata that may be stored by the Token.
- # [project] The project being processed.
- def initialize(ruwiki, match, meta, project = nil)
- @ruwiki = ruwiki
- @match = match
- @meta = meta
- @project = project || @ruwiki.config.default_project
- end
-
- # The replacement method. Uses @match to replace the token with the
- # appropriate values.
- def replace
- "TOKEN_#{@match[1]}"
- end
-
- # Restores the token without replacement. By default, replaces
- # "dangerous" HTML characters.
- def restore
- @match[0].gsub(/&/, "&amp;").gsub(/</, "&lt;").gsub(/>/, "&gt;")
- end
-
- # The content may need massaging after processing.
- def post_replace(content)
- content
- end
- end
- end
-end
-
- # Load the tokens from the ruwiki/wiki/tokens directory.
-tokens_dir = 'ruwiki/wiki/tokens'
-
-$LOAD_PATH.each do |path|
- target = "#{path}/#{tokens_dir}"
- if File.exists?(target) and File.directory?(target)
- Dir::glob("#{target}/*.rb") do |token|
- begin
- require token
- rescue LoadError
- nil
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/00default.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/00default.rb
deleted file mode 100644
index a6a6479..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/00default.rb
+++ /dev/null
@@ -1,239 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Wiki
- # The Paragraph Token class changes blank lines to <p> tags. This class,
- # under the current implementation, should be *first* in the Token list
- # after Token.
- class Paragraph < Ruwiki::Wiki::Token
- # This Token is #rank 0, because it should be first in the Token list.
- def self.rank
- 0
- end
-
- # Matches blank lines. %r{^\s*$}
- def self.regexp
- %r{^\s*$}
- end
-
- # Replaces with "<p>"
- def replace
- "<p>"
- end
-
- # Ensures that <p> won't be surrounded by <br> tags.
- def post_replace(content)
- content.gsub!(%r{(\n|<br ?/?>)?<p>(\n|<br ?/?>)?}, '<p>')
- content.gsub!(%r{<p>}, '</p><p>')
- content.gsub!(%r{</p>(</p>)+}, '</p>')
- content.gsub!(%r{<body></p>}, '<body>')
- content.gsub!(%r{</body>}, '</p></body>')
- content.gsub!(%r{<p></p>}, '')
- content.gsub!(%r{(</h\d>)</p>}, '\1')
- content
- end
- end
-
- # The Code Token class converts indented text to "unformatted" (<pre>)
- # text. This class should be *second* in the Token list.
- class Code < Ruwiki::Wiki::Token
- # This Token is #rank 1, because it should be second in the Token list.
- def self.rank
- 1
- end
-
- # Matches indented text. %r{^(\s+\S.*)$}
- def self.regexp
- %r{^(\s+\S.*)$}
- end
-
- # Replaces the text to <pre>content</pre>.
- def replace
- content = @match[1].gsub(/&/) { "&amp;" }.gsub(/</) { "&lt;" }.gsub(/>/) { "&gt;" }
- %Q{<pre>#{content}</pre>}
- end
-
- # Converts cases of %r{</pre>(\n|<br ?/?>)<pre>} to \1.
- def post_replace(content)
- content.gsub!(%r{</pre>(\n|<br ?/?>)?<pre>}, '\1')
- content.gsub!(%r{<p><pre>}, '<pre>')
- content.gsub!(%r{</pre></p>}, '</pre>')
- content
- end
- end
-
- # Converts URLs in the form of [url] to numbered links.
- class NumberedLinks < Ruwiki::Wiki::Token
- def self.rank
- 2
- end
-
- def initialize(ruwiki, match, parse, project = nil)
- super
- @@count = 0
- end
-
- def self.regexp
- %r{\[((https?|ftp|mailto|news):[^\s<>\]]*?)\]}
- end
-
- IMAGE_RE = /(jpg|jpeg|png|gif)$/
-
- def replace
- extlink = @match[1]
-
- @@count += 1
- name = "[#{@@count}]"
-
- if extlink =~ IMAGE_RE
- %Q{<img src="#{extlink}" title="#{name}" alt="#{name}" />}
- else
- @meta.add_link(extlink, :external)
- %Q{<a class="rw_extlink" href="#{extlink}">#{name}</a>}
- end
- end
- end
-
- # Converts URLs in the form of [url name] to named links.
- class NamedLinks < Ruwiki::Wiki::Token
- def self.rank
- 3
- end
-
- def self.regexp
- %r{\[(((https?)|(ftp)|(mailto)|(news)):[^\s<>]*)\s+([^\]]*)\]}
- end
-
- IMAGE_RE = /(jpg|jpeg|png|gif)$/
-
- def replace
- extlink = @match[1]
- name = @match[7]
-
- if extlink =~ IMAGE_RE
- %Q{<img src="#{extlink}" title="#{name}" alt="#{name}" />}
- else
- @meta.add_link(extlink, :external)
- %Q{<a class="rw_extlink" href="#{extlink}">#{name}</a>}
- end
- end
- end
-
- # Converts URLs to links where the "name" of the link is the URL itself.
- class ExternalLinks < Ruwiki::Wiki::Token
- def self.rank
- 4
- end
-
- def self.regexp
- %r{\b((https?|ftp|mailto|news):[^\s<>]*)}
- end
-
- IMAGE_RE = /(jpg|jpeg|png|gif)$/
-
- def replace
- extlink = @match[1]
-
- if extlink =~ IMAGE_RE
- %Q{<img src="#{extlink}" title="Image at: #{extlink}" alt="Image at: #{extlink}" />}
- else
- @meta.add_link(extlink, :external)
- %Q{<a class="rw_extlink" href="#{extlink}">#{extlink}</a>}
- end
- end
- end
-
- # Creates a crosslink for a Project::WikiPage.
- class ProjectCrossLink < Ruwiki::Wiki::Token
- def self.rank
- 502
- end
-
- def self.regexp
- %r{([A-Z][a-z]+)::([A-Z][a-z]+([A-Z][a-z]+)+)}
- end
-
- def replace
- project = @match[1]
- topic = @match[2]
-
- return @ruwiki.markup.edit_link(topic, project, "#{project}::#{topic}") unless @ruwiki.backend.page_exists?(topic, project)
- @ruwiki.markup.view_link(topic, project, "#{project}::#{topic}")
- end
- end
-
- # Creates a link to the project index from ::Project.
- class ProjectIndex < Ruwiki::Wiki::Token
- def self.rank
- 501
- end
-
- def self.regexp
- %r{(\B|\\)::([A-Z][a-z]+)}
- end
-
- def restore
- @match[0][1..-1]
- end
-
- def replace
- pn = @match.captures[1]
- %Q(<a class="rw_projectindex" href="#{@ruwiki.request.script_url}/#{pn}/ProjectIndex">#{pn}</a>)
- end
- end
-
- # Creates a link to a WikiPage in the current project.
- class WikiLinks < Ruwiki::Wiki::Token
- def self.rank
- 503
- end
-
- def self.regexp
- %r{(\b|\\)([A-Z][a-z]+([A-Z][a-z]+|_[A-Z]?[a-z]+)+)\b}
- end
-
- def restore
- @match[0][1..-1]
- end
-
- def replace
- topic = @match.captures[1]
- @meta.add_link(topic)
- if @ruwiki.backend.page_exists?(topic, @project)
- @ruwiki.markup.view_link(topic, @project)
- else
- @ruwiki.markup.edit_link(topic, @project)
- end
- end
- end
-
- # Creates a horizontal rule.
- class HRule < Ruwiki::Wiki::Token
- def self.regexp
- %r|^\\?-{4,}|
- end
-
- def replace
- "<hr />"
- end
-
- def restore
- @match[0][1 .. -1]
- end
-
- def post_replace(content)
- content.gsub!(%r{<hr ?/?>\n<br ?/?>}, "<hr />")
- content.gsub!(%r{(\n|<br ?/?>)?<hr>(\n|<br ?/?>)?}, "<hr />")
- content
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/abbreviations.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/abbreviations.rb
deleted file mode 100644
index d65489c..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/abbreviations.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Wiki
- # Converts abbreviations.
- class Abbreviations < Ruwiki::Wiki::Token
- def self.regexp
- %r!@{([^}]*)}!
- end
-
- def replace
- k = @match[1]
- if k.nil? or k.empty?
- data = "<dl>"
- @ruwiki.abbr.each do |k, v|
- data << "<dt>#{k}</dt><dd>#{v}</dd>"
- end
- data << "</dl>"
- else
- if @ruwiki.abbr.has_key?(k)
- data = @ruwiki.abbr[k]
- else
- data = @match[0]
- end
- end
- data
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/headings.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/headings.rb
deleted file mode 100644
index 21da302..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/headings.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Wiki
- # Converts headings.
- class Headings < Ruwiki::Wiki::Token
- def self.rank
- 2
- end
-
- def self.regexp
- %r{^\\?(=+)\s+(.*)}
- end
-
- def restore
- @match[0][1 .. -1]
- end
-
- def replace
- level = @match[1].count("=")
- content = @match[2]
- level = 6 if level > 6
- "<h#{level}>#{content}</h#{level}>"
- end
-
- def post_replace(content)
- content.gsub!(%r{<p>(<h\d>)}, '\1')
- content.gsub!(%r{(</h\d>)</p>}, '\1')
- content
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/lists.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/lists.rb
deleted file mode 100644
index 11769b5..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/lists.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Wiki
- # Produces Lists
- class Lists < Ruwiki::Wiki::Token
- def self.regexp
- %r{^\\?((\*)+|(#)+)\s+(.*)}
- end
-
- def replace
- content = @match[4]
-
- if @match[3].nil?
- char = '*'
- elem = 'ul'
- else
- char = '#'
- elem = 'ol'
- end
-
- indent = @match[1].count(char)
-
- pre = ""
- post = ""
- indent.times do
- pre << "<#{elem}><li>"
- post << "</li></#{elem}>"
- end
- "#{pre}#{content}#{post}"
- end
-
- def restore
- @match[0][1 .. -1]
- end
-
- def post_replace(content)
- content.gsub!(%r{</[uo]l>\n?<[uo]l>}, '')
- content.gsub!(%r{</ol>(\n|(<br ?/?>))?<ol>}, '')
- content.gsub!(%r{</ul>(\n|(<br ?/?>))?<ul>}, '')
- content.gsub!(%r{<li><([uo]l)>}, '<\1>')
- content.gsub!(%r{</([uo]l)></li>}, '</\1>')
- content
- end
- end
-
- # Produces block quotes.
- class Blockquotes < Ruwiki::Wiki::Token
- def self.regexp
- %r{^\\?(:+)\s+(.*)$}
- end
-
- def replace
- content = @match[2]
- indent = @match[1].count(":")
-
- pre = ""
- post = ""
- indent.times do
- pre << "<blockquote>"
- post << "</blockquote>"
- end
- "#{pre}#{content}#{post}"
- end
-
- def restore
- @match[0][1 .. -1]
- end
-
- def post_replace(content)
- content.gsub!(%r{</blockquote>(\n|<br ?/?>)?<blockquote>}, '')
- content
- end
- end
-
- # Produces definition lists. Does not completely work correctly.
- class Definitions < Ruwiki::Wiki::Token
- def self.regexp
- %r{^\\?(;+)\s+([^:]+)\s+:\s+(.*)}
- end
-
- def replace
- definition = @match[3]
- term = @match[2]
- indent = @match[1].count(';')
-
- pre = ""
- post = ""
- indent.times do
- pre << "<dl>"
- post << "</dl>"
- end
- "#{pre}<dt>#{term}</dt><dd>#{definition}</dd>#{post}"
- end
-
- def restore
- @match[0][1 .. -1]
- end
-
- def post_replace(content)
- content.gsub!(%r{</dl>(\n|<br ?/?>)?<dl>}, '')
- content
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/rubylists.rb b/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/rubylists.rb
deleted file mode 100644
index 39db408..0000000
--- a/ruwiki/tags/release-0.6/lib/ruwiki/wiki/tokens/rubylists.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-class Ruwiki
- class Wiki
- # Convert ruby-talk mailing list references (e.g., [ruby-talk:12345])
- # into named links.
- class RubyTalkLinks < Ruwiki::Wiki::Token
- def self.rank
- 2
- end
-
- def self.regexp
- %r{\[ruby-talk:(\d+)\]}
- end
-
- def replace
- lm = @match.captures[0]
- %Q(<a class="rw_extlink" href="http://www.ruby-talk.org/#{lm}">#{@match[0]}</a>)
- end
- end
-
- # Convert ruby-core/ext/dev/list/math mailing list references (e.g.,
- # [ruby-core:12345]) into named links.
- class OtherRubyLinks < Ruwiki::Wiki::Token
- def self.rank
- 2
- end
-
- def self.regexp
- %r{\[ruby-(list|doc|core|dev|ext|math):(\d+)\]}
- end
-
- def replace
- ln, lm = @match.captures[0..1]
- %Q(<a class="rw_extlink" href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-#{ln}/#{lm}">#{@match[0]}</a>)
- end
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/ruwiki.cgi b/ruwiki/tags/release-0.6/ruwiki.cgi
deleted file mode 100644
index d6a93c4..0000000
--- a/ruwiki/tags/release-0.6/ruwiki.cgi
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env ruby
-#--
-# Ruwiki version 0.6.0
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# This file may be renamed to change the URI for the wiki.
-#
-# $Id$
-
- # Customize this if you put the RuWiki files in a different location.
-$LOAD_PATH.unshift("lib")
-
-require 'ruwiki'
-
- # This is the CGI version of Ruwiki. Therefore, when we create the Ruwiki
- # instance, we specify that the request and response handlers are to be
- # generated from a new CGI object.
-wiki = Ruwiki.new(Ruwiki::Handler.from_cgi(CGI.new))
-
- # Configuration defaults to certain values. This overrides the defaults.
- # The webmaster.
-wiki.config.webmaster = "webmaster@domain.com"
-
-# wiki.config.debug = false
-# wiki.config.title = "Ruwiki"
-# wiki.config.default_page = "ProjectIndex"
-# wiki.config.default_project = "Default"
-# wiki.config.storage_type = :flatfiles
-# wiki.config.data_path = "./data/"
-# wiki.config.template_path = "./templates/"
-# wiki.config.template_set = "default"
-# wiki.config.css = "ruwiki.css"
-
-wiki.run
diff --git a/ruwiki/tags/release-0.6/ruwiki_servlet.rb b/ruwiki/tags/release-0.6/ruwiki_servlet.rb
deleted file mode 100644
index 8db398d..0000000
--- a/ruwiki/tags/release-0.6/ruwiki_servlet.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env ruby
-#
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (ruwiki@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-
- # Customize this if you put the RuWiki files in a different location.
-$LOAD_PATH.unshift("lib")
-
-require 'webrick'
-require 'getopts'
-require 'ruwiki'
-require 'ruwiki/servlet'
-
-getopts "", 'p:8808'
-
- # This is for the WEBrick version of Ruwiki. This has been abstracted to
- # accept a $config global variable to reconfigure Ruwiki after initial
- # creation.
-$config = Ruwiki::Config.new
-
- # Configuration defaults to certain values. This overrides the defaults.
- # The webmaster.
-$config.webmaster = "webmaster@domain.com"
-
-# $config.debug = false
-# $config.title = "Ruwiki"
-# $config.default_page = "DefaultPage"
-# $config.default_project = "Default"
-# $config.storage_type = :flatfiles
-# $config.data_path = "./data/"
-# $config.css = "ruwiki.css"
-# $config.template_file = nil
-
-s = WEBrick::HTTPServer.new(
- :Port => $OPT_p.to_i,
- :StartThreads => 1,
- :Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG))
-s.mount("/", Ruwiki::Servlet)
-trap("INT") { s.shutdown; exit }
-s.start
diff --git a/ruwiki/tags/release-0.6/templates/default/body.tmpl b/ruwiki/tags/release-0.6/templates/default/body.tmpl
deleted file mode 100644
index 087a810..0000000
--- a/ruwiki/tags/release-0.6/templates/default/body.tmpl
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
- <head>
- <title>%wiki_title%</title>
- %css_link%
- </head>
- <body>
- !INCLUDE!
- </body>
-</html>
diff --git a/ruwiki/tags/release-0.6/templates/default/content.tmpl b/ruwiki/tags/release-0.6/templates/default/content.tmpl
deleted file mode 100644
index f15bf2f..0000000
--- a/ruwiki/tags/release-0.6/templates/default/content.tmpl
+++ /dev/null
@@ -1,4 +0,0 @@
-!INCLUDE!
-<!-- topic content -->
-%content%
-<!-- topic content -->
diff --git a/ruwiki/tags/release-0.6/templates/default/controls.tmpl b/ruwiki/tags/release-0.6/templates/default/controls.tmpl
deleted file mode 100644
index 2e50002..0000000
--- a/ruwiki/tags/release-0.6/templates/default/controls.tmpl
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="rw_nav">
- %home_link% | Topic: <b>%page_topic%</b> Project: <a href="%cgi_url%/%page_project%/"><b>%page_project%</b></a> | <a href="%cgi_url%?action=edit&amp;project=%page_project%&amp;%page_topic%">Edit</a>
-</div>
diff --git a/ruwiki/tags/release-0.6/templates/default/edit.tmpl b/ruwiki/tags/release-0.6/templates/default/edit.tmpl
deleted file mode 100644
index c8cf91a..0000000
--- a/ruwiki/tags/release-0.6/templates/default/edit.tmpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="rw_nav">%home_link% | <i>Editing</i> Topic: <b>%page_topic%</b> Project: <b>%page_project%</b></div><br />
-
-<form class="rw_edit_form" action="%cgi_url%/%page_project%/%page_topic%" method="post">
- <textarea name="newpage" rows="15" cols="90">%page_content%</textarea>
- <input type="hidden" name="origpage" value="%orig_page%" />
- <input type="hidden" name="topic" value="%page_topic%" />
- <input type="hidden" name="project" value="%page_project%" />
- <input type="hidden" name="old_version" value="%page_old_version%" />
- <input type="hidden" name="version" value="%page_version%" /><br />
- <input type="submit" name="action" value="Save" />
- <input type="submit" name="action" value="Cancel" />
-</form>
-<div class="rw_edit_raw"><h2>Raw Original Value</h2><pre>%pre_page_content%</pre></div>
-<div class="rw_edit_format"><h2>Formatted Version</h2>%unedited_page_content%</div>
diff --git a/ruwiki/tags/release-0.6/templates/default/error.tmpl b/ruwiki/tags/release-0.6/templates/default/error.tmpl
deleted file mode 100644
index 7c91995..0000000
--- a/ruwiki/tags/release-0.6/templates/default/error.tmpl
+++ /dev/null
@@ -1,4 +0,0 @@
-<div class="rw_nav">%home_link%</div>
-<h1>%name%</h1>
-<p>Send the webmaster a report by <a href="mailto:%webmaster%?subject=%name%&amp;body=%backtrace_email%">email</a>.</p>
-<p>%backtrace%</p>
diff --git a/ruwiki/tags/release-0.6/templates/default/ruwiki.css b/ruwiki/tags/release-0.6/templates/default/ruwiki.css
deleted file mode 100644
index 3e60491..0000000
--- a/ruwiki/tags/release-0.6/templates/default/ruwiki.css
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $Id$ */
-body
-{
- color: black;
- font-size: medium;
- background-color: #F2FFA7;
-}
-
-li { margin-top: 0.25em; margin-bottom: 0.25em; }
-pre { background-color: #FFFFA7; border: 1px solid black; }
-
-.rw_nav { background-color: #E9967A }
-.rw_edittext { border: 1px dotted blue }
-.rw_pagelink { }
-.rw_extlink { border: 1px solid red }
-.rw_projectxlink { }
-.rw_projectindex { }
-.rw_edit_form { }
-.rw_edit_raw {
- border: 2px solid green;
- float: left;
- max-width: 48%;
- overflow: scroll;
- clear: right;
-}
-.rw_edit_format {
- border: 2px solid blue;
- float: right;
- max-width: 48%;
- clear: none;
-}
diff --git a/ruwiki/tags/release-0.6/templates/default/save.tmpl b/ruwiki/tags/release-0.6/templates/default/save.tmpl
deleted file mode 100644
index 8ce9f8c..0000000
--- a/ruwiki/tags/release-0.6/templates/default/save.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-!INCLUDE!
-Saved page %page_project%::%page_tolink%<hr />
-<!-- topic content -->
-%content%
-<!-- topic content -->
diff --git a/ruwiki/tags/release-0.6/tests/debugger.rb b/ruwiki/tags/release-0.6/tests/debugger.rb
deleted file mode 100644
index 3efba37..0000000
--- a/ruwiki/tags/release-0.6/tests/debugger.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require 'ruwiki/config'
-
-require 'rw_config.rb'
-
-module Markup_Debug
- def projectlist
- end
-
- def pagelist
- end
-
- def parse(in_pagecontent,project=$rw_default_project)
- pagecontent = in_pagecontent.dup
- pd = Parse_Data.new
- tokens = Array.new
-
- # pass 1 scan and replace
- Token_Base.tokenlist.each do |token_class|
- pagecontent.gsub!(token_class.regexp) { |match|
- md = Regexp.last_match
- tc = token_class.new(md,pd,project)
- tokens.push( tc )
- "TOKEN_#{tokens.size - 1}"
- }
- end
-
- # pass 2 fill in token replaces
- pagecontent.gsub!(/TOKEN_(\d*)/) { |match|
- md = Regexp.last_match
- itoken = md[1].to_i
- tokens[itoken].replace
- }
-
- # pass 3 run fixups for each token type
- tokens.reverse_each { |token|
- token.post_replace(pagecontent)
- }
-
- return [pagecontent, pd]
- end
-end
diff --git a/ruwiki/tags/release-0.6/tests/tc_backend.rb b/ruwiki/tags/release-0.6/tests/tc_backend.rb
deleted file mode 100644
index 6cc0bf1..0000000
--- a/ruwiki/tags/release-0.6/tests/tc_backend.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright (c)2002, Digikata
-# Author: Alan Chen (alan@digikata.com)
-#
-# $Id$
-# License: same as ruby
-
-require 'test/unit'
-require 'test_utils.rb'
-require 'rw_config.rb'
-
-class Test_Backend_Text < Test::Unit::TestCase
- include Test_Utils
-
- def set_up
- # The $backend variable should be setup now
- @page_topic = 'TestPageBackend'
- @page_proj = 'Default'
-
- page_rawtext = "id: 0
-topic: #{@page_topic}
-#EHDR
-Test page for unit test.
-"
-
- testing_page(:set_up, @page_topic, page_rawtext)
- Backend.setup(:flatfiles)
-
- but = '../data/Backend_Unit_Test'
- Dir.rmdir(but) if FileTest.exist?(but)
-
- file = '../data/Default/NoTopic'
- File.unlink(file) if FileTest.exist?(file)
-
- @txtback = Backend::Back_Flatfile.new($rw_paths.data)
- end
-
- def tear_down
- testing_page(:tear_down, @page_topic)
- end
-
- # check retreive (somewhat redundant, tc_page does this more extensively)
- def test_01
- page = @txtback.retreive(@page_topic, @page_proj)
-
- assert_equal(@page_topic, page.topic)
- assert_equal(@page_proj, page.project)
- assert_instance_of(Ruwiki::Page,page)
- end
-
- # check exist?
- def test_02
- assert_equal("/var/www/dev/ruwiki/data/#{@page_proj}/#{@page_topic}",
- @txtback.pagefile(@page_topic,@page_proj))
-
- assert(@txtback.project_exists?(@page_proj))
- assert(@txtback.page_exists?(@page_topic, @page_proj))
- assert(!@txtback.page_exists?('ShouldNotExist', @page_proj))
- end
-
- # check project create and destroy
- def test_03
- but = 'Backend_Unit_Test'
- assert_equal(false, @txtback.project_exists?(but))
- @txtback.create_project(but)
- assert(@txtback.project_exists?(but))
- @txtback.destroy_project(but)
- assert_equal(false, @txtback.project_exists?(but))
- end
-
- # page create and destroy
- def test_04
- topic = 'NoTopic'
- project = 'Default'
-
- assert_equal(false, @txtback.page_exists?(topic,project))
-
- page = Ruwiki::Page.new(:topic => topic,
- :content => 'none',
- :pg_id => 1000,
- :project => project)
-
- @txtback.store(page)
- assert(@txtback.page_exists?(topic,project))
- assert(@txtback.page_exists?(page.topic,page.project))
-
- @txtback.destroy(page)
- assert_equal(false, @txtback.page_exists?(topic,project))
- assert_equal(false, @txtback.page_exists?(page.topic,page.project))
- end
-
-
- # retreive a non-existent page
- def test_05
- topic = 'NonExistent'
- project = 'Default'
-
- # prereq - page shouldn't exist yet
- assert_equal(false, @txtback.page_exists?(topic,project))
-
- page = @txtback.retreive(topic,project)
- assert_equal(false, @txtback.page_exists?(topic,project))
- @txtback.store(page)
- assert_equal(true, @txtback.page_exists?(topic,project))
- @txtback.destroy(page)
- assert_equal(false, @txtback.page_exists?(topic,project))
- end
-
-
- # page rename
- # list projects
-end
-
diff --git a/ruwiki/tags/release-0.6/tests/tc_markup.rb b/ruwiki/tags/release-0.6/tests/tc_markup.rb
deleted file mode 100644
index 7b221c1..0000000
--- a/ruwiki/tags/release-0.6/tests/tc_markup.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/ruby
-#
-# look at c2t.rb for test scaffolding
-# $LOAD_PATH.unshift('') # place code into load path
-#
-require 'test/unit'
-require 'rw_config.rb'
-
-class Test_Wiki_Markup < Test::Unit::TestCase
-
- def set_up
- $backend = Backend::Back_Flatfile.new($rw_paths.data)
- @mw = Markup::Wiki.new($backend)
- @sample_page01 = "This is a sample page
-SampleLink
-External link http://digikata.com
-"
- @sample_page01_links = ['SampleLink']
- @sample_page01_elinks = ['http://digikata.com']
- end
-
- def tear_down
- @mw = nil
- end
-
- def test__misc_fragments
- fragments = [
- ['* listitem', '<ul><li>listitem</li></ul>'],
- ['# listitem', '<ol><li>listitem</li></ol>'],
- ["\n \nHallo", "<p>Hallo"],
- ['----', "<hr>"],
- ['11\11\2002', '11\11\2002'],
- ['TestPage', %Q(TestPage<a class="rw_pagelink" href="ruwiki.cgi?action=edit&TestPage">?</a>)]
- ]
-
- fragments.each { |frag|
- rawtext, extransformed, exparsedata = frag
- transformed, parsedata = @mw.parse(rawtext)
- assert_equal(extransformed, transformed)
- assert_equal(exparsedata, parsedata) if( exparsedata != nil )
- }
- end
-
- def test__ordered_list_concat
- content = "* item1\n* item2"
- tfm, pd = @mw.parse(content)
- assert_equal(%Q(<ul><li>item1</li><li>item2</li></ul>), tfm)
- end
-
- def test_01
- content = "TestPage"
- expected = %Q(TestPage<a class="rw_pagelink" href="ruwiki.cgi?action=edit&TestPage">?</a>)
- newcontent, parsedata = @mw.parse(content)
- assert_equal(expected, newcontent)
- assert_equal(['TestPage'], parsedata.links)
- end
-
- def test_02
- extlink = 'http://127.0.0.1/hallo/TestPage'
- content = <<ECON
-#{extlink}
-TestPage
-SampleLink
-ECON
-
- expected = %Q(<a class="rw_extlink" href="#{extlink}">#{extlink}</a>
-TestPage<a class="rw_pagelink" href="ruwiki.cgi?action=edit&TestPage">?</a>
-SampleLink<a class="rw_pagelink" href="ruwiki.cgi?action=edit&SampleLink">?</a>
-)
-
- newcontent, parsedata = @mw.parse(content)
- assert_equal(expected, newcontent)
- assert_equal([extlink], parsedata.elinks)
- assert_equal(['TestPage','SampleLink'], parsedata.links )
- end
-
- def test_03
- newcontent, parsedata = @mw.parse(@sample_page01)
- assert_equal(@sample_page01_links, parsedata.links)
- assert_equal(@sample_page01_elinks, parsedata.elinks)
- end
-
-
-end
diff --git a/ruwiki/tags/release-0.6/tests/tc_page.rb b/ruwiki/tags/release-0.6/tests/tc_page.rb
deleted file mode 100644
index e39f3ac..0000000
--- a/ruwiki/tags/release-0.6/tests/tc_page.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/ruby
-#
-# look at c2t.rb for test scaffolding
-# $LOAD_PATH.unshift('') # place code into load path
-#
-require 'test/unit'
-require 'test_utils.rb'
-require 'rw_config.rb'
-
-class Test_Page < Test::Unit::TestCase
- include Test_Utils
-
- def set_up
- @sample_page01 = "id: 1
-topic: SamplePage
-#EHDR
-This is a sample page
-SampleLink
-External link http://digikata.com
-"
- testing_page(:set_up)
- end
-
- def tear_down
- testing_page(:tear_down)
- end
-
- def test_01
- page = Ruwiki.process(@sample_page01)
-
- assert_equal(Ruwiki::Page, page.class)
- assert_equal(1, page.pg_id)
- assert_equal('SamplePage', page.topic)
- assert_equal(['SampleLink'], page.links)
- assert_equal(['http://digikata.com'], page.ext_links)
- end
-
- def test_02
- page = Ruwiki::Page.new
- page.topic = 'NewTopic'
- page.pg_id = '1000'
- page.content = 'none'
-
- assert_equal("id: 1000
-topic: NewTopic
-#EHDR
-none", page.to_s)
- end
-
- def test_03
- page = $backend.retreive('TestPage','Default')
- assert_equal(0, page.pg_id)
- end
-
- def test_04
- page = Ruwiki::Page.new
- page.topic = 'TestPage1'
- page.pg_id = 1000
- page.content = 'none'
- page.project = 'Default'
- $backend.store(page)
-
- goodname = '../data/Default/TestPage1'
- assert(FileTest.exist?(goodname))
- File.unlink(goodname)
- end
-end
diff --git a/ruwiki/tags/release-0.6/tests/tc_ruwiki.rb b/ruwiki/tags/release-0.6/tests/tc_ruwiki.rb
deleted file mode 100644
index 745c8cd..0000000
--- a/ruwiki/tags/release-0.6/tests/tc_ruwiki.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env ruby
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (austin@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-
- # Customize this if you put the RuWiki files in a different location.
-$LOAD_PATH.unshift("../lib")
-
-require 'ruwiki'
-require 'test/unit'
-
-class Test_Backend_Flat
-end
-
-
-begin
- rw = Ruwiki.new
- # Configuration defaults to certain values. This overrides the defaults.
-
- # Configure the URL to the Wiki.
- rw.config.url = "http://domain.com/"
- # The webmaster.
- rw.config.webmaster = "webmaster@domain.com"
-
- # This should ensure that the CGI is always appropriately named
- rw.config.cgi = __FILE__
-
-# rw.config.debug = false
-# rw.config.title = "Ruwiki"
-# rw.config.default_page = "DefaultPage"
-# rw.config.default_project = "Default"
-# rw.config.storage_type = :flatfiles
-# rw.config.data_path = "./data/"
-# rw.config.css = "ruwiki.css"
-
- rw.config.verify
-
- rw.set_backend
- rw.set_page
- rw.process_page
- rw.output
-rescue => e
- rw.cgi.out do
- rw.cgi.html do
- "\n" +
- rw.cgi.head do
- [ "", rw.cgi.title { "Error - #{rw.config.title}" }, rw.config.css_link, "" ].join("\n")
- end + "\n" +
- rw.cgi.body { "<h1>#{e}</h1><p>#{e.backtrace.join("\n")}" }
- end
- end
-end
diff --git a/ruwiki/tags/release-0.6/tests/test_utils.rb b/ruwiki/tags/release-0.6/tests/test_utils.rb
deleted file mode 100644
index b05ec18..0000000
--- a/ruwiki/tags/release-0.6/tests/test_utils.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#--
-# Ruwiki
-# Copyright © 2002 - 2003, Digikata and HaloStatue
-# Alan Chen (alan@digikata.com)
-# Austin Ziegler (austin@halostatue.ca)
-#
-# Licensed under the same terms as Ruby.
-#
-# $Id$
-#++
-
-content =
-
-module Test_Utils
- TEST_UTILS_DEFAULT_CONTENT = "id: 0
-topic: TestPage
-#EHDR
-Test page for unit test.
-"
-
- # create and delete a test page file, used for testing
- def testing_page(op, topic='TestPage', content=TEST_UTILS_DEFAULT_CONTENT)
- testdir = '../data/Default'
- testpage = testdir + '/' + topic
- case op
- when :set_up
- unless FileTest.exist?(testdir)
- raise StandardError, "Error #{testdir} doesn't exist"
- end
- if FileTest.exist?(testpage)
- raise StandardError, "Error #{testpage} already exists"
- end
- open(testpage, 'w') { |tph| tph.print content }
-
- when :tear_down
- File.unlink(testpage)
- end
- end
-end