tobias-codex 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/History.txt +18 -0
  2. data/LICENSE.txt +29 -0
  3. data/Manifest.txt +105 -0
  4. data/PostInstall.txt +5 -0
  5. data/README.txt +34 -0
  6. data/Rakefile +6 -0
  7. data/app_generators/codex/USAGE +5 -0
  8. data/app_generators/codex/codex_generator.rb +109 -0
  9. data/app_generators/codex/templates/Rakefile +59 -0
  10. data/app_generators/codex/templates/bin/build_all.rb +47 -0
  11. data/app_generators/codex/templates/bin/postprocess_all.rb +5 -0
  12. data/app_generators/codex/templates/bin/pressie.rb +10 -0
  13. data/app_generators/codex/templates/code/control/basic_continuation.rb +11 -0
  14. data/app_generators/codex/templates/code/control/cc_throw_catch.rb +59 -0
  15. data/app_generators/codex/templates/code/control/closure_continuation.rb +8 -0
  16. data/app_generators/codex/templates/code/control/closure_continuation_2.rb +12 -0
  17. data/app_generators/codex/templates/dp.SyntaxHighlighter/CSS.html +115 -0
  18. data/app_generators/codex/templates/dp.SyntaxHighlighter/CSharp.html +134 -0
  19. data/app_generators/codex/templates/dp.SyntaxHighlighter/CollapseCode.html +90 -0
  20. data/app_generators/codex/templates/dp.SyntaxHighlighter/Cpp.html +190 -0
  21. data/app_generators/codex/templates/dp.SyntaxHighlighter/CrashTest.html +108 -0
  22. data/app_generators/codex/templates/dp.SyntaxHighlighter/Delphi.html +112 -0
  23. data/app_generators/codex/templates/dp.SyntaxHighlighter/FirstLine.html +90 -0
  24. data/app_generators/codex/templates/dp.SyntaxHighlighter/Index.html +80 -0
  25. data/app_generators/codex/templates/dp.SyntaxHighlighter/Java.html +122 -0
  26. data/app_generators/codex/templates/dp.SyntaxHighlighter/JavaScript.html +112 -0
  27. data/app_generators/codex/templates/dp.SyntaxHighlighter/NoControls.html +89 -0
  28. data/app_generators/codex/templates/dp.SyntaxHighlighter/NoGutter.html +89 -0
  29. data/app_generators/codex/templates/dp.SyntaxHighlighter/PHP.html +102 -0
  30. data/app_generators/codex/templates/dp.SyntaxHighlighter/Python.html +121 -0
  31. data/app_generators/codex/templates/dp.SyntaxHighlighter/Ruby.html +131 -0
  32. data/app_generators/codex/templates/dp.SyntaxHighlighter/SQL.html +98 -0
  33. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/clipboard.swf +0 -0
  34. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js +32 -0
  35. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCpp.js +73 -0
  36. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCss.js +52 -0
  37. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js +34 -0
  38. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJScript.js +22 -0
  39. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJava.js +28 -0
  40. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPhp.js +60 -0
  41. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPython.js +30 -0
  42. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushRuby.js +28 -0
  43. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushSql.js +42 -0
  44. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushVb.js +29 -0
  45. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushXml.js +70 -0
  46. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.js +414 -0
  47. data/app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js +674 -0
  48. data/app_generators/codex/templates/dp.SyntaxHighlighter/ShowColumns.html +89 -0
  49. data/app_generators/codex/templates/dp.SyntaxHighlighter/SmartTabs.html +88 -0
  50. data/app_generators/codex/templates/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css +158 -0
  51. data/app_generators/codex/templates/dp.SyntaxHighlighter/Styles/TestPages.css +63 -0
  52. data/app_generators/codex/templates/dp.SyntaxHighlighter/Templates/Test.dwt +80 -0
  53. data/app_generators/codex/templates/dp.SyntaxHighlighter/VB.html +115 -0
  54. data/app_generators/codex/templates/dp.SyntaxHighlighter/XML.html +136 -0
  55. data/app_generators/codex/templates/html/all.html +0 -0
  56. data/app_generators/codex/templates/readme.txt +4 -0
  57. data/app_generators/codex/templates/slides/basics.slides +37 -0
  58. data/app_generators/codex/templates/slides/building.slides +27 -0
  59. data/app_generators/codex/templates/slides/example.slides +80 -0
  60. data/app_generators/codex/templates/slides/including_code.slides +80 -0
  61. data/app_generators/codex/templates/slides/including_tex.slides +31 -0
  62. data/app_generators/codex/templates/slides/metadata.yml +4 -0
  63. data/app_generators/codex/templates/slides/table_of_contents.slides +20 -0
  64. data/app_generators/codex/templates/ui/default/blank.gif +0 -0
  65. data/app_generators/codex/templates/ui/default/bodybg.gif +0 -0
  66. data/app_generators/codex/templates/ui/default/framing.css +23 -0
  67. data/app_generators/codex/templates/ui/default/iepngfix.htc +42 -0
  68. data/app_generators/codex/templates/ui/default/opera.css +7 -0
  69. data/app_generators/codex/templates/ui/default/outline.css +15 -0
  70. data/app_generators/codex/templates/ui/default/pretty.css +86 -0
  71. data/app_generators/codex/templates/ui/default/print.css +1 -0
  72. data/app_generators/codex/templates/ui/default/s5-core.css +9 -0
  73. data/app_generators/codex/templates/ui/default/slides.css +3 -0
  74. data/app_generators/codex/templates/ui/default/slides.js +553 -0
  75. data/bin/codex +17 -0
  76. data/codex.gemspec +30 -0
  77. data/config/hoe.rb +76 -0
  78. data/config/requirements.rb +15 -0
  79. data/lib/codex.rb +23 -0
  80. data/lib/codex/content.rb +55 -0
  81. data/lib/codex/pressie.rb +118 -0
  82. data/lib/codex/version.rb +9 -0
  83. data/lib/stylesheets/pressie.css +196 -0
  84. data/lib/stylesheets/print.css +149 -0
  85. data/lib/stylesheets/ruby.png +0 -0
  86. data/script/console +10 -0
  87. data/script/destroy +14 -0
  88. data/script/generate +14 -0
  89. data/setup.rb +1585 -0
  90. data/tasks/deployment.rake +34 -0
  91. data/tasks/environment.rake +7 -0
  92. data/tasks/website.rake +9 -0
  93. data/test/test_codex.rb +11 -0
  94. data/test/test_codex_generator.rb +78 -0
  95. data/test/test_generator_helper.rb +29 -0
  96. data/test/test_helper.rb +2 -0
  97. metadata +164 -0
@@ -0,0 +1,18 @@
1
+ == 1.0.3 2008-05-22
2
+
3
+ * Support for user defined filters
4
+ * The functionality is in added file lib/codex/filters/filter.rb
5
+ * Included WebTeX filter
6
+ * Added ritex >= 0.1 as dependency
7
+ * Syntax highlighter is a filter now
8
+ * Syntax highlighter stuff from content.rb is now in lib/codex/filters/code_filter.rb
9
+ * Added some slides elaborating on this to the templates
10
+
11
+ == 1.0.2 2008-05-20
12
+
13
+ * Add rubigen 1.3.2 to dependency list as its used for codex generator
14
+
15
+ == 1.0.0 2008-05-19
16
+
17
+ * 1 major enhancement:
18
+ * Initial release
@@ -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.
@@ -0,0 +1,105 @@
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/code/graphviz/graph.dot
18
+ app_generators/codex/templates/dp.SyntaxHighlighter/CSS.html
19
+ app_generators/codex/templates/dp.SyntaxHighlighter/CSharp.html
20
+ app_generators/codex/templates/dp.SyntaxHighlighter/CollapseCode.html
21
+ app_generators/codex/templates/dp.SyntaxHighlighter/Cpp.html
22
+ app_generators/codex/templates/dp.SyntaxHighlighter/CrashTest.html
23
+ app_generators/codex/templates/dp.SyntaxHighlighter/Delphi.html
24
+ app_generators/codex/templates/dp.SyntaxHighlighter/FirstLine.html
25
+ app_generators/codex/templates/dp.SyntaxHighlighter/Index.html
26
+ app_generators/codex/templates/dp.SyntaxHighlighter/Java.html
27
+ app_generators/codex/templates/dp.SyntaxHighlighter/JavaScript.html
28
+ app_generators/codex/templates/dp.SyntaxHighlighter/NoControls.html
29
+ app_generators/codex/templates/dp.SyntaxHighlighter/NoGutter.html
30
+ app_generators/codex/templates/dp.SyntaxHighlighter/PHP.html
31
+ app_generators/codex/templates/dp.SyntaxHighlighter/Python.html
32
+ app_generators/codex/templates/dp.SyntaxHighlighter/Ruby.html
33
+ app_generators/codex/templates/dp.SyntaxHighlighter/SQL.html
34
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/clipboard.swf
35
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js
36
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCpp.js
37
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCss.js
38
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js
39
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJScript.js
40
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJava.js
41
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPhp.js
42
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPython.js
43
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushRuby.js
44
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushSql.js
45
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushVb.js
46
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushXml.js
47
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.js
48
+ app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js
49
+ app_generators/codex/templates/dp.SyntaxHighlighter/ShowColumns.html
50
+ app_generators/codex/templates/dp.SyntaxHighlighter/SmartTabs.html
51
+ app_generators/codex/templates/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css
52
+ app_generators/codex/templates/dp.SyntaxHighlighter/Styles/TestPages.css
53
+ app_generators/codex/templates/dp.SyntaxHighlighter/Templates/Test.dwt
54
+ app_generators/codex/templates/dp.SyntaxHighlighter/VB.html
55
+ app_generators/codex/templates/dp.SyntaxHighlighter/XML.html
56
+ app_generators/codex/templates/filters/example_filter.rb
57
+ app_generators/codex/templates/html/all.html
58
+ app_generators/codex/templates/readme.txt
59
+ app_generators/codex/templates/slides/basics.slides
60
+ app_generators/codex/templates/slides/building.slides
61
+ app_generators/codex/templates/slides/example.slides
62
+ app_generators/codex/templates/slides/graphviz.slides
63
+ app_generators/codex/templates/slides/including_code.slides
64
+ app_generators/codex/templates/slides/including_tex.slides
65
+ app_generators/codex/templates/slides/metadata.yml
66
+ app_generators/codex/templates/slides/table_of_contents.slides
67
+ app_generators/codex/templates/slides/user_defined.slides
68
+ app_generators/codex/templates/ui/default/blank.gif
69
+ app_generators/codex/templates/ui/default/bodybg.gif
70
+ app_generators/codex/templates/ui/default/framing.css
71
+ app_generators/codex/templates/ui/default/iepngfix.htc
72
+ app_generators/codex/templates/ui/default/opera.css
73
+ app_generators/codex/templates/ui/default/outline.css
74
+ app_generators/codex/templates/ui/default/pretty.css
75
+ app_generators/codex/templates/ui/default/print.css
76
+ app_generators/codex/templates/ui/default/s5-core.css
77
+ app_generators/codex/templates/ui/default/slides.css
78
+ app_generators/codex/templates/ui/default/slides.js
79
+ bin/codex
80
+ codex.gemspec
81
+ config/hoe.rb
82
+ config/requirements.rb
83
+ lib/codex.rb
84
+ lib/codex/content.rb
85
+ lib/codex/filter.rb
86
+ lib/codex/filters/code_filter.rb
87
+ lib/codex/filters/graphviz_filter.rb
88
+ lib/codex/filters/ritex_filter.rb
89
+ lib/codex/pressie.rb
90
+ lib/codex/version.rb
91
+ lib/stylesheets/pressie.css
92
+ lib/stylesheets/print.css
93
+ lib/stylesheets/ruby.png
94
+ script/console
95
+ script/destroy
96
+ script/generate
97
+ setup.rb
98
+ tasks/deployment.rake
99
+ tasks/environment.rake
100
+ tasks/website.rake
101
+ test/test_codex.rb
102
+ test/test_codex_generator.rb
103
+ test/test_filter.rb
104
+ test/test_generator_helper.rb
105
+ test/test_helper.rb
@@ -0,0 +1,5 @@
1
+
2
+ To create new presentations:
3
+
4
+ codex path/to/presentation/folder
5
+
@@ -0,0 +1,34 @@
1
+ = Codex
2
+
3
+ http://github.com/pragdave/codex
4
+
5
+ Note: this version (http://github.com/tobias/codex) differs from
6
+ pragdave's version by allowing repetition of the previous slide.
7
+
8
+ == Description
9
+
10
+ This is a remarkably trivial package that makes simply HTML-based presentations from
11
+ a set up source files written using Textile. It's designed to help when creating
12
+ slides that contain lots of code, as it allows code to be embedded from external source files.
13
+ This means that the code that you embed can come from running (and tested) programs.
14
+
15
+ The code in the resulting slides is syntax highlighted, and is hyperlinked to the original
16
+ source file, allowing that file to be brought up in Textmate.
17
+
18
+ == Requirements
19
+
20
+ * make sure you have Ruby 1.8.6 installed and RubyGems
21
+
22
+ == Installation
23
+
24
+ gem install codex
25
+
26
+ == Usage
27
+
28
+ * type 'rake all' in the same directory as this README file
29
+ * open html/all.html
30
+
31
+ == License
32
+
33
+ See the file LICENSE.txt for details on how this all may be used.
34
+
@@ -0,0 +1,6 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+
3
+ require 'config/requirements'
4
+ require 'config/hoe' # setup Hoe + all gem configuration
5
+
6
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,109 @@
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 including_tex table_of_contents user_defined graphviz].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
+ m.file_copy_each "code/graphviz/graph.dot"
38
+ ["CollapseCode.html", "Cpp.html", "CrashTest.html", "CSharp.html", "CSS.html",
39
+ "Delphi.html", "FirstLine.html", "Index.html", "Java.html", "JavaScript.html",
40
+ "NoControls.html", "NoGutter.html", "PHP.html", "Python.html", "Ruby.html",
41
+ "ShowColumns.html", "SmartTabs.html", "SQL.html",
42
+ "VB.html", "XML.html",
43
+ "Scripts/clipboard.swf", "Scripts/shBrushCpp.js", "Scripts/shBrushCSharp.js",
44
+ "Scripts/shBrushCss.js", "Scripts/shBrushDelphi.js", "Scripts/shBrushJava.js",
45
+ "Scripts/shBrushJScript.js", "Scripts/shBrushPhp.js", "Scripts/shBrushPython.js",
46
+ "Scripts/shBrushRuby.js", "Scripts/shBrushSql.js", "Scripts/shBrushVb.js",
47
+ "Scripts/shBrushXml.js", "Scripts/shCore.js", "Scripts/shCore.uncompressed.js",
48
+ "Styles/SyntaxHighlighter.css", "Styles/TestPages.css",
49
+ "Templates/Test.dwt"
50
+ ].each do |syntax|
51
+ m.file_copy_each "dp.SyntaxHighlighter/#{syntax}"
52
+ end
53
+ ["blank.gif", "bodybg.gif", "framing.css", "iepngfix.htc", "opera.css", "outline.css",
54
+ "pretty.css", "print.css", "s5-core.css", "slides.css", "slides.js"].each do |asset|
55
+ m.file_copy_each "ui/default/#{asset}"
56
+ end
57
+ m.template_copy_each "filters/example_filter.rb"
58
+
59
+ m.dependency "install_rubigen_scripts", [destination_root, 'codex'],
60
+ :shebang => options[:shebang], :collision => :force
61
+
62
+ m.readme 'readme.txt'
63
+ end
64
+ end
65
+
66
+ protected
67
+ def banner
68
+ <<-EOS
69
+ Creates a Codex presentations.
70
+ Codex is imple tool for creating source-code intensive presentations and courses
71
+
72
+ USAGE: #{spec.name} name
73
+ EOS
74
+ end
75
+
76
+ def add_options!(opts)
77
+ opts.separator ''
78
+ opts.separator 'Options:'
79
+ # For each option below, place the default
80
+ # at the top of the file next to "default_options"
81
+ # opts.on("-a", "--author=\"Your Name\"", String,
82
+ # "Some comment about this option",
83
+ # "Default: none") { |options[:author]| }
84
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
85
+ end
86
+
87
+ def extract_options
88
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
89
+ # Templates can access these value via the attr_reader-generated methods, but not the
90
+ # raw instance variable value.
91
+ # @author = options[:author]
92
+ end
93
+
94
+ # Installation skeleton. Intermediate directories are automatically
95
+ # created so don't sweat their absence here.
96
+ BASEDIRS = %w(
97
+ bin
98
+ code/control
99
+ code/graphviz
100
+ html/images
101
+ dp.SyntaxHighlighter/Scripts
102
+ dp.SyntaxHighlighter/Styles
103
+ dp.SyntaxHighlighter/Templates
104
+ script
105
+ slides
106
+ filters
107
+ ui/default
108
+ )
109
+ end
@@ -0,0 +1,59 @@
1
+ SLIDES_DIR = 'slides/'
2
+ HTML_DIR = 'html/'
3
+ IMG_DIR = 'html/images/'
4
+ ALL_HTML = File.join(HTML_DIR, "all.html")
5
+
6
+ METADATA = File.join(SLIDES_DIR, "metadata.yml")
7
+
8
+ Dir.chdir(SLIDES_DIR) { SRC = FileList['*.slides']; SRC.resolve }
9
+
10
+ OUTPUT = []
11
+
12
+ SRC.each do |file_name|
13
+ slide_file = File.join(SLIDES_DIR, file_name)
14
+ html_file = File.join(HTML_DIR, file_name.ext('.html'))
15
+ OUTPUT << html_file
16
+ desc "Build #{html_file} from #{slide_file}"
17
+ file html_file => [HTML_DIR, slide_file] do
18
+ sh "ruby bin/pressie.rb #{METADATA} #{slide_file} > #{html_file}"
19
+ end
20
+ end
21
+
22
+ desc "Build the HTML slides from all the files slides/*.slides files"
23
+ task :default => OUTPUT
24
+
25
+ desc "Build all slides based on the contents of slides/table_of_contents.slides"
26
+ task :all => [ 'tmp/', HTML_DIR, IMG_DIR, ALL_HTML, :remove_tmp ]
27
+
28
+ task ALL_HTML => 'tmp/almost_all.html' do
29
+ sh "ruby bin/postprocess_all.rb tmp/almost_all.html >#{ALL_HTML}"
30
+ end
31
+
32
+ task 'tmp/almost_all.html' => 'tmp/almost_all.slides' do
33
+ sh "ruby bin/pressie.rb #{METADATA} tmp/almost_all.slides >tmp/almost_all.html"
34
+ end
35
+
36
+ task 'tmp/almost_all.slides' => OUTPUT do
37
+ sh "ruby bin/build_all.rb #{METADATA} slides/table_of_contents.slides tmp/almost_all.slides"
38
+ end
39
+
40
+ file "tmp/" do
41
+ mkdir "tmp"
42
+ end
43
+
44
+ file "html/" do
45
+ mkdir "html"
46
+ end
47
+
48
+ file "html/" do
49
+ mkdir "html/images"
50
+ end
51
+
52
+ task :remove_tmp do
53
+ FileUtils.rm_rf("tmp")
54
+ end
55
+
56
+ desc "Remove all work products—slides and temporary files"
57
+ task :clean => :remove_tmp do
58
+ FileUtils.rm_rf HTML_DIR
59
+ 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,5 @@
1
+ content = File.read(ARGV[0])
2
+
3
+ content = content.gsub(/<div class="slide">\s+<h1 class="slide0"/m, %{<div class="title slide">\n<h1})
4
+
5
+ puts content
@@ -0,0 +1,10 @@
1
+ base = File.join(File.dirname(__FILE__), "..")
2
+ $: << File.join(base, "lib")
3
+
4
+ require 'rubygems'
5
+ require "codex"
6
+
7
+ # Load user defined filters
8
+ Dir.glob(Dir.pwd + "/filters/*.rb").each { |f| require f }
9
+
10
+ Codex::Pressie::process