Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 3587 Bytes
1 | class Typo |
2 | class Textfilter |
3 | class TMCode < TextFilterPlugin::MacroPre |
4 | plugin_display_name "TMCode" |
5 | plugin_description "Ensures the CSS files for TextMate syntax highlighting are included." |
6 | |
7 | def self.help_text |
8 | %{ |
9 | You can use `<typo:tmcode>` to include blocks of HTML code output by TextMate. |
10 | Optionally you can default the block to hidden, to be expanded with a `<typo:tmcoderef>` reference. |
11 | |
12 | <typo:tmcode> |
13 | <!-- TextMate-generated HTML code here --> |
14 | </typo:tmcode> |
15 | |
16 | Expand or collapse my <typo:tmcoderef id="foo">code</typo:tmcoderef>. |
17 | <typo:tmcode hidden="true" id="foo"> |
18 | <!-- TextMate-generated HTML code here --> |
19 | </typo:tmcode> |
20 | |
21 | You can also provide the optional attribute `theme` which specifies which theme to use for colorizing. |
22 | The list of available themes can be seen in the config screen, where you can also pick a theme to use |
23 | if the `theme` attribute isn't specified. |
24 | |
25 | The HTML code that you enclose with this macro can be generated by selecting a block of text in TextMate |
26 | and selecting the TextMate->Create HTML From Document command. |
27 | } |
28 | end |
29 | |
30 | def self.macrofilter(blog,content,attrib,params,text="") |
31 | isHidden = attrib['hidden'] || 'false' |
32 | blockID = attrib['id'] |
33 | theme = (attrib['theme'] || config_value(params, 'default-theme')).downcase.gsub(' ', '_') |
34 | |
35 | isHidden = ["yes", "true", "1", "hidden"].include?(isHidden.downcase) |
36 | |
37 | set_whiteboard blog, content, isHidden, theme unless content.nil? |
38 | |
39 | %{<notextile><div class="textmate-source #{theme}#{isHidden ? ' tmcode-collapsed' : ''}"#{blockID ? %{ id="tmcode_#{blockID}"} : ''}>\n#{text}\n</div></notextile>} |
40 | end |
41 | |
42 | def self.default_config |
43 | {"default-theme" => {:default => "twilight", |
44 | :description => "Default theme for tmcode snippets", |
45 | :options => ["Twilight", "iPlastic", "Dawn", 'Space Cadet']}} |
46 | end |
47 | |
48 | def self.set_whiteboard(blog, content, isHidden, theme) |
49 | content.whiteboard['page_header_tmcode'] = <<-HTML |
50 | <link href="#{blog.base_url}/stylesheets/textmate/textmate.css" media="all" rel="Stylesheet" type="text/css" /> |
51 | HTML |
52 | content.whiteboard["page_header_tmcode_#{theme}"] = <<-HTML unless theme.blank? |
53 | <link href="#{blog.base_url}/stylesheets/textmate/#{theme}.css" media="screen" rel="Stylesheet" type="text/css" /> |
54 | HTML |
55 | TMCodeRef.set_whiteboard blog, content if isHidden |
56 | end |
57 | end |
58 | |
59 | class TMCodeRef < TextFilterPlugin::MacroPost |
60 | plugin_display_name "TMCodeRef" |
61 | plugin_description "Adds expand/collapse links for TMCode sections." |
62 | |
63 | def self.help_text |
64 | %{ |
65 | Use `<typo:tmcoderef id="ref">text</typo:tmcoderef>` to cause `text` to be a hyperlink which toggles |
66 | the collapsed state of the `<typo:tmcode>` block referenced by the `id`. |
67 | } |
68 | end |
69 | |
70 | def self.macrofilter(blog,content,attrib,params,text="") |
71 | blockID = attrib['id'] |
72 | |
73 | set_whiteboard blog, content |
74 | |
75 | %{<a href="#" onclick="toggleCodeCollapse('tmcode_#{blockID.gsub("('|\\)", "\\\\\\1")}');return false;">#{text}</a>} |
76 | end |
77 | |
78 | def self.set_whiteboard(blog, content) |
79 | content.whiteboard['page_header_codecollapse'] = <<-HTML |
80 | <link href="#{blog.base_url}/stylesheets/codecollapse.css" media="screen" rel="Stylesheet" type="text/css" /> |
81 | <script src="#{blog.base_url}/javascripts/codecollapse.js" type="text/javascript" defer="defer"></script> |
82 | HTML |
83 | end |
84 | end |
85 | end |
86 | end |