olelo 0.9.3 → 0.9.4
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/.travis.yml +4 -0
- data/Rakefile +6 -12
- data/bin/olelo +13 -8
- data/config.ru +21 -15
- data/config/aspects.rb +45 -32
- data/config/config.yml.default +1 -0
- data/config/initializers/00-mime_types.rb +22 -17
- data/config/initializers/01-slim.rb +2 -2
- data/lib/olelo.rb +1 -8
- data/lib/olelo/application.rb +33 -34
- data/lib/olelo/attributes.rb +4 -4
- data/lib/olelo/extensions.rb +0 -7
- data/lib/olelo/helper.rb +13 -25
- data/lib/olelo/html_safe.rb +0 -4
- data/lib/olelo/locale.yml +6 -3
- data/lib/olelo/menu.rb +1 -1
- data/lib/olelo/page.rb +21 -18
- data/lib/olelo/version.rb +1 -1
- data/olelo.gemspec +5 -3
- data/plugins/aspects/changelog.rb +5 -5
- data/plugins/aspects/documentbrowser.rb +5 -5
- data/plugins/{gallery → aspects/gallery}/gallery.css +0 -0
- data/plugins/{gallery → aspects/gallery}/gallery.scss +0 -0
- data/plugins/{gallery → aspects/gallery}/main.rb +3 -3
- data/plugins/aspects/highlight.rb +1 -1
- data/plugins/aspects/image.rb +1 -1
- data/plugins/aspects/imageinfo.rb +3 -3
- data/plugins/aspects/main.rb +21 -21
- data/plugins/aspects/pageinfo.rb +2 -2
- data/plugins/aspects/source.rb +1 -1
- data/plugins/aspects/subpages.rb +7 -7
- data/plugins/aspects/text.rb +1 -1
- data/plugins/authentication/portal.rb +2 -2
- data/plugins/authentication/yamlfile.rb +1 -1
- data/plugins/blog/main.rb +10 -10
- data/plugins/editor/preview.rb +3 -3
- data/plugins/filters/creole.rb +1 -1
- data/plugins/filters/editsection.rb +2 -2
- data/plugins/filters/html2xml.rb +6 -0
- data/plugins/filters/main.rb +1 -1
- data/plugins/filters/remind/main.rb +15 -0
- data/plugins/filters/remind/rem2html +562 -0
- data/plugins/filters/s5/main.rb +1 -1
- data/plugins/login/persistent.rb +1 -1
- data/plugins/misc/system.rb +4 -0
- data/plugins/misc/variables.rb +1 -1
- data/plugins/misc/webdav.rb +10 -10
- data/plugins/repositories/git_grep.rb +2 -2
- data/plugins/repositories/gitrb_repository.rb +10 -10
- data/plugins/repositories/rugged_repository.rb +7 -7
- data/plugins/tags/code.rb +1 -1
- data/plugins/tags/footnotes.rb +4 -3
- data/plugins/tags/gist.rb +2 -2
- data/plugins/tags/html.rb +11 -11
- data/plugins/tags/include.rb +6 -6
- data/plugins/tags/main.rb +10 -10
- data/plugins/tags/math.rb +2 -2
- data/plugins/tags/redirect.rb +3 -3
- data/plugins/tags/scripting.rb +12 -12
- data/plugins/tags/sort.rb +1 -1
- data/plugins/tags/tabs.rb +1 -1
- data/plugins/treeview/main.rb +3 -3
- data/plugins/treeview/script.js +5 -5
- data/plugins/treeview/script/00-jquery.treeview.js +6 -6
- data/plugins/treeview/script/init.js +1 -1
- data/plugins/utils/assets.rb +4 -4
- data/plugins/utils/cache.rb +10 -6
- data/plugins/utils/store.rb +4 -4
- data/static/script.js +124 -126
- data/static/script/{02-jquery.js → 01-jquery.js} +0 -0
- data/static/script/02-olelo.storage.js +54 -0
- data/static/script/10-olelo.historytable.js +2 -2
- data/static/script/13-olelo.tabwidget.js +2 -2
- data/test/helper.rb +5 -4
- data/test/page_test.rb +1 -1
- data/test/request_test.rb +42 -38
- data/test/string_extensions_test.rb +0 -6
- data/test/templates_test.rb +1 -1
- data/test/util_test.rb +1 -1
- data/views/changes.slim +2 -2
- data/views/compare.slim +4 -4
- data/views/delete.slim +2 -2
- data/views/deleted.slim +1 -1
- data/views/edit.slim +31 -26
- data/views/history.slim +5 -5
- data/views/layout.slim +1 -1
- data/views/login.slim +30 -32
- data/views/move.slim +3 -3
- data/views/profile.slim +2 -2
- data/views/show.slim +1 -1
- metadata +43 -104
- data/static/script/01-jstorage.js +0 -217
data/lib/olelo/version.rb
CHANGED
data/olelo.gemspec
CHANGED
@@ -17,14 +17,16 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = %w(lib)
|
19
19
|
|
20
|
-
s.
|
20
|
+
s.required_ruby_version = '>= 1.9.2'
|
21
|
+
|
22
|
+
s.add_runtime_dependency('multi_json', ['~> 1.3.6'])
|
21
23
|
s.add_runtime_dependency('slim', ['~> 1.3.3'])
|
22
24
|
s.add_runtime_dependency('creole', ['~> 0.4.2'])
|
23
25
|
s.add_runtime_dependency('nokogiri', ['~> 1.5.5'])
|
24
26
|
s.add_runtime_dependency('mimemagic', ['~> 0.2.0'])
|
25
27
|
s.add_runtime_dependency('rack', ['~> 1.4.1'])
|
26
|
-
s.add_runtime_dependency('redcarpet', ['~> 2.2.
|
27
|
-
s.add_runtime_dependency('rugged', ['~> 0.17.
|
28
|
+
s.add_runtime_dependency('redcarpet', ['~> 2.2.2'])
|
29
|
+
s.add_runtime_dependency('rugged', ['~> 0.17.0.b7'])
|
28
30
|
s.add_runtime_dependency('evaluator', ['~> 0.1.6'])
|
29
31
|
|
30
32
|
s.add_development_dependency('rake', ['>= 0.8.7'])
|
@@ -2,7 +2,7 @@
|
|
2
2
|
description 'Changelog Aspect'
|
3
3
|
require 'rss/maker'
|
4
4
|
|
5
|
-
Aspect.create(:changelog, :
|
5
|
+
Aspect.create(:changelog, cacheable: true, hidden: true) do
|
6
6
|
def call(context, page)
|
7
7
|
format = context.params[:format]
|
8
8
|
|
@@ -32,14 +32,14 @@ end
|
|
32
32
|
|
33
33
|
Application.hook :head do
|
34
34
|
%{<link rel="alternate" type="application/atom+xml" title="Sitewide Atom Changelog"
|
35
|
-
href="#{escape_html build_path('/', :
|
35
|
+
href="#{escape_html build_path('/', aspect: 'changelog', format: 'atom')}"/>
|
36
36
|
<link rel="alternate" type="application/rss+xml" title="Sitewide RSS Changelog"
|
37
|
-
href="#{escape_html build_path('/', :
|
37
|
+
href="#{escape_html build_path('/', aspect: 'changelog', format: 'rss')}"/>}
|
38
38
|
end
|
39
39
|
|
40
40
|
Application.hook :head do
|
41
41
|
%{<link rel="alternate" type="application/atom+xml" title="#{escape_html page.path} Atom Changelog"
|
42
|
-
href="#{escape_html(build_path(page.path, :
|
42
|
+
href="#{escape_html(build_path(page.path, aspect: 'changelog', format: 'atom'))}"/>
|
43
43
|
<link rel="alternate" type="application/rss+xml" title="#{escape_html page.path} RSS Changelog"
|
44
|
-
href="#{escape_html(build_path(page.path, :
|
44
|
+
href="#{escape_html(build_path(page.path, aspect: 'changelog', format: 'rss'))}"/>} if page && !page.new? && !page.root?
|
45
45
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
description 'Document browser aspect'
|
2
2
|
dependencies 'utils/shell'
|
3
3
|
|
4
|
-
Aspect.create(:documentbrowser, :
|
4
|
+
Aspect.create(:documentbrowser, priority: 1, layout: true, cacheable: true, accepts: %r{^application/pdf$|postscript$}) do
|
5
5
|
def count_pages
|
6
6
|
content = @page.content
|
7
7
|
page_count = 0
|
@@ -25,10 +25,10 @@ end
|
|
25
25
|
__END__
|
26
26
|
|
27
27
|
@@ browser.slim
|
28
|
-
= pagination(@page, @page_count, @page_nr, :
|
28
|
+
= pagination(@page, @page_count, @page_nr, aspect: 'documentbrowser')
|
29
29
|
p
|
30
|
-
img src=build_path(@page, :
|
31
|
-
= pagination(@page, @page_count, @page_nr, :
|
30
|
+
img src=build_path(@page, aspect: 'image', geometry: '480x>', trim: 1, page: @page_nr)
|
31
|
+
= pagination(@page, @page_count, @page_nr, aspect: 'documentbrowser')
|
32
32
|
h3= :information.t
|
33
33
|
table
|
34
34
|
tbody
|
@@ -54,4 +54,4 @@ table
|
|
54
54
|
tr
|
55
55
|
td= :download.t
|
56
56
|
td
|
57
|
-
a href=build_path(@page, :
|
57
|
+
a href=build_path(@page, aspect: 'download') = :download.t
|
File without changes
|
File without changes
|
@@ -2,7 +2,7 @@ description 'Gallery aspect'
|
|
2
2
|
dependencies 'utils/assets', 'aspects'
|
3
3
|
export_scripts '*.css'
|
4
4
|
|
5
|
-
Aspects::Aspect.create(:gallery, :
|
5
|
+
Aspects::Aspect.create(:gallery, priority: 3, layout: true, hidden: true, cacheable: true) do
|
6
6
|
def accepts?(page); !page.children.empty?; end
|
7
7
|
def call(context, page)
|
8
8
|
@per_row = 4
|
@@ -18,13 +18,13 @@ end
|
|
18
18
|
|
19
19
|
__END__
|
20
20
|
@@ gallery.slim
|
21
|
-
= pagination(@page, @page_count, @page_nr, :
|
21
|
+
= pagination(@page, @page_count, @page_nr, aspect: 'gallery')
|
22
22
|
table.gallery
|
23
23
|
- @images.each_slice(@per_row) do |row|
|
24
24
|
tr
|
25
25
|
- row.each do |image|
|
26
26
|
ruby:
|
27
|
-
thumb_path = build_path(image, :
|
27
|
+
thumb_path = build_path(image, aspect: 'image', geometry: '150x150>')
|
28
28
|
info_path = build_path(image)
|
29
29
|
description = image.attributes['description'] || image.attributes['title'] || \
|
30
30
|
image.name.gsub(/([^\s])[_\-]/, '\1 ')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
description 'Source code highlighting aspect'
|
2
2
|
dependencies 'utils/pygments'
|
3
3
|
|
4
|
-
Aspect.create(:highlight, :
|
4
|
+
Aspect.create(:highlight, priority: 2, layout: true, cacheable: true) do
|
5
5
|
def accepts?(page); !page.content.empty? && Pygments.file_format(page.name); end
|
6
6
|
def call(context, page); Pygments.pygmentize(page.content, Pygments.file_format(page.name)); end
|
7
7
|
end
|
data/plugins/aspects/image.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
description 'Image aspect'
|
2
2
|
dependencies 'utils/image_magick'
|
3
3
|
|
4
|
-
Aspect.create(:image, :
|
4
|
+
Aspect.create(:image, priority: 5, accepts: %r{^application/pdf$|postscript$|^image/}, cacheable: true) do
|
5
5
|
def call(context, page)
|
6
6
|
geometry = context.params[:geometry]
|
7
7
|
trim = context.params[:trim]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
description 'Image information aspect'
|
2
2
|
dependencies 'utils/image_magick'
|
3
3
|
|
4
|
-
Aspect.create(:imageinfo, :
|
4
|
+
Aspect.create(:imageinfo, priority: 1, layout: true, cacheable: true, accepts: %r{^image/}) do
|
5
5
|
def call(context, page)
|
6
6
|
@page = page
|
7
7
|
identify = ImageMagick.identify('-format', "%m\n%h\n%w\n%[EXIF:*]", '-').run(page.content).split("\n")
|
@@ -15,8 +15,8 @@ end
|
|
15
15
|
__END__
|
16
16
|
@@ info.slim
|
17
17
|
p
|
18
|
-
a href=build_path(@page, :
|
19
|
-
img src=build_path(@page, :
|
18
|
+
a href=build_path(@page, aspect: 'image')
|
19
|
+
img src=build_path(@page, aspect: 'image', geometry: '640x480>') alt=@page.title
|
20
20
|
h3= :information.t
|
21
21
|
table
|
22
22
|
tbody
|
data/plugins/aspects/main.rb
CHANGED
@@ -4,7 +4,7 @@ dependencies 'utils/cache'
|
|
4
4
|
Page.attributes do
|
5
5
|
enum :aspect do
|
6
6
|
Aspect.aspects.keys.inject({}) do |hash, name|
|
7
|
-
hash[name] = Locale.translate("aspect_#{name}", :
|
7
|
+
hash[name] = Locale.translate("aspect_#{name}", fallback: titlecase(name))
|
8
8
|
hash
|
9
9
|
end
|
10
10
|
end
|
@@ -39,11 +39,11 @@ class Context
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def subcontext(options = {})
|
42
|
-
Context.new(:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
42
|
+
Context.new(page: options[:page] || page,
|
43
|
+
private: private.merge(options[:private] || {}),
|
44
|
+
params: params.merge(options[:params] || {}),
|
45
|
+
request: request,
|
46
|
+
header: header)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -57,8 +57,8 @@ class Aspect
|
|
57
57
|
|
58
58
|
class NotAvailable < NameError
|
59
59
|
def initialize(name, page)
|
60
|
-
super(:aspect_not_available.t(:
|
61
|
-
:
|
60
|
+
super(:aspect_not_available.t(aspect: name, page: page.path,
|
61
|
+
type: "#{page.mime.comment} (#{page.mime})"))
|
62
62
|
end
|
63
63
|
|
64
64
|
def status
|
@@ -146,10 +146,10 @@ end
|
|
146
146
|
# Plug-in the aspect subsystem
|
147
147
|
module ::Olelo::PageHelper
|
148
148
|
def render_page(page)
|
149
|
-
Cache.cache("include-#{page.path}-#{page.version.cache_id}", :
|
149
|
+
Cache.cache("include-#{page.path}-#{page.version.cache_id}", update: no_cache?, defer: true) do |context|
|
150
150
|
begin
|
151
|
-
context = Context.new(:
|
152
|
-
Aspect.find!(page, :
|
151
|
+
context = Context.new(page: page, params: {included: true})
|
152
|
+
Aspect.find!(page, layout: true).call(context, page)
|
153
153
|
rescue Aspect::NotAvailable => ex
|
154
154
|
%{<span class="error">#{escape_html ex.message}</span>}
|
155
155
|
end
|
@@ -163,10 +163,10 @@ class ::Olelo::Application
|
|
163
163
|
params[:aspect] ||= 'subpages' if params[:path].to_s.ends_with? '/'
|
164
164
|
@selected_aspect, layout, header, content =
|
165
165
|
Cache.cache("aspect-#{page.path}-#{page.version.cache_id}-#{build_query(params)}",
|
166
|
-
:
|
167
|
-
aspect = Aspect.find!(page, :
|
166
|
+
update: no_cache?, defer: true) do |cache|
|
167
|
+
aspect = Aspect.find!(page, name: params[:aspect])
|
168
168
|
cache.disable! if !aspect.cacheable?
|
169
|
-
context = Context.new(:
|
169
|
+
context = Context.new(page: page, params: params, request: request)
|
170
170
|
result = aspect.call(context, page)
|
171
171
|
context.header['Content-Type'] ||= aspect.mime.to_s if aspect.mime
|
172
172
|
context.header['Content-Type'] ||= page.mime.to_s if !aspect.layout?
|
@@ -175,27 +175,27 @@ class ::Olelo::Application
|
|
175
175
|
self.response.header.merge!(header)
|
176
176
|
|
177
177
|
@menu_versions = true
|
178
|
-
layout ? render(:show, :
|
178
|
+
layout ? render(:show, locals: {content: content}) : content
|
179
179
|
rescue Aspect::NotAvailable => ex
|
180
|
-
cache_control :
|
180
|
+
cache_control no_cache: true
|
181
181
|
redirect build_path(page.path) if params[:path].to_s.ends_with? '/'
|
182
182
|
raise if params[:aspect]
|
183
183
|
flash.error ex.message
|
184
|
-
redirect build_path(page, :
|
184
|
+
redirect build_path(page, action: :edit)
|
185
185
|
end
|
186
186
|
|
187
187
|
hook :menu do |menu|
|
188
188
|
if menu.name == :actions && view_menu = menu[:view]
|
189
189
|
Cache.cache("aspect-menu-#{page.path}-#{page.version.cache_id}-#{@selected_aspect}",
|
190
|
-
:
|
190
|
+
update: no_cache?, defer: true) do
|
191
191
|
aspects = Aspect.find_all(page).select {|a| !a.hidden? || a.name == @selected_aspect || a.name == page.attributes['aspect'] }.map do |a|
|
192
|
-
[Locale.translate("aspect_#{a.name}", :
|
192
|
+
[Locale.translate("aspect_#{a.name}", fallback: titlecase(a.name)), a]
|
193
193
|
end.sort_by(&:first)
|
194
194
|
aspects.select {|label, a| a.layout? }.map do |label, a|
|
195
|
-
MenuItem.new(a.name, :
|
195
|
+
MenuItem.new(a.name, label: label, href: build_path(page, aspect: a.name), class: a.name == @selected_aspect ? 'selected' : nil)
|
196
196
|
end +
|
197
197
|
aspects.reject {|label, a| a.layout? }.map do |label, a|
|
198
|
-
MenuItem.new(a.name, :
|
198
|
+
MenuItem.new(a.name, label: label, href: build_path(page, aspect: a.name), class: 'download')
|
199
199
|
end
|
200
200
|
end.each {|item| view_menu << item }
|
201
201
|
end
|
data/plugins/aspects/pageinfo.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
description 'Page information aspect'
|
2
2
|
|
3
|
-
Aspect.create(:pageinfo, :
|
3
|
+
Aspect.create(:pageinfo, priority: 4, layout: true, cacheable: true) do
|
4
4
|
def call(context, page)
|
5
5
|
@page = page
|
6
6
|
render :info
|
@@ -34,4 +34,4 @@ table
|
|
34
34
|
tr
|
35
35
|
td= :download.t
|
36
36
|
td
|
37
|
-
a href=build_path(@page, :
|
37
|
+
a href=build_path(@page, aspect: 'download') = :download.t
|
data/plugins/aspects/source.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
description 'Source aspect'
|
2
2
|
|
3
|
-
Aspect.create(:source, :
|
3
|
+
Aspect.create(:source, priority: 3, layout: true, cacheable: true) do
|
4
4
|
def accepts?(page); page.mime.text?; end
|
5
5
|
def call(context, page); "<pre>#{escape_html page.content}</pre>"; end
|
6
6
|
end
|
data/plugins/aspects/subpages.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
description 'Subpages aspect'
|
2
2
|
|
3
|
-
Aspect.create(:subpages, :
|
3
|
+
Aspect.create(:subpages, priority: 2, layout: true, cacheable: true) do
|
4
4
|
def accepts?(page); !page.children.empty?; end
|
5
5
|
def call(context, page)
|
6
6
|
@page_nr = [context.params[:page].to_i, 1].max
|
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
__END__
|
16
16
|
@@ subpages.slim
|
17
|
-
= pagination(@page, @page_count, @page_nr, :
|
17
|
+
= pagination(@page, @page_count, @page_nr, aspect: 'subpages')
|
18
18
|
table#subpages-table
|
19
19
|
thead
|
20
20
|
tr
|
@@ -37,8 +37,8 @@ table#subpages-table
|
|
37
37
|
td= truncate(child.version.author.name, 30)
|
38
38
|
td= truncate(child.version.comment, 30)
|
39
39
|
td.actions
|
40
|
-
a.action-edit href=build_path(child, :
|
41
|
-
a.action-history href=build_path(child, :
|
42
|
-
a.action-move href=build_path(child, :
|
43
|
-
a.action-delete href=build_path(child, :
|
44
|
-
= pagination(@page, @page_count, @page_nr, :
|
40
|
+
a.action-edit href=build_path(child, action: :edit) title=:edit.t = :edit.t
|
41
|
+
a.action-history href=build_path(child, action: :history) title=:history.t = :history.t
|
42
|
+
a.action-move href=build_path(child, action: :move) title=:move.t = :move.t
|
43
|
+
a.action-delete href=build_path(child, action: :delete) title=:delete.t = :delete.t
|
44
|
+
= pagination(@page, @page_count, @page_nr, aspect: 'subpages')
|
data/plugins/aspects/text.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
description 'Text aspect'
|
2
2
|
|
3
|
-
Aspect.create(:text, :
|
3
|
+
Aspect.create(:text, mime: 'text/plain; charset=utf-8') do
|
4
4
|
def accepts?(page); page.mime.text?; end
|
5
5
|
def call(context, page)
|
6
6
|
context.header['Content-Length'] = page.content.bytesize.to_s
|
@@ -10,8 +10,8 @@ class PortalService < User::Service
|
|
10
10
|
# @override
|
11
11
|
def authenticate(name, password)
|
12
12
|
xml = open(@url,
|
13
|
-
:
|
14
|
-
:
|
13
|
+
ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE,
|
14
|
+
http_basic_authentication: [name, password]).read
|
15
15
|
# User data is exposed via REST/XML-API
|
16
16
|
doc = Nokogiri::XML(xml)
|
17
17
|
email = (doc/'person/email').text
|
@@ -27,7 +27,7 @@ class YamlfileService < User::Service
|
|
27
27
|
# @override
|
28
28
|
def signup(user, password)
|
29
29
|
@store.transaction do |store|
|
30
|
-
raise :user_already_exists.t(:
|
30
|
+
raise :user_already_exists.t(name: user.name) if store[user.name]
|
31
31
|
store[user.name] = {
|
32
32
|
'email' => user.email,
|
33
33
|
'password' => crypt(password),
|
data/plugins/blog/main.rb
CHANGED
@@ -2,25 +2,25 @@ description 'Blog aspect'
|
|
2
2
|
dependencies 'tags', 'utils/assets', 'utils/xml'
|
3
3
|
export_scripts '*.css'
|
4
4
|
|
5
|
-
Application.get '(/:path)/:year(/:month)', :
|
5
|
+
Application.get '(/:path)/:year(/:month)', year: '20\d{2}', month: '(?:0[1-9])|(?:1[1-2])' do
|
6
6
|
params[:aspect] = 'blog'
|
7
7
|
send('GET /')
|
8
8
|
end
|
9
9
|
|
10
|
-
Tags::Tag.define 'menu', :
|
10
|
+
Tags::Tag.define 'menu', optional: 'path', description: 'Show blog menu', dynamic: true do |context, attrs, content|
|
11
11
|
page = Page.find(attrs[:path]) rescue nil
|
12
12
|
if page
|
13
|
-
Cache.cache("blog-#{page.path}-#{page.version.cache_id}", :
|
13
|
+
Cache.cache("blog-#{page.path}-#{page.version.cache_id}", update: no_cache?(context.request.env), defer: true) do
|
14
14
|
years = {}
|
15
15
|
page.children.each do |child|
|
16
16
|
(years[child.version.date.year] ||= [])[child.version.date.month] = true
|
17
17
|
end
|
18
|
-
render :menu, :
|
18
|
+
render :menu, locals: {years: years, page: page}
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
Aspects::Aspect.create(:blog, :
|
23
|
+
Aspects::Aspect.create(:blog, priority: 3, layout: true, cacheable: true, hidden: true) do
|
24
24
|
def accepts?(page); !page.children.empty?; end
|
25
25
|
def call(context, page)
|
26
26
|
@page = page
|
@@ -38,8 +38,8 @@ Aspects::Aspect.create(:blog, :priority => 3, :layout => true, :cacheable => tru
|
|
38
38
|
|
39
39
|
@articles = articles.map do |article|
|
40
40
|
begin
|
41
|
-
subctx = context.subcontext(:
|
42
|
-
content = Aspects::Aspect.find!(article, :
|
41
|
+
subctx = context.subcontext(page: article, params: {included: true})
|
42
|
+
content = Aspects::Aspect.find!(article, layout: true).call(subctx, article)
|
43
43
|
if !context.params[:full]
|
44
44
|
paragraphs = XML::Fragment(content).xpath('p')
|
45
45
|
content = ''
|
@@ -53,7 +53,7 @@ Aspects::Aspect.create(:blog, :priority => 3, :layout => true, :cacheable => tru
|
|
53
53
|
end
|
54
54
|
[article, content]
|
55
55
|
end
|
56
|
-
render :blog, :
|
56
|
+
render :blog, locals: {full: context.params[:full]}
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -68,11 +68,11 @@ __END__
|
|
68
68
|
h2
|
69
69
|
a.name href=build_path(page) = page.name
|
70
70
|
.date= date page.version.date
|
71
|
-
.author= :written_by.t(:
|
71
|
+
.author= :written_by.t(author: page.version.author.name)
|
72
72
|
.content== content
|
73
73
|
- if !full
|
74
74
|
a.full href=build_path(page.path) = :full_article.t
|
75
|
-
= pagination(@page, @page_count, @page_nr, :
|
75
|
+
= pagination(@page, @page_count, @page_nr, aspect: 'blog')
|
76
76
|
@@ menu.slim
|
77
77
|
table.blog-menu
|
78
78
|
- years.keys.sort.each do |year|
|
data/plugins/editor/preview.rb
CHANGED
@@ -18,13 +18,13 @@ class ::Olelo::Application
|
|
18
18
|
if page.new? || !params[:pos]
|
19
19
|
# Whole page edited, assign new content before aspect search
|
20
20
|
page.content = params[:content]
|
21
|
-
aspect = Aspects::Aspect.find(page, :
|
21
|
+
aspect = Aspects::Aspect.find(page, layout: true)
|
22
22
|
else
|
23
23
|
# We assume that aspect stays the same if section is edited
|
24
|
-
aspect = Aspects::Aspect.find(page, :
|
24
|
+
aspect = Aspects::Aspect.find(page, layout: true)
|
25
25
|
page.content = params[:content]
|
26
26
|
end
|
27
|
-
context = Aspects::Context.new(:
|
27
|
+
context = Aspects::Context.new(page: page, request: request, private: {preview: true})
|
28
28
|
preview = aspect && aspect.call(context, page)
|
29
29
|
flash.now[:preview] = preview ? %{<hr/>#{preview}} : nil
|
30
30
|
halt render(request.xhr? ? flash.now[:preview] : :edit)
|
data/plugins/filters/creole.rb
CHANGED
@@ -56,8 +56,8 @@ class EditSection < Filters::NestingFilter
|
|
56
56
|
content.gsub!(/#{prefix}(\d+)/) do
|
57
57
|
i = $1.to_i
|
58
58
|
len = sections[i][1] - sections[i][0]
|
59
|
-
path = build_path(page, :
|
60
|
-
%{<a class="editsection" href="#{escape_html path}" title="#{escape_html :edit_section.t(:
|
59
|
+
path = build_path(page, action: :edit, pos: sections[i][0], len: len, comment: :section_edited.t(section: sections[i][3]))
|
60
|
+
%{<a class="editsection" href="#{escape_html path}" title="#{escape_html :edit_section.t(section: sections[i][3])}">#{escape_html :edit.t}</a>}
|
61
61
|
end
|
62
62
|
content
|
63
63
|
end
|
data/plugins/filters/main.rb
CHANGED
@@ -59,7 +59,7 @@ class Filter
|
|
59
59
|
|
60
60
|
# Create regexp filter
|
61
61
|
def self.regexp(name, *regexps)
|
62
|
-
create(name, :
|
62
|
+
create(name, description: 'Regular expression filter') do |context, content|
|
63
63
|
regexps.each_slice(2) { |regexp, sub| content.gsub!(regexp, sub) }
|
64
64
|
content
|
65
65
|
end
|