codex 1.0.2 → 1.1.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/History.txt +31 -0
- data/Manifest.txt +83 -62
- data/Rakefile +2 -0
- data/app_generators/codex/codex_generator.rb +35 -20
- data/app_generators/codex/templates/Rakefile +14 -53
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/CSS.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/CSharp.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/CollapseCode.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Cpp.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/CrashTest.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Delphi.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/FirstLine.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Index.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Java.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/JavaScript.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/NoControls.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/NoGutter.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/PHP.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Python.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Ruby.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/SQL.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/clipboard.swf +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushCSharp.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushCpp.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushCss.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushDelphi.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushJScript.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushJava.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushPhp.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushPython.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushRuby.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushSql.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushVb.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shBrushXml.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shCore.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Scripts/shCore.uncompressed.js +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/ShowColumns.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/SmartTabs.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Styles/SyntaxHighlighter.css +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Styles/TestPages.css +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/Templates/Test.dwt +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/VB.html +0 -0
- data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/XML.html +0 -0
- data/{lib → app_generators/codex/templates/assets}/stylesheets/pressie.css +10 -7
- data/{lib → app_generators/codex/templates/assets}/stylesheets/print.css +0 -0
- data/{lib → app_generators/codex/templates/assets}/stylesheets/ruby.png +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/blank.gif +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/bodybg.gif +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/framing.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/iepngfix.htc +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/opera.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/outline.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/pretty.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/print.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/s5-core.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/slides.css +0 -0
- data/app_generators/codex/templates/{ui → assets/ui}/default/slides.js +0 -0
- data/app_generators/codex/templates/bin/build_all.rb +4 -3
- data/app_generators/codex/templates/code/graphviz/graph.dot +13 -0
- data/app_generators/codex/templates/{slides → config}/metadata.yml +1 -0
- data/app_generators/codex/templates/content/basics.textile +42 -0
- data/app_generators/codex/templates/{slides/building.slides → content/building.textile} +2 -2
- data/app_generators/codex/templates/{slides/example.slides → content/example.textile} +2 -1
- data/app_generators/codex/templates/content/graphviz.textile +35 -0
- data/app_generators/codex/templates/{slides/including_code.slides → content/including_code.textile} +9 -6
- data/app_generators/codex/templates/content/including_tex.textile +32 -0
- data/app_generators/codex/templates/{slides/table_of_contents.slides → content/table_of_contents.textile} +9 -0
- data/app_generators/codex/templates/content/user_defined.textile +83 -0
- data/app_generators/codex/templates/filters/example_filter.rb +13 -0
- data/app_generators/codex/templates/post_processors/change_code_urls.rb +16 -0
- data/app_generators/codex/templates/post_processors/upcase_titles.rb +15 -0
- data/app_generators/codex/templates/readme.txt +1 -1
- data/app_generators/codex/templates/templates/layout.erb +67 -0
- data/bin/codex +0 -0
- data/codex.gemspec +20 -7
- data/config/hoe.rb +2 -1
- data/config/requirements.rb +1 -1
- data/lib/codex.rb +16 -4
- data/lib/codex/content.rb +7 -151
- data/lib/codex/filter.rb +101 -0
- data/lib/codex/filters/code_filter.rb +92 -0
- data/lib/codex/filters/graphviz_filter.rb +112 -0
- data/lib/codex/filters/ritex_filter.rb +16 -0
- data/lib/codex/post_processor.rb +55 -0
- data/lib/codex/post_processors/01_slides_processor.rb +8 -0
- data/lib/codex/post_processors/02_add_title_slides.rb +11 -0
- data/lib/codex/pressie.rb +10 -97
- data/lib/codex/rake/codextask.rb +93 -0
- data/lib/codex/template_handler.rb +29 -0
- data/lib/codex/version.rb +2 -2
- data/test/codex/post_processor/test_add_title_slides_processor.rb +41 -0
- data/test/codex/post_processor/test_post_processors.rb +42 -0
- data/test/codex/post_processor/test_slides_processor.rb +31 -0
- data/test/codex/rake/test_codextask.rb +35 -0
- data/test/codex/test_pressie.rb +24 -0
- data/test/codex/test_template_handler.rb +28 -0
- data/test/test_codex_generator.rb +20 -26
- data/test/test_filter.rb +14 -0
- data/test/test_helper.rb +33 -1
- metadata +106 -70
- data/app_generators/codex/templates/bin/postprocess_all.rb +0 -5
- data/app_generators/codex/templates/bin/pressie.rb +0 -7
- data/app_generators/codex/templates/slides/basics.slides +0 -37
- data/test/test_codex.rb +0 -11
- data/test/test_generator_helper.rb +0 -29
File without changes
|
File without changes
|
File without changes
|
data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/VB.html
RENAMED
File without changes
|
data/app_generators/codex/templates/{dp.SyntaxHighlighter → assets/dp.SyntaxHighlighter}/XML.html
RENAMED
File without changes
|
@@ -11,7 +11,7 @@ div.slide code {
|
|
11
11
|
|
12
12
|
div.dp-highlighter
|
13
13
|
{
|
14
|
-
font-family: "
|
14
|
+
font-family: "Monaco", "Consolas", "Courier New", Courier, mono;
|
15
15
|
font-size: 100%;
|
16
16
|
background-color: white;
|
17
17
|
overflow: auto;
|
@@ -147,14 +147,17 @@ div#slide0 h1, div.title h1 {
|
|
147
147
|
}
|
148
148
|
|
149
149
|
/* code layout */
|
150
|
-
div.code-
|
150
|
+
div.code-superlarge {
|
151
151
|
font-size: 150% !important;
|
152
152
|
line-height: 1.6em !important;
|
153
153
|
}
|
154
|
-
|
154
|
+
div.code-large {
|
155
|
+
font-size: 90% !important;
|
156
|
+
line-height: 2em !important;
|
157
|
+
}
|
155
158
|
|
156
159
|
div.code-normal {
|
157
|
-
font-size:
|
160
|
+
font-size: 75% !important;
|
158
161
|
line-height: 2em !important;
|
159
162
|
}
|
160
163
|
|
@@ -163,7 +166,7 @@ div.code-normal li {
|
|
163
166
|
}
|
164
167
|
|
165
168
|
div.code-small {
|
166
|
-
font-size:
|
169
|
+
font-size: 50% !important;
|
167
170
|
line-height: 2em !important;
|
168
171
|
}
|
169
172
|
|
@@ -172,7 +175,7 @@ div.code-small li {
|
|
172
175
|
}
|
173
176
|
|
174
177
|
div.code-tiny {
|
175
|
-
font-size:
|
178
|
+
font-size: 40% !important;
|
176
179
|
line-height: 2em !important;
|
177
180
|
}
|
178
181
|
|
@@ -191,6 +194,6 @@ div.code-supertiny li {
|
|
191
194
|
|
192
195
|
.caption {
|
193
196
|
color: #448;
|
194
|
-
font-family:
|
197
|
+
font-family: Gill Sans;
|
195
198
|
font-size: 70%;
|
196
199
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# We're passed a file containing hyperlinks to the HTML
|
2
|
-
# (ie, table_con_contents.
|
3
|
-
# and contruct all.
|
2
|
+
# (ie, table_con_contents.textile)
|
3
|
+
# and contruct all.textile from it
|
4
4
|
require 'yaml'
|
5
5
|
|
6
6
|
def usage(msg = nil)
|
@@ -21,7 +21,7 @@ op_name = ARGV.shift || usage("Missing output file name")
|
|
21
21
|
metadata = YAML.load_file(metadata_name)
|
22
22
|
|
23
23
|
contents = File.readlines(contents_name).
|
24
|
-
grep(/^\*.*:(.*)\.html/) { File.join(BASE, "
|
24
|
+
grep(/^\*.*:(.*)\.html/) { File.join(BASE, "content", "#{$1}.textile") }.
|
25
25
|
map {|name| File.read(name) }
|
26
26
|
|
27
27
|
File.open(op_name, "w") do |op|
|
@@ -43,5 +43,6 @@ File.open(op_name, "w") do |op|
|
|
43
43
|
|
44
44
|
contents.each do |content|
|
45
45
|
op.puts content.sub(/h1/, 'h1(slide0)').sub(/__END__.*/m, '')
|
46
|
+
op.puts "\n\n"
|
46
47
|
end
|
47
48
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
digraph test123 {
|
2
|
+
a -> b -> c;
|
3
|
+
a -> {x y};
|
4
|
+
b [shape=box];
|
5
|
+
c [label="hello\nworld",color=blue,fontsize=24,
|
6
|
+
fontname="Palatino-Italic",fontcolor=red,style=filled];
|
7
|
+
a -> z [label="hi", weight=100];
|
8
|
+
x -> z [label="multi-line\nlabel"];
|
9
|
+
edge [style=dashed,color=red];
|
10
|
+
b -> x;
|
11
|
+
{rank=same; b x}
|
12
|
+
}
|
13
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
h1. The Basics
|
2
|
+
|
3
|
+
h1. Content and Code
|
4
|
+
|
5
|
+
* Content is created using "Textile markup":http://www.textism.com/tools/textile/
|
6
|
+
* Code is written as normal source files
|
7
|
+
* Content can embed parts of the source files
|
8
|
+
* It's all processed into an HTML-based presentation
|
9
|
+
|
10
|
+
|
11
|
+
h1. Presentation Metadata
|
12
|
+
|
13
|
+
* Required file @config/metadata.yml@
|
14
|
+
|
15
|
+
:code config/metadata.yml
|
16
|
+
|
17
|
+
h1. Where Stuff Goes
|
18
|
+
|
19
|
+
* Create your content in @content/xxx.textile@
|
20
|
+
* Write code under @code/xxx@
|
21
|
+
* Build the files @html/xxx.html@ by running @Rake@
|
22
|
+
|
23
|
+
|
24
|
+
h1. @.textile@ files
|
25
|
+
|
26
|
+
* Each @.textile@ file is a separate chunk of the presentation
|
27
|
+
* The first @h1.@ heading is the banner page for that chunk
|
28
|
+
* Each subsequent @h1.@ starts a new slide
|
29
|
+
* Using @h1(slide0).@ will create a title slide, like the first slide in every file
|
30
|
+
|
31
|
+
|
32
|
+
h1. Table of Contents
|
33
|
+
|
34
|
+
<div style="width:40%; float:right;">
|
35
|
+
:code content/table_of_contents.textile[class=code-tiny]
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div style="width:58%">
|
39
|
+
* You can divide your material into segments, each in a separate @xxx.textile@ file
|
40
|
+
* Then create @content/table_of_contents.textile@, eg:
|
41
|
+
</div>
|
42
|
+
|
@@ -2,11 +2,11 @@ h1. Building and Displaying HTML Slides
|
|
2
2
|
|
3
3
|
h1. Building HTML Slides
|
4
4
|
|
5
|
-
* Given an individual section in @
|
5
|
+
* Given an individual section in @content/xxx.textile@
|
6
6
|
|
7
7
|
@rake html/xxx.html@
|
8
8
|
|
9
|
-
* If you've created a @
|
9
|
+
* If you've created a @content/table_of_contents.textile@, build the whole presentation with
|
10
10
|
|
11
11
|
@rake all@
|
12
12
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
h1. Graphviz plugin
|
2
|
+
|
3
|
+
h1. Inline graphviz
|
4
|
+
|
5
|
+
You can embed graphviz code to generate graphs
|
6
|
+
:inlinecode
|
7
|
+
:inlinegraphviz [engine=neato]
|
8
|
+
graph test123 {
|
9
|
+
a -- b -- c;
|
10
|
+
a -- {x y};
|
11
|
+
x -- c [w=10.0];
|
12
|
+
x -- y [w=5.0,len=3];
|
13
|
+
}
|
14
|
+
:endinlinegraphviz
|
15
|
+
:end
|
16
|
+
|
17
|
+
:inlinegraphviz
|
18
|
+
graph test123 {
|
19
|
+
a -- b -- c;
|
20
|
+
a -- {x y};
|
21
|
+
x -- c [w=10.0];
|
22
|
+
x -- y [w=5.0,len=3];
|
23
|
+
}
|
24
|
+
:end
|
25
|
+
|
26
|
+
h1. File based graphviz
|
27
|
+
|
28
|
+
It is also possible to process graphviz from a given file:
|
29
|
+
|
30
|
+
:inlinecode
|
31
|
+
:graphviz code/graphviz/graph.dot
|
32
|
+
:end
|
33
|
+
|
34
|
+
:graphviz code/graphviz/graph.dot
|
35
|
+
|
data/app_generators/codex/templates/{slides/including_code.slides → content/including_code.textile}
RENAMED
@@ -57,10 +57,13 @@ h1. Override Code Language and/or CSS Class
|
|
57
57
|
:endinlinecode
|
58
58
|
|
59
59
|
* can appear in any order
|
60
|
-
* @lang=@<em>anything supported by SyntaxHighlighter</em>
|
61
|
-
**
|
62
|
-
|
63
|
-
|
60
|
+
* @lang=@<em>anything supported by SyntaxHighlighter</em>
|
61
|
+
** Defaults to @ruby@
|
62
|
+
** @cpp | csharp | css | delphi | java | jscript | php | python | ruby | sql | vb | xml@
|
63
|
+
** look in @assets/dp.SyntaxHighlighter@
|
64
|
+
* @class=code-superlarge | code-large | code-normal | code-small | code-tiny | code-supertiny@
|
65
|
+
|
66
|
+
|
64
67
|
h1. Embedding Code Inline
|
65
68
|
|
66
69
|
:inlinecode
|
@@ -72,8 +75,8 @@ h1. Embedding Code Inline
|
|
72
75
|
|
73
76
|
* @:inlinecode@ optionally takes @lang=xxx@ and @class=xx@
|
74
77
|
|
75
|
-
:inlinecode
|
76
|
-
:inlinecode
|
78
|
+
:inlinecode[class=code-large]
|
79
|
+
:inlinecode[lang=ruby class=code-large]
|
77
80
|
puts "Hello World!"
|
78
81
|
:endinlinecode
|
79
82
|
:endinlinecode
|
@@ -0,0 +1,32 @@
|
|
1
|
+
h1. Including TeX math formulas in slides
|
2
|
+
|
3
|
+
h1. Including TeX (WebTeX) math formula in slides
|
4
|
+
|
5
|
+
Everything line between :inlinetex and :endlinetex is treated as a TeX math formula
|
6
|
+
|
7
|
+
*Example:*
|
8
|
+
|
9
|
+
:inlinecode
|
10
|
+
:inlinewebtex
|
11
|
+
\alpha\beta\gamma
|
12
|
+
:endinlinewebtex
|
13
|
+
:end
|
14
|
+
|
15
|
+
*Result:*
|
16
|
+
|
17
|
+
:inlinewebtex
|
18
|
+
\alpha\beta\gamma
|
19
|
+
:end
|
20
|
+
|
21
|
+
h1. Ritex and WebTex
|
22
|
+
|
23
|
+
WebTeX is an adapation of the TeX math syntax which is designed for web page display.
|
24
|
+
|
25
|
+
Ritex is a nice little gem used to generate MathML from from WebTeX.
|
26
|
+
|
27
|
+
Ressources:
|
28
|
+
* "The WebTeX documentation":http://stuff.mit.edu/afs/athena/software/webeq/currenthome/docs/webtex/toc.html
|
29
|
+
* "The Ritex documentation":http://ritex.rubyforge.org/
|
30
|
+
|
31
|
+
The flipside is that MathML doesn't always display properly in browsers :-(
|
32
|
+
|
@@ -12,3 +12,12 @@ h1. Creating Slideshows
|
|
12
12
|
h1. An Example
|
13
13
|
|
14
14
|
* "Some Sample Slides":example.html
|
15
|
+
|
16
|
+
h1. Extra filters
|
17
|
+
|
18
|
+
* "The Ritex filter":including_tex.html
|
19
|
+
* "The Graphviz filter":graphviz.html
|
20
|
+
|
21
|
+
h1. Customization
|
22
|
+
|
23
|
+
* "User defined stuff":user_defined.html
|
@@ -0,0 +1,83 @@
|
|
1
|
+
h1. User-defined filters and post processors
|
2
|
+
|
3
|
+
h1(slide0). User-defined filters
|
4
|
+
|
5
|
+
Create your own tags
|
6
|
+
|
7
|
+
h1. User-defined filters
|
8
|
+
|
9
|
+
* Allow you to create your own @filters@ and @tags@
|
10
|
+
* They go in the @filters/@ directory
|
11
|
+
* There already is an example filter there
|
12
|
+
|
13
|
+
h1. Example filter
|
14
|
+
|
15
|
+
<div style="width: 50%; float: right">
|
16
|
+
|
17
|
+
:code filters/example_filter.rb[class=code-small]
|
18
|
+
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div style="width: 49%">
|
22
|
+
|
23
|
+
* Declare a class which inherits from @Codex::Filter@
|
24
|
+
** Set the tag you wish to use
|
25
|
+
** Implement @filter_inline(text,args)@
|
26
|
+
** Implement @filter_single(args)@
|
27
|
+
** You can omit filter_single if you just want it to load a file and parse it through filter_inline
|
28
|
+
|
29
|
+
</div>
|
30
|
+
|
31
|
+
It's _that_ simple.
|
32
|
+
|
33
|
+
h1. Using your filter
|
34
|
+
|
35
|
+
You can now use your tags in your slides:
|
36
|
+
|
37
|
+
:inlinecode
|
38
|
+
:inlinetest
|
39
|
+
Reverse this text
|
40
|
+
:endinlinetest
|
41
|
+
:endinlinecode
|
42
|
+
|
43
|
+
The result is:
|
44
|
+
|
45
|
+
:inlinetest
|
46
|
+
Reverse this text
|
47
|
+
:endinlinetest
|
48
|
+
|
49
|
+
|
50
|
+
h1(slide0). User defined Post Processors
|
51
|
+
|
52
|
+
Make your own changes to the slides after they are built
|
53
|
+
|
54
|
+
h1. User defined Post Processors
|
55
|
+
|
56
|
+
* Allow you to alter the generated HTML to your content
|
57
|
+
* You can use an HTML parser such as "Hpricot":http://github.com/whymirror/hpricot to make complex modifications or @String#gsub@ to make simple changes
|
58
|
+
* They go in the @post_processors/@ directory
|
59
|
+
* There are sample Post Processors defined in this directory
|
60
|
+
|
61
|
+
h1. How to create your own Post Processor
|
62
|
+
|
63
|
+
<div style="width: 50%; float: right">
|
64
|
+
|
65
|
+
:code post_processors/upcase_titles.rb[class=code-tiny]
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div style="width: 49%">
|
70
|
+
|
71
|
+
* Declare a class which inherits from @Codex::PostProcessor@
|
72
|
+
* Run the @register@ class method on top of the class declaration (commented in the example)
|
73
|
+
* Implement @process()@
|
74
|
+
* Manipulate the @html@ string variable. Whatever is held in @html@ will be passed on to the slides parser (and maybe to other Post Processors).
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
h1. Using the example
|
79
|
+
|
80
|
+
* Simply uncomment @# register@ and regenerate the slides using @rake@ (you may need to delete the old @.html@ files in @html/@)
|
81
|
+
* You will see that all titles are now in UPCASE.
|
82
|
+
* If you want to control the order that Post Processors are applied, name their files incrementally (ex.: @01_process_code.rb@, @02_process_text.rb@, etc)
|
83
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This is a sample post processor. It will change the links to
|
2
|
+
# the code samples from the TextMate specific "txmt://open?url=File:///(...)"
|
3
|
+
# to the general "File:///(...)", which will also work in Linux or Windows
|
4
|
+
# browsers without any hacking.
|
5
|
+
#
|
6
|
+
# PostProcessors have to subclass Codex::PostProcessor and
|
7
|
+
# overwrite the #process. You can then edit the @html variable,
|
8
|
+
# which holds the content of the parsed slides in HTML.
|
9
|
+
class ChangeCodeURLs < Codex::PostProcessor
|
10
|
+
# Uncomment the next line to activate this post processor:
|
11
|
+
# register
|
12
|
+
def process
|
13
|
+
# it will
|
14
|
+
@html = @html.gsub(/href="txmt:\/\/open\?url=/, "href=")
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This is a sample post processor. It will convert all
|
2
|
+
# slide titles to upper case.
|
3
|
+
# PostProcessors have to subclass Codex::PostProcessor
|
4
|
+
# and overwrite the #process. You can then edit the @html
|
5
|
+
# variable, which holds the content of the parsed slides
|
6
|
+
# in HTML.
|
7
|
+
class UpcaseTitles < Codex::PostProcessor
|
8
|
+
# Uncomment the next line to activate this post processor:
|
9
|
+
# register
|
10
|
+
def process
|
11
|
+
@html = @html.gsub(/(<h1[^<>]*>)([^<>]*)(<\/h1>)/) do |match|
|
12
|
+
"#{$1}#{$2.upcase}#{$3}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|