clwiki 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +31 -0
- data/Rakefile +53 -0
- data/app/assets/javascripts/cl_wiki/application.js +29 -0
- data/app/assets/stylesheets/cl_wiki/application.css +103 -0
- data/app/controllers/cl_wiki/application_controller.rb +4 -0
- data/app/controllers/cl_wiki/page_controller.rb +106 -0
- data/app/helpers/cl_wiki/application_helper.rb +4 -0
- data/app/views/cl_wiki/page/edit.html.erb +8 -0
- data/app/views/cl_wiki/page/find.html.erb +27 -0
- data/app/views/cl_wiki/page/recent.html.erb +4 -0
- data/app/views/cl_wiki/page/recent.rss.builder +18 -0
- data/app/views/cl_wiki/page/show.html.erb +1 -0
- data/app/views/layouts/cl_wiki/application.html.erb +14 -0
- data/config/clwiki.yml +73 -0
- data/config/initializers/clwiki.rb +9 -0
- data/config/routes.rb +15 -0
- data/lib/cl_wiki.rb +12 -0
- data/lib/cl_wiki/configuration.rb +171 -0
- data/lib/cl_wiki/engine.rb +5 -0
- data/lib/cl_wiki/file.rb +171 -0
- data/lib/cl_wiki/find_in_file.rb +33 -0
- data/lib/cl_wiki/format/format.blockquote.rb +15 -0
- data/lib/cl_wiki/format/format.graphviz.digraph.rb +16 -0
- data/lib/cl_wiki/format/format.opml.rb +105 -0
- data/lib/cl_wiki/format/format.pre.blockquote.rb +15 -0
- data/lib/cl_wiki/format/format.simpletable.rb +25 -0
- data/lib/cl_wiki/index.rb +455 -0
- data/lib/cl_wiki/page.rb +516 -0
- data/lib/cl_wiki/tools/cron.reminders.rb +241 -0
- data/lib/cl_wiki/tools/movepages.rb +27 -0
- data/lib/cl_wiki/tools/pagestomove.txt +56 -0
- data/lib/cl_wiki/tools/rublog/clWiki.rb +62 -0
- data/lib/cl_wiki/tools/rublog/readme.txt +2 -0
- data/lib/cl_wiki/tools/singlepage.rb +58 -0
- data/lib/cl_wiki/tools/test/singlepagetest.rb +9 -0
- data/lib/cl_wiki/tools/thunderbird.rb +23 -0
- data/lib/cl_wiki/version.rb +3 -0
- data/test/dummy/README.rdoc +259 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +37 -0
- data/test/dummy/config/boot.rb +9 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +34 -0
- data/test/dummy/config/environments/production.rb +81 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/locale.rb +7 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +1963 -0
- data/test/dummy/log/test.log +1340 -0
- data/test/dummy/public/404.html +27 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/17ea26cbf693e610505bdc24be534847 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1883f3d938430da389005555d27c0bad +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1b9132b83b822937e80ef987f7da1760 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/259fb44b87b29348087957b4937a1953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/37f8e4f0491b6401433af823dfb471d9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/48d7a2c40083020f9e7d97d4d73f26fa +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4b0bfb6eb9d6983eb9defa58dd96dae4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4da11f1195532cd7b80f2dde7cf843d5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/57347ee373d74c87e1515a059c701085 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/61b40e54192bf61d97ce2aef71e7d694 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/633b01c5a65fcd6457baf30d1cc94148 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6ad8bb345cc43acfca78c043b7bfefae +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/87a335a43cb68a253dea2b6c0269a4d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8a38b2f4390e68175dae4b4b1c144e2e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8ddc1a668acec35c2707ebc47768f59c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8f5ab7b6f73a1e9f16421b299134e39a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9835aec4bc0277b8f02d0e86c977fdba +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ae4f771558859f9c120a0f22328e8521 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/afed0eaa6fcf7a263498a08a5cc02cf0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/be786e5567855cdc6817603725fd1b8d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bf9b02df32690fb2a936818715d611f3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c2bf9d91a6a2786263b9912b948f435d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ce4c918439a53cb89d02313ed990d5de +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d9c791f08c547f30854ad746a89b0bb5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ddc3a7b5173ff5c911a53004b56e4305 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/dfed1391742203d15f08cb07173bccba +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e282b6bdaa0e070754f8558b9de5e417 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f0e957c30443ade693f73ff470f0f894 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f6b3cbb9c04d5af74d780464c9a34ee5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/fb41fedee86fd2d10ddd938bf5d68eb7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1883f3d938430da389005555d27c0bad +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/48d7a2c40083020f9e7d97d4d73f26fa +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/61b40e54192bf61d97ce2aef71e7d694 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8f5ab7b6f73a1e9f16421b299134e39a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9835aec4bc0277b8f02d0e86c977fdba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ae4f771558859f9c120a0f22328e8521 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/be786e5567855cdc6817603725fd1b8d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c2bf9d91a6a2786263b9912b948f435d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ce4c918439a53cb89d02313ed990d5de +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e282b6bdaa0e070754f8558b9de5e417 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f0e957c30443ade693f73ff470f0f894 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f6b3cbb9c04d5af74d780464c9a34ee5 +0 -0
- data/test/dummy/tmp/testrep/FooBar.txt +1 -0
- data/test/dummy/tmp/testrep/FrontPage.txt +1 -0
- data/test/dummy/tmp/testrep/QuuxBaz.txt +1 -0
- data/test/dummy/wikirep/AboutClWiki.txt +31 -0
- data/test/dummy/wikirep/ChrisMorris.txt +4 -0
- data/test/dummy/wikirep/DotTest.txt +6 -0
- data/test/dummy/wikirep/FooBar.txt +4 -0
- data/test/dummy/wikirep/FooBarQuux.txt +4 -0
- data/test/dummy/wikirep/FrontPage.txt +14 -0
- data/test/dummy/wikirep/HtmlAreaTest.txt +4 -0
- data/test/dummy/wikirep/PreTagsTest.txt +27 -0
- data/test/dummy/wikirep/TheMan.txt +4 -0
- data/test/helpers/wiki_helper_test.rb +4 -0
- data/test/lib/clwiki/clwiki_test_helper.rb +3 -0
- data/test/lib/clwiki/file_test.rb +93 -0
- data/test/lib/clwiki/find_in_file_test.rb +111 -0
- data/test/lib/clwiki/index_test.rb +32 -0
- data/test/lib/clwiki/page_test.rb +239 -0
- data/test/lib/clwiki/test_base.rb +25 -0
- data/test/test_helper.rb +15 -0
- metadata +312 -0
data/LICENSE
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
---------------------------------------------------------------------------
|
2
|
+
Copyright (c) 2001-2013, Chris Morris
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
1. Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
notice, this list of conditions and the following disclaimer in the
|
13
|
+
documentation and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
3. Neither the names Chris Morris, cLabs nor the names of contributors to
|
16
|
+
this software may be used to endorse or promote products derived from this
|
17
|
+
software without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
20
|
+
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
22
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
23
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
24
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
26
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
27
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
28
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
29
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
--------------------------------------------------------------------------
|
31
|
+
(based on BSD Open Source License)
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ClWiki'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
# Customized additions to the Rails Engine Rakefile below,
|
32
|
+
# since the current frankenstein setup has the core clWiki
|
33
|
+
# with Test::Unit tests and the new Rails Engine bits with RSpec.
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:spec)
|
36
|
+
|
37
|
+
task :tests do
|
38
|
+
errors = %w(test spec).collect do |task|
|
39
|
+
begin
|
40
|
+
Rake::Task[task].invoke
|
41
|
+
nil
|
42
|
+
rescue => e
|
43
|
+
{ task: task, exception: e }
|
44
|
+
end
|
45
|
+
end.compact
|
46
|
+
|
47
|
+
if errors.any?
|
48
|
+
puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
|
49
|
+
abort
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task default: :tests
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
17
|
+
|
18
|
+
|
19
|
+
function findFocus() {
|
20
|
+
if ($('.findResults li').length > 0) {
|
21
|
+
$('.findResults li:first a').focus();
|
22
|
+
} else {
|
23
|
+
$(".findForm input[type='text']").focus();
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
// to cope with rails 4 turbolinks
|
28
|
+
$(document).ready(findFocus);
|
29
|
+
$(document).on('page:change', findFocus);
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
|
12
|
+
|
13
|
+
*/
|
14
|
+
|
15
|
+
|
16
|
+
body {
|
17
|
+
font-family: "Verdana", Arial, serif;
|
18
|
+
}
|
19
|
+
|
20
|
+
a:link {
|
21
|
+
color: #00f;
|
22
|
+
text-decoration: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
a:visited {
|
26
|
+
color: #00f;
|
27
|
+
}
|
28
|
+
|
29
|
+
a:hover {
|
30
|
+
color: #77f;
|
31
|
+
}
|
32
|
+
|
33
|
+
a:active {
|
34
|
+
color: #77f;
|
35
|
+
}
|
36
|
+
|
37
|
+
.wikiBody {
|
38
|
+
font-size: 90%;
|
39
|
+
padding: 20px 20px 20px 20px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.wikiBody pre {
|
43
|
+
font-size: 125%;
|
44
|
+
}
|
45
|
+
|
46
|
+
.wikiPageData {
|
47
|
+
font-size: 80%;
|
48
|
+
font-style: italic;
|
49
|
+
}
|
50
|
+
|
51
|
+
.wikiHeader {
|
52
|
+
font-size: 110%;
|
53
|
+
margin-bottom: 5px;
|
54
|
+
}
|
55
|
+
|
56
|
+
.wikiFooter {
|
57
|
+
font-size: 90%;
|
58
|
+
margin-bottom: 5px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.wikiFooter ul {
|
62
|
+
list-style-type: none;
|
63
|
+
padding: 0px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.wikiFooter li {
|
67
|
+
display: inline;
|
68
|
+
padding-right: 10px;
|
69
|
+
}
|
70
|
+
|
71
|
+
.findInput {
|
72
|
+
width: 40%;
|
73
|
+
margin: 0 auto;
|
74
|
+
text-align: center;
|
75
|
+
}
|
76
|
+
|
77
|
+
.findInput div {
|
78
|
+
float: left;
|
79
|
+
text-align: left;
|
80
|
+
padding: 20px;
|
81
|
+
}
|
82
|
+
|
83
|
+
.findForm {
|
84
|
+
text-align: right;
|
85
|
+
}
|
86
|
+
|
87
|
+
.findDetails {
|
88
|
+
text-align: left;
|
89
|
+
font-size: 80%;
|
90
|
+
padding-bottom: 10px;
|
91
|
+
}
|
92
|
+
|
93
|
+
.findResults {
|
94
|
+
text-align: center;
|
95
|
+
width: 50%;
|
96
|
+
margin: auto;
|
97
|
+
}
|
98
|
+
|
99
|
+
.findResults li {
|
100
|
+
list-style-type: none;
|
101
|
+
padding: 15px;
|
102
|
+
float: left;
|
103
|
+
}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'cl_wiki/page'
|
2
|
+
|
3
|
+
module ClWiki
|
4
|
+
class PageController < ApplicationController
|
5
|
+
before_filter :redirect_legacy_cgi_urls
|
6
|
+
before_filter :initialize_formatter
|
7
|
+
before_filter :assign_page_name
|
8
|
+
before_filter :redirect_to_front_page_if_bad_name, :only => :show
|
9
|
+
|
10
|
+
def show
|
11
|
+
@page = ClWiki::Page.new(@page_name)
|
12
|
+
@page.read_content
|
13
|
+
@page
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
@page = ClWiki::Page.new(@page_name)
|
18
|
+
@page.read_raw_content
|
19
|
+
@page
|
20
|
+
end
|
21
|
+
|
22
|
+
def update
|
23
|
+
@page = ClWiki::Page.new(@page_name)
|
24
|
+
@page.update_content(params[:page_content], Time.at(params[:client_mod_time].to_s.to_i))
|
25
|
+
redirect_to params[:save_and_edit] ? page_edit_url(:page_name => @page.full_name.strip_slash_prefix) : page_show_url(:page_name => @page.full_name.strip_slash_prefix)
|
26
|
+
end
|
27
|
+
|
28
|
+
def find
|
29
|
+
@formatter = ClWiki::PageFormatter.new
|
30
|
+
@search_text = params[:search_text]
|
31
|
+
@results = []
|
32
|
+
if @search_text
|
33
|
+
hits = search(@search_text)
|
34
|
+
|
35
|
+
hits.each do |full_name|
|
36
|
+
@formatter.fullName = full_name
|
37
|
+
@results << "#{@formatter.convertToLink(full_name)}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def search(text)
|
43
|
+
case $wiki_conf.useIndex
|
44
|
+
when ClWiki::Configuration::USE_INDEX_NO
|
45
|
+
finder = FindInFile.new($wiki_path)
|
46
|
+
finder.find(text)
|
47
|
+
finder.files.collect do |filename|
|
48
|
+
filename.sub($wikiPageExt, '')
|
49
|
+
end
|
50
|
+
else
|
51
|
+
ClWiki::IndexClient.new.search(text)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def recent
|
56
|
+
finder = FindInFile.new($wiki_path)
|
57
|
+
finder.find($wiki_conf.publishTag || '.')
|
58
|
+
@pages = finder.files.collect do |filename|
|
59
|
+
p = ClWiki::Page.new(filename.sub($wikiPageExt, ''))
|
60
|
+
p.read_page_attributes
|
61
|
+
p
|
62
|
+
end
|
63
|
+
@pages = @pages.sort { |a, b| b.mtime <=> a.mtime }[0..9]
|
64
|
+
without_header_and_footer = false
|
65
|
+
@pages.each { |p| p.read_content(without_header_and_footer) }
|
66
|
+
|
67
|
+
respond_to do |format|
|
68
|
+
format.html
|
69
|
+
format.rss { render :layout => false }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def front_page_name
|
74
|
+
'FrontPage'
|
75
|
+
end
|
76
|
+
|
77
|
+
def redirect_legacy_cgi_urls
|
78
|
+
if request.fullpath.start_with?(legacy_path)
|
79
|
+
page_name = (params[:page] || front_page_name).split('/')[-1]
|
80
|
+
case
|
81
|
+
when request.query_parameters.include?('edit')
|
82
|
+
redirect_to page_edit_url(:page_name => page_name)
|
83
|
+
else
|
84
|
+
redirect_to page_show_url(:page_name => page_name)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def assign_page_name
|
90
|
+
@page_name = params[:page_name]
|
91
|
+
@page_name = @page_name.ensure_slash_prefix if @page_name
|
92
|
+
end
|
93
|
+
|
94
|
+
def redirect_to_front_page_if_bad_name
|
95
|
+
if ((@page_name.blank?) || (!@formatter.is_wiki_name?(@page_name))) ||
|
96
|
+
(!$wiki_conf.editable && !ClWiki::Page.page_exists?(@page_name.ensure_slash_prefix))
|
97
|
+
redirect_to page_show_url(:page_name => front_page_name)
|
98
|
+
return
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def initialize_formatter
|
103
|
+
@formatter = ClWiki::PageFormatter.new
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= form_tag(page_show_path(:page_name => @page.full_name)) do %>
|
2
|
+
<%= hidden_field_tag 'client_mod_time', @page.mtime.to_i.to_s %>
|
3
|
+
|
4
|
+
<%= text_area_tag 'page_content', CGI.escapeHTML(@page.raw_content), rows: $wiki_conf.edit_rows, cols: $wiki_conf.edit_cols %>
|
5
|
+
<br/>
|
6
|
+
<%= submit_tag 'Save', name: 'save' %>
|
7
|
+
<%= submit_tag 'Save and Continue Editing', name: 'save_and_edit' %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= @formatter.header("Find").html_safe %>
|
2
|
+
|
3
|
+
<div class='findInput'>
|
4
|
+
<div class='findForm'>
|
5
|
+
<%= form_tag(page_find_path) do %>
|
6
|
+
<%= text_field_tag 'search_text', @search_text %>
|
7
|
+
<%= submit_tag 'Find', name: 'find' %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class='findDetails'>
|
12
|
+
<span>"this that" => <i><b>this</b></i> and <b><i>that</i></b></span><br/>
|
13
|
+
<span>"the" => <i><b>the</b></i>, <i><b>the</b>ater</i>, <i>soo<b>the</b></i>, <i>o<b>the</b>r</i></span>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div style='clear: left'></div>
|
18
|
+
|
19
|
+
<div class='findResults'>
|
20
|
+
<ul>
|
21
|
+
<% @results.each do |result| %>
|
22
|
+
<li><%= result.html_safe %></li>
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%= @formatter.footer("Find").html_safe %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0"
|
2
|
+
xml.rss :version => "2.0" do
|
3
|
+
xml.channel do
|
4
|
+
xml.title "clWiki"
|
5
|
+
xml.description "clWiki"
|
6
|
+
xml.link root_url
|
7
|
+
|
8
|
+
for page in @pages
|
9
|
+
xml.item do
|
10
|
+
xml.title page.name
|
11
|
+
xml.description page.content
|
12
|
+
xml.pubDate page.mtime.to_s(:rfc822)
|
13
|
+
xml.link page_show_url(:page_name => page.name)
|
14
|
+
xml.guid page_show_url(:page_name => page.name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= @page.content.html_safe %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>ClWiki</title>
|
5
|
+
<%= stylesheet_link_tag "cl_wiki/application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "cl_wiki/application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/clwiki.yml
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
production:
|
2
|
+
# path to the root directory that stores the page files
|
3
|
+
wiki_path: wikirep
|
4
|
+
|
5
|
+
# useIndex can be one of the three numbers:
|
6
|
+
# 0 No Index
|
7
|
+
# 1 DRb Index Server
|
8
|
+
# 2 Local Index Server
|
9
|
+
|
10
|
+
useIndex: 0
|
11
|
+
|
12
|
+
# useIndexForPageExists determines if the index is referenced for
|
13
|
+
# determining if a page exists rather than querying the file system. In
|
14
|
+
# some cases, the file system (due to OS caching and whatnot) outperforms
|
15
|
+
# the index. This option is ignored if useIndex is set to No Index.
|
16
|
+
|
17
|
+
useIndexForPageExists: false
|
18
|
+
|
19
|
+
# the port the DRb Index Server uses. This setting is irrelevant if
|
20
|
+
# useIndex is anything other than 1
|
21
|
+
|
22
|
+
# indexPort: 9111
|
23
|
+
|
24
|
+
# set this to false for a read-only wiki. Useful with Blogki
|
25
|
+
|
26
|
+
editable: false
|
27
|
+
|
28
|
+
# enable this option to use an external style sheet
|
29
|
+
|
30
|
+
# cssHref http://www.my.domain/stylesheet.css
|
31
|
+
|
32
|
+
# enable this option to have the wiki rendered in a template. See the
|
33
|
+
# sample.template.htm file for how to use this option. (NOTE: this is a
|
34
|
+
# BETA option -- probably not even a sample.template.htm included in the
|
35
|
+
# distribution)
|
36
|
+
|
37
|
+
# template mytemplate.htm
|
38
|
+
|
39
|
+
# If you want to restrict the Recent view to only published pages, you
|
40
|
+
# can configure a custom tag here. If this isn't defined, then every
|
41
|
+
# page will appear on the Recent view.
|
42
|
+
#
|
43
|
+
# publishTag <publish>
|
44
|
+
|
45
|
+
# showSourceLink can be turned on to add a page link in the footer that
|
46
|
+
# is a file:// url direct to the raw page. Default is false.
|
47
|
+
#
|
48
|
+
# showSourceLink true
|
49
|
+
|
50
|
+
# time format for display of last page update
|
51
|
+
#
|
52
|
+
page_update_format: '%B %d, %Y'
|
53
|
+
|
54
|
+
# Add directories containing optional custom formatters here.
|
55
|
+
#
|
56
|
+
custom_formatter_load_path: []
|
57
|
+
|
58
|
+
test:
|
59
|
+
wiki_path: tmp/testrep
|
60
|
+
useIndex: 0
|
61
|
+
useIndexForPageExists: false
|
62
|
+
editable: true
|
63
|
+
page_update_format: '%B %d, %Y'
|
64
|
+
custom_formatter_load_path: []
|
65
|
+
|
66
|
+
development:
|
67
|
+
# path to the root directory that stores the page files
|
68
|
+
wiki_path: wikirep
|
69
|
+
useIndex: 0
|
70
|
+
useIndexForPageExists: false
|
71
|
+
editable: true
|
72
|
+
page_update_format: '%B %d, %Y'
|
73
|
+
custom_formatter_load_path: []
|