Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 52
- Log:
Further layout improvements for page editing, rollback and creation.
Always renders at least the static shared sidebar in the default layout
now. Changed engines.rb to work around a RedCloth 3.0.4 problem that
showed up when Rails 1.1.4 was introduced concurrently. A mailing list
query has been lodged about it. In the mean time, newlines in textile
input will not produce line breaks in the HTML output and HTML in the
textile input is being manually escaped by simply replacing "<" and ">"
with HTML entities. Fixes Ticket #34.
- Author:
- adh
- Date:
- Fri Aug 04 16:19:44 +0100 2006
- Size:
- 2009 Bytes
1 | $: << File.dirname(__FILE__) + "../../lib" |
2 | |
3 | require_dependency 'chunks/chunk' |
4 | |
5 | # The markup engines are Chunks that call the one of RedCloth |
6 | # or RDoc to convert text. This markup occurs when the chunk is required |
7 | # to mask itself. |
8 | module Engines |
9 | class AbstractEngine < Chunk::Abstract |
10 | |
11 | # Create a new chunk for the whole content and replace it with its mask. |
12 | def self.apply_to(content) |
13 | new_chunk = self.new(content) |
14 | content.replace(new_chunk.mask) |
15 | end |
16 | |
17 | private |
18 | |
19 | # Never create engines by constructor - use apply_to instead |
20 | def initialize(content) |
21 | @content = content |
22 | end |
23 | |
24 | end |
25 | |
26 | class Textile < AbstractEngine |
27 | def mask |
28 | require_dependency 'redcloth' |
29 | |
30 | # 2006-08-04 (ADH): Hacks to work around RedCloth 3.0.4 |
31 | # appearing to malfunction - filter_html doesn't work (though |
32 | # Instiki had it turned off anyway) and hard_breaks really |
33 | # breaks things badly. |
34 | |
35 | # Was: redcloth = RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts]) |
36 | |
37 | redcloth = RedCloth.new(@content.to_s.gsub(/</, '<').gsub(/>/, '>'), @content.options[:engine_opts]) |
38 | redcloth.hard_breaks = false |
39 | |
40 | redcloth.filter_html = false |
41 | redcloth.no_span_caps = false |
42 | redcloth.to_html(:textile) |
43 | end |
44 | end |
45 | |
46 | class Markdown < AbstractEngine |
47 | def mask |
48 | require_dependency 'bluecloth_tweaked' |
49 | BlueCloth.new(@content, @content.options[:engine_opts]).to_html |
50 | end |
51 | end |
52 | |
53 | class Mixed < AbstractEngine |
54 | def mask |
55 | require_dependency 'redcloth' |
56 | redcloth = RedCloth.new(@content, @content.options[:engine_opts]) |
57 | redcloth.filter_html = false |
58 | redcloth.no_span_caps = false |
59 | redcloth.to_html |
60 | end |
61 | end |
62 | |
63 | class RDoc < AbstractEngine |
64 | def mask |
65 | require_dependency 'rdocsupport' |
66 | RDocSupport::RDocFormatter.new(@content).to_html |
67 | end |
68 | end |
69 | |
70 | MAP = { :textile => Textile, :markdown => Markdown, :mixed => Mixed, :rdoc => RDoc } |
71 | MAP.default = Textile |
72 | end |