Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 344
- Log:
Massive changeset which brings the old, ROOL customised Instiki
version up to date, but without any ROOL customisations in this
latest checked-in version (which is 0.19.1). This is deliberate,
so that it's easy to see the changes made for the ROOL version
in a subsequent changeset. The 'app/views/shared' directory is not
part of Instiki but is kept to maintain the change history with
updated ROOL customisations, some of which involve the same files
in that same directory.
- Author:
- rool
- Date:
- Sat Mar 19 19:52:13 +0000 2011
- Size:
- 2325 Bytes
1 | require 'chunks/wiki' |
2 | |
3 | # Includes the contents of another page for rendering. |
4 | # The include command looks like this: "[[!include PageName]]". |
5 | # It is a WikiReference since it refers to another page (PageName) |
6 | # and the wiki content using this command must be notified |
7 | # of changes to that page. |
8 | # If the included page could not be found, a warning is displayed. |
9 | |
10 | class Include < WikiChunk::WikiReference |
11 | |
12 | INCLUDE_PATTERN = /\[\[!include\s+([^\]\s][^\]]*?)\s*\]\]/i |
13 | def self.pattern() INCLUDE_PATTERN end |
14 | |
15 | def initialize(match_data, content) |
16 | super |
17 | @page_name = match_data[1].strip |
18 | rendering_mode = content.options[:mode] || :show |
19 | add_to_include_list |
20 | @unmask_text = get_unmask_text_avoiding_recursion_loops(rendering_mode) |
21 | end |
22 | |
23 | private |
24 | |
25 | def get_unmask_text_avoiding_recursion_loops(rendering_mode) |
26 | if refpage |
27 | return "<em>Recursive include detected: #{@content.page_name} " + |
28 | "→ #{@content.page_name}</em>\n" if self_inclusion(refpage) |
29 | renderer = PageRenderer.new(refpage.current_revision) |
30 | included_content = |
31 | case rendering_mode |
32 | when :show then renderer.display_content |
33 | when :publish then renderer.display_published |
34 | when :export then renderer.display_content_for_export |
35 | when :s5 then renderer.display_s5 |
36 | else |
37 | raise "Unsupported rendering mode #{@mode.inspect}" |
38 | end |
39 | @content.merge_chunks(included_content) |
40 | clear_include_list |
41 | return included_content.pre_rendered |
42 | else |
43 | clear_include_list |
44 | return "<em>Could not include #{@page_name}</em>\n" |
45 | end |
46 | end |
47 | |
48 | # We track included pages in a thread-local variable. |
49 | # This allows a multi-threaded Rails to handle multiple |
50 | # simultaneous requests (one request/thread), without |
51 | # getting confused. |
52 | |
53 | def add_to_include_list |
54 | Thread.current[:chunk_included_by] ? |
55 | Thread.current[:chunk_included_by].push(@content.page_name) : |
56 | Thread.current[:chunk_included_by] = [@content.page_name] |
57 | end |
58 | |
59 | def clear_include_list |
60 | Thread.current[:chunk_included_by] = [] |
61 | end |
62 | |
63 | def self_inclusion(refpage) |
64 | if Thread.current[:chunk_included_by].include?(refpage.page.name) |
65 | @content.delete_chunk(self) |
66 | clear_include_list |
67 | else |
68 | return false |
69 | end |
70 | end |
71 | |
72 | end |