codex 1.0.2
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 +8 -0
- data/LICENSE.txt +29 -0
- data/Manifest.txt +95 -0
- data/PostInstall.txt +5 -0
- data/README.txt +31 -0
- data/Rakefile +4 -0
- data/app_generators/codex/USAGE +5 -0
- data/app_generators/codex/codex_generator.rb +106 -0
- data/app_generators/codex/templates/Rakefile +54 -0
- data/app_generators/codex/templates/bin/build_all.rb +47 -0
- data/app_generators/codex/templates/bin/postprocess_all.rb +5 -0
- data/app_generators/codex/templates/bin/pressie.rb +7 -0
- data/app_generators/codex/templates/code/control/basic_continuation.rb +11 -0
- data/app_generators/codex/templates/code/control/cc_throw_catch.rb +59 -0
- data/app_generators/codex/templates/code/control/closure_continuation.rb +8 -0
- data/app_generators/codex/templates/code/control/closure_continuation_2.rb +12 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/CSS.html +115 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/CSharp.html +134 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/CollapseCode.html +90 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Cpp.html +190 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/CrashTest.html +108 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Delphi.html +112 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/FirstLine.html +90 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Index.html +80 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Java.html +122 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/JavaScript.html +112 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/NoControls.html +89 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/NoGutter.html +89 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/PHP.html +102 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Python.html +121 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Ruby.html +131 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/SQL.html +98 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/clipboard.swf +0 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js +32 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCpp.js +73 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCss.js +52 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js +34 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJScript.js +22 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJava.js +28 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPhp.js +60 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPython.js +30 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushRuby.js +28 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushSql.js +42 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushVb.js +29 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushXml.js +70 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.js +414 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js +674 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/ShowColumns.html +89 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/SmartTabs.html +88 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css +158 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Styles/TestPages.css +63 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/Templates/Test.dwt +80 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/VB.html +115 -0
- data/app_generators/codex/templates/dp.SyntaxHighlighter/XML.html +136 -0
- data/app_generators/codex/templates/html/all.html +0 -0
- data/app_generators/codex/templates/readme.txt +4 -0
- data/app_generators/codex/templates/slides/basics.slides +37 -0
- data/app_generators/codex/templates/slides/building.slides +27 -0
- data/app_generators/codex/templates/slides/example.slides +80 -0
- data/app_generators/codex/templates/slides/including_code.slides +80 -0
- data/app_generators/codex/templates/slides/metadata.yml +4 -0
- data/app_generators/codex/templates/slides/table_of_contents.slides +14 -0
- data/app_generators/codex/templates/ui/default/blank.gif +0 -0
- data/app_generators/codex/templates/ui/default/bodybg.gif +0 -0
- data/app_generators/codex/templates/ui/default/framing.css +23 -0
- data/app_generators/codex/templates/ui/default/iepngfix.htc +42 -0
- data/app_generators/codex/templates/ui/default/opera.css +7 -0
- data/app_generators/codex/templates/ui/default/outline.css +15 -0
- data/app_generators/codex/templates/ui/default/pretty.css +86 -0
- data/app_generators/codex/templates/ui/default/print.css +1 -0
- data/app_generators/codex/templates/ui/default/s5-core.css +9 -0
- data/app_generators/codex/templates/ui/default/slides.css +3 -0
- data/app_generators/codex/templates/ui/default/slides.js +553 -0
- data/bin/codex +17 -0
- data/codex.gemspec +30 -0
- data/config/hoe.rb +75 -0
- data/config/requirements.rb +15 -0
- data/lib/codex.rb +7 -0
- data/lib/codex/content.rb +160 -0
- data/lib/codex/pressie.rb +108 -0
- data/lib/codex/version.rb +9 -0
- data/lib/stylesheets/pressie.css +196 -0
- data/lib/stylesheets/print.css +149 -0
- data/lib/stylesheets/ruby.png +0 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +9 -0
- data/test/test_codex.rb +11 -0
- data/test/test_codex_generator.rb +78 -0
- data/test/test_generator_helper.rb +29 -0
- data/test/test_helper.rb +2 -0
- metadata +163 -0
data/History.txt
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
This source tree contains a mixture of original material and other people's work. In particular,
|
2
|
+
it contains Syntax Highlighting code from http://code.google.com/p/syntaxhighlighter/ and
|
3
|
+
the S5 package from http://meyerweb.com/eric/tools/s5/. Both of these packages carry their own licenses,
|
4
|
+
and the conditions in this file do not apply to these packages.
|
5
|
+
|
6
|
+
The following terms apply to the original code in this source tree:
|
7
|
+
|
8
|
+
Copyright (c) 2008 Dave Thomas
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person
|
11
|
+
obtaining a copy of this software and associated documentation
|
12
|
+
files (the "Software"), to deal in the Software without
|
13
|
+
restriction, including without limitation the rights to use,
|
14
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
copies of the Software, and to permit persons to whom the
|
16
|
+
Software is furnished to do so, subject to the following
|
17
|
+
conditions:
|
18
|
+
|
19
|
+
The above copyright notice and this permission notice shall be
|
20
|
+
included in all copies or substantial portions of the Software.
|
21
|
+
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
23
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
24
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
25
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
26
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
27
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
28
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
29
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
History.txt
|
2
|
+
LICENSE.txt
|
3
|
+
Manifest.txt
|
4
|
+
PostInstall.txt
|
5
|
+
README.txt
|
6
|
+
Rakefile
|
7
|
+
app_generators/codex/USAGE
|
8
|
+
app_generators/codex/codex_generator.rb
|
9
|
+
app_generators/codex/templates/Rakefile
|
10
|
+
app_generators/codex/templates/bin/build_all.rb
|
11
|
+
app_generators/codex/templates/bin/postprocess_all.rb
|
12
|
+
app_generators/codex/templates/bin/pressie.rb
|
13
|
+
app_generators/codex/templates/code/control/basic_continuation.rb
|
14
|
+
app_generators/codex/templates/code/control/cc_throw_catch.rb
|
15
|
+
app_generators/codex/templates/code/control/closure_continuation.rb
|
16
|
+
app_generators/codex/templates/code/control/closure_continuation_2.rb
|
17
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/CSS.html
|
18
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/CSharp.html
|
19
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/CollapseCode.html
|
20
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Cpp.html
|
21
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/CrashTest.html
|
22
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Delphi.html
|
23
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/FirstLine.html
|
24
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Index.html
|
25
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Java.html
|
26
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/JavaScript.html
|
27
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/NoControls.html
|
28
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/NoGutter.html
|
29
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/PHP.html
|
30
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Python.html
|
31
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Ruby.html
|
32
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/SQL.html
|
33
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/clipboard.swf
|
34
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js
|
35
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCpp.js
|
36
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCss.js
|
37
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js
|
38
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJScript.js
|
39
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJava.js
|
40
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPhp.js
|
41
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPython.js
|
42
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushRuby.js
|
43
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushSql.js
|
44
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushVb.js
|
45
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushXml.js
|
46
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.js
|
47
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js
|
48
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/ShowColumns.html
|
49
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/SmartTabs.html
|
50
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css
|
51
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Styles/TestPages.css
|
52
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/Templates/Test.dwt
|
53
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/VB.html
|
54
|
+
app_generators/codex/templates/dp.SyntaxHighlighter/XML.html
|
55
|
+
app_generators/codex/templates/html/all.html
|
56
|
+
app_generators/codex/templates/readme.txt
|
57
|
+
app_generators/codex/templates/slides/basics.slides
|
58
|
+
app_generators/codex/templates/slides/building.slides
|
59
|
+
app_generators/codex/templates/slides/example.slides
|
60
|
+
app_generators/codex/templates/slides/including_code.slides
|
61
|
+
app_generators/codex/templates/slides/metadata.yml
|
62
|
+
app_generators/codex/templates/slides/table_of_contents.slides
|
63
|
+
app_generators/codex/templates/ui/default/blank.gif
|
64
|
+
app_generators/codex/templates/ui/default/bodybg.gif
|
65
|
+
app_generators/codex/templates/ui/default/framing.css
|
66
|
+
app_generators/codex/templates/ui/default/iepngfix.htc
|
67
|
+
app_generators/codex/templates/ui/default/opera.css
|
68
|
+
app_generators/codex/templates/ui/default/outline.css
|
69
|
+
app_generators/codex/templates/ui/default/pretty.css
|
70
|
+
app_generators/codex/templates/ui/default/print.css
|
71
|
+
app_generators/codex/templates/ui/default/s5-core.css
|
72
|
+
app_generators/codex/templates/ui/default/slides.css
|
73
|
+
app_generators/codex/templates/ui/default/slides.js
|
74
|
+
bin/codex
|
75
|
+
codex.gemspec
|
76
|
+
config/hoe.rb
|
77
|
+
config/requirements.rb
|
78
|
+
lib/codex.rb
|
79
|
+
lib/codex/content.rb
|
80
|
+
lib/codex/pressie.rb
|
81
|
+
lib/codex/version.rb
|
82
|
+
lib/stylesheets/pressie.css
|
83
|
+
lib/stylesheets/print.css
|
84
|
+
lib/stylesheets/ruby.png
|
85
|
+
script/console
|
86
|
+
script/destroy
|
87
|
+
script/generate
|
88
|
+
setup.rb
|
89
|
+
tasks/deployment.rake
|
90
|
+
tasks/environment.rake
|
91
|
+
tasks/website.rake
|
92
|
+
test/test_codex.rb
|
93
|
+
test/test_codex_generator.rb
|
94
|
+
test/test_generator_helper.rb
|
95
|
+
test/test_helper.rb
|
data/PostInstall.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= Codex
|
2
|
+
|
3
|
+
http://github.com/pragdave/codex
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
This is a remarkably trivial package that makes simply HTML-based presentations from
|
8
|
+
a set up source files written using Textile. It's designed to help when creating
|
9
|
+
slides that contain lots of code, as it allows code to be embedded from external source files.
|
10
|
+
This means that the code that you embed can come from running (and tested) programs.
|
11
|
+
|
12
|
+
The code in the resulting slides is syntax highlighted, and is hyperlinked to the original
|
13
|
+
source file, allowing that file to be brought up in Textmate.
|
14
|
+
|
15
|
+
== Requirements
|
16
|
+
|
17
|
+
* make sure you have Ruby 1.8.6 installed and RubyGems
|
18
|
+
|
19
|
+
== Installation
|
20
|
+
|
21
|
+
gem install codex
|
22
|
+
|
23
|
+
== Usage
|
24
|
+
|
25
|
+
* type 'rake all' in the same directory as this README file
|
26
|
+
* open html/all.html
|
27
|
+
|
28
|
+
== License
|
29
|
+
|
30
|
+
See the file LICENSE.txt for details on how this all may be used.
|
31
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
class CodexGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@destination_root = File.expand_path(args.shift)
|
14
|
+
@name = base_name
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest
|
19
|
+
record do |m|
|
20
|
+
# Ensure appropriate folder(s) exists
|
21
|
+
m.directory ''
|
22
|
+
BASEDIRS.each { |path| m.directory path }
|
23
|
+
|
24
|
+
# Create stubs
|
25
|
+
m.template_copy_each %w[Rakefile]
|
26
|
+
m.template_copy_each "html/all.html"
|
27
|
+
%w[basics building example including_code table_of_contents].each do |slide|
|
28
|
+
m.file_copy_each "slides/#{slide}.slides"
|
29
|
+
end
|
30
|
+
m.file_copy_each "slides/metadata.yml"
|
31
|
+
%w[build_all postprocess_all pressie].each do |bin|
|
32
|
+
m.file_copy_each "bin/#{bin}.rb"
|
33
|
+
end
|
34
|
+
%w[basic_continuation cc_throw_catch closure_continuation closure_continuation_2].each do |code|
|
35
|
+
m.file_copy_each "code/control/#{code}.rb"
|
36
|
+
end
|
37
|
+
["CollapseCode.html", "Cpp.html", "CrashTest.html", "CSharp.html", "CSS.html",
|
38
|
+
"Delphi.html", "FirstLine.html", "Index.html", "Java.html", "JavaScript.html",
|
39
|
+
"NoControls.html", "NoGutter.html", "PHP.html", "Python.html", "Ruby.html",
|
40
|
+
"ShowColumns.html", "SmartTabs.html", "SQL.html",
|
41
|
+
"VB.html", "XML.html",
|
42
|
+
"Scripts/clipboard.swf", "Scripts/shBrushCpp.js", "Scripts/shBrushCSharp.js",
|
43
|
+
"Scripts/shBrushCss.js", "Scripts/shBrushDelphi.js", "Scripts/shBrushJava.js",
|
44
|
+
"Scripts/shBrushJScript.js", "Scripts/shBrushPhp.js", "Scripts/shBrushPython.js",
|
45
|
+
"Scripts/shBrushRuby.js", "Scripts/shBrushSql.js", "Scripts/shBrushVb.js",
|
46
|
+
"Scripts/shBrushXml.js", "Scripts/shCore.js", "Scripts/shCore.uncompressed.js",
|
47
|
+
"Styles/SyntaxHighlighter.css", "Styles/TestPages.css",
|
48
|
+
"Templates/Test.dwt"
|
49
|
+
].each do |syntax|
|
50
|
+
m.file_copy_each "dp.SyntaxHighlighter/#{syntax}"
|
51
|
+
end
|
52
|
+
["blank.gif", "bodybg.gif", "framing.css", "iepngfix.htc", "opera.css", "outline.css",
|
53
|
+
"pretty.css", "print.css", "s5-core.css", "slides.css", "slides.js"].each do |asset|
|
54
|
+
m.file_copy_each "ui/default/#{asset}"
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
m.dependency "install_rubigen_scripts", [destination_root, 'codex'],
|
59
|
+
:shebang => options[:shebang], :collision => :force
|
60
|
+
|
61
|
+
m.readme 'readme.txt'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
def banner
|
67
|
+
<<-EOS
|
68
|
+
Creates a Codex presentations.
|
69
|
+
Codex is imple tool for creating source-code intensive presentations and courses
|
70
|
+
|
71
|
+
USAGE: #{spec.name} name
|
72
|
+
EOS
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_options!(opts)
|
76
|
+
opts.separator ''
|
77
|
+
opts.separator 'Options:'
|
78
|
+
# For each option below, place the default
|
79
|
+
# at the top of the file next to "default_options"
|
80
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
81
|
+
# "Some comment about this option",
|
82
|
+
# "Default: none") { |options[:author]| }
|
83
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
84
|
+
end
|
85
|
+
|
86
|
+
def extract_options
|
87
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
88
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
89
|
+
# raw instance variable value.
|
90
|
+
# @author = options[:author]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Installation skeleton. Intermediate directories are automatically
|
94
|
+
# created so don't sweat their absence here.
|
95
|
+
BASEDIRS = %w(
|
96
|
+
bin
|
97
|
+
code/control
|
98
|
+
html
|
99
|
+
dp.SyntaxHighlighter/Scripts
|
100
|
+
dp.SyntaxHighlighter/Styles
|
101
|
+
dp.SyntaxHighlighter/Templates
|
102
|
+
script
|
103
|
+
slides
|
104
|
+
ui/default
|
105
|
+
)
|
106
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
SLIDES_DIR = 'slides/'
|
2
|
+
HTML_DIR = 'html/'
|
3
|
+
ALL_HTML = File.join(HTML_DIR, "all.html")
|
4
|
+
|
5
|
+
METADATA = File.join(SLIDES_DIR, "metadata.yml")
|
6
|
+
|
7
|
+
Dir.chdir(SLIDES_DIR) { SRC = FileList['*.slides']; SRC.resolve }
|
8
|
+
|
9
|
+
OUTPUT = []
|
10
|
+
|
11
|
+
SRC.each do |file_name|
|
12
|
+
slide_file = File.join(SLIDES_DIR, file_name)
|
13
|
+
html_file = File.join(HTML_DIR, file_name.ext('.html'))
|
14
|
+
OUTPUT << html_file
|
15
|
+
desc "Build #{html_file} from #{slide_file}"
|
16
|
+
file html_file => [HTML_DIR, slide_file] do
|
17
|
+
sh "ruby bin/pressie.rb #{METADATA} #{slide_file} > #{html_file}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Build the HTML slides from all the files slides/*.slides files"
|
22
|
+
task :default => OUTPUT
|
23
|
+
|
24
|
+
desc "Build all slides based on the contents of slides/table_of_contents.slides"
|
25
|
+
task :all => [ 'tmp/', HTML_DIR, ALL_HTML, :remove_tmp ]
|
26
|
+
|
27
|
+
task ALL_HTML => 'tmp/almost_all.html' do
|
28
|
+
sh "ruby bin/postprocess_all.rb tmp/almost_all.html >#{ALL_HTML}"
|
29
|
+
end
|
30
|
+
|
31
|
+
task 'tmp/almost_all.html' => 'tmp/almost_all.slides' do
|
32
|
+
sh "ruby bin/pressie.rb #{METADATA} tmp/almost_all.slides >tmp/almost_all.html"
|
33
|
+
end
|
34
|
+
|
35
|
+
task 'tmp/almost_all.slides' => OUTPUT do
|
36
|
+
sh "ruby bin/build_all.rb #{METADATA} slides/table_of_contents.slides tmp/almost_all.slides"
|
37
|
+
end
|
38
|
+
|
39
|
+
file "tmp/" do
|
40
|
+
mkdir "tmp"
|
41
|
+
end
|
42
|
+
|
43
|
+
file "html/" do
|
44
|
+
mkdir "html"
|
45
|
+
end
|
46
|
+
|
47
|
+
task :remove_tmp do
|
48
|
+
FileUtils.rm_rf("tmp")
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Remove all work products—slides and temporary files"
|
52
|
+
task :clean => :remove_tmp do
|
53
|
+
FileUtils.rm_rf HTML_DIR
|
54
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# We're passed a file containing hyperlinks to the HTML
|
2
|
+
# (ie, table_con_contents.slides)
|
3
|
+
# and contruct all.slides from it
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
def usage(msg = nil)
|
7
|
+
STDERR.puts "#{__FILE__} metadata contents output"
|
8
|
+
if msg
|
9
|
+
STDERR.puts
|
10
|
+
STDERR.puts msg
|
11
|
+
end
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
BASE = File.join(File.dirname(__FILE__), "..")
|
16
|
+
|
17
|
+
metadata_name = ARGV.shift || usage("Missing metadata")
|
18
|
+
contents_name = ARGV.shift || usage("Missing table of contents file name")
|
19
|
+
op_name = ARGV.shift || usage("Missing output file name")
|
20
|
+
|
21
|
+
metadata = YAML.load_file(metadata_name)
|
22
|
+
|
23
|
+
contents = File.readlines(contents_name).
|
24
|
+
grep(/^\*.*:(.*)\.html/) { File.join(BASE, "slides", "#{$1}.slides") }.
|
25
|
+
map {|name| File.read(name) }
|
26
|
+
|
27
|
+
File.open(op_name, "w") do |op|
|
28
|
+
|
29
|
+
op.puts "h1. #{metadata['title']}\n\n"
|
30
|
+
op.puts "bq. #{metadata['author']}\n\n"
|
31
|
+
|
32
|
+
op.puts "h1. Contents\n\n"
|
33
|
+
|
34
|
+
op.puts %{<div style="font-size: 70%">\n\n}
|
35
|
+
|
36
|
+
contents.each do |content|
|
37
|
+
content =~ /h1.\s+(.*)/
|
38
|
+
STDERR.puts $1
|
39
|
+
op.puts "* #{$1}\n\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
op.puts "</div>\n\n"
|
43
|
+
|
44
|
+
contents.each do |content|
|
45
|
+
op.puts content.sub(/h1/, 'h1(slide0)').sub(/__END__.*/m, '')
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#START:stack
|
2
|
+
class CatchStack
|
3
|
+
Frame = Struct.new(:symbol, :cc)
|
4
|
+
|
5
|
+
def stack
|
6
|
+
Thread.current[:catch_stack] ||= []
|
7
|
+
end
|
8
|
+
|
9
|
+
def wrap(symbol, cc)
|
10
|
+
stack << Frame.new(symbol, cc)
|
11
|
+
begin
|
12
|
+
yield
|
13
|
+
ensure
|
14
|
+
stack.pop
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def find_continuation_for(symbol)
|
19
|
+
stack.pop until stack.empty? || stack.last.symbol == symbol
|
20
|
+
if stack.empty?
|
21
|
+
fail NameError, "uncaught throw `#{sym}'"
|
22
|
+
else
|
23
|
+
stack.pop.cc
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
#END:stack
|
28
|
+
|
29
|
+
#START:CC
|
30
|
+
module CC
|
31
|
+
CATCH_STACK = CatchStack.new
|
32
|
+
|
33
|
+
def self.catch(sym)
|
34
|
+
callcc do |cc|
|
35
|
+
CATCH_STACK.wrap(sym, cc) do
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.throw(sym, value=nil)
|
42
|
+
cc = CATCH_STACK.find_continuation_for(sym)
|
43
|
+
cc.call(value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
#END:CC
|
47
|
+
|
48
|
+
#START:body
|
49
|
+
def test_method
|
50
|
+
CC.throw(:x, "thrown X") if rand < 0.5
|
51
|
+
end
|
52
|
+
|
53
|
+
result = CC.catch(:x) do
|
54
|
+
test_method
|
55
|
+
"normal exit"
|
56
|
+
end
|
57
|
+
|
58
|
+
puts "Result is #{result}"
|
59
|
+
#END:body
|