pragdave-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 +101 -0
  4. data/PostInstall.txt +5 -0
  5. data/README.txt +31 -0
  6. data/Rakefile +4 -0
  7. data/app_generators/codex/USAGE +5 -0
  8. data/app_generators/codex/codex_generator.rb +107 -0
  9. data/app_generators/codex/templates/Rakefile +54 -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 +19 -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 +27 -0
  81. data/lib/codex/pressie.rb +108 -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
data/bin/codex ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubigen'
5
+
6
+ if %w(-v --version).include? ARGV.first
7
+ require 'codex/version'
8
+ puts "#{File.basename($0)} #{Codex::VERSION::STRING}"
9
+ exit(0)
10
+ end
11
+
12
+ require 'rubigen/scripts/generate'
13
+ source = RubiGen::PathSource.new(:application,
14
+ File.join(File.dirname(__FILE__), "../app_generators"))
15
+ RubiGen::Base.reset_sources
16
+ RubiGen::Base.append_sources source
17
+ RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'codex')
data/codex.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{codex}
3
+ s.version = "1.0.3"
4
+
5
+ s.specification_version = 2 if s.respond_to? :specification_version=
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Dave Thomas"]
9
+ s.date = %q{2008-05-19}
10
+ s.default_executable = %q{codex}
11
+ s.description = %q{Simple tool for creating source-code intensive presentations and courses}
12
+ s.email = ["dave@pragprog.com"]
13
+ s.executables = ["codex"]
14
+ s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "app_generators/codex/templates/readme.txt"]
15
+ s.files = ["History.txt", "LICENSE.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "app_generators/codex/USAGE", "app_generators/codex/codex_generator.rb", "app_generators/codex/templates/Rakefile", "app_generators/codex/templates/bin/build_all.rb", "app_generators/codex/templates/bin/postprocess_all.rb", "app_generators/codex/templates/bin/pressie.rb", "app_generators/codex/templates/code/control/basic_continuation.rb", "app_generators/codex/templates/code/control/cc_throw_catch.rb", "app_generators/codex/templates/code/control/closure_continuation.rb", "app_generators/codex/templates/code/control/closure_continuation_2.rb", "app_generators/codex/templates/dp.SyntaxHighlighter/CSS.html", "app_generators/codex/templates/dp.SyntaxHighlighter/CSharp.html", "app_generators/codex/templates/dp.SyntaxHighlighter/CollapseCode.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Cpp.html", "app_generators/codex/templates/dp.SyntaxHighlighter/CrashTest.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Delphi.html", "app_generators/codex/templates/dp.SyntaxHighlighter/FirstLine.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Index.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Java.html", "app_generators/codex/templates/dp.SyntaxHighlighter/JavaScript.html", "app_generators/codex/templates/dp.SyntaxHighlighter/NoControls.html", "app_generators/codex/templates/dp.SyntaxHighlighter/NoGutter.html", "app_generators/codex/templates/dp.SyntaxHighlighter/PHP.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Python.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Ruby.html", "app_generators/codex/templates/dp.SyntaxHighlighter/SQL.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/clipboard.swf", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCpp.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushCss.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJScript.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushJava.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPhp.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushPython.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushRuby.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushSql.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushVb.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shBrushXml.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.js", "app_generators/codex/templates/dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js", "app_generators/codex/templates/dp.SyntaxHighlighter/ShowColumns.html", "app_generators/codex/templates/dp.SyntaxHighlighter/SmartTabs.html", "app_generators/codex/templates/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css", "app_generators/codex/templates/dp.SyntaxHighlighter/Styles/TestPages.css", "app_generators/codex/templates/dp.SyntaxHighlighter/Templates/Test.dwt", "app_generators/codex/templates/dp.SyntaxHighlighter/VB.html", "app_generators/codex/templates/dp.SyntaxHighlighter/XML.html", "app_generators/codex/templates/html/all.html", "app_generators/codex/templates/readme.txt", "app_generators/codex/templates/slides/basics.slides", "app_generators/codex/templates/slides/building.slides", "app_generators/codex/templates/slides/example.slides", "app_generators/codex/templates/slides/including_code.slides", "app_generators/codex/templates/slides/including_tex.slides", "app_generators/codex/templates/slides/metadata.yml", "app_generators/codex/templates/slides/table_of_contents.slides", "app_generators/codex/templates/ui/default/blank.gif", "app_generators/codex/templates/ui/default/bodybg.gif", "app_generators/codex/templates/ui/default/framing.css", "app_generators/codex/templates/ui/default/iepngfix.htc", "app_generators/codex/templates/ui/default/opera.css", "app_generators/codex/templates/ui/default/outline.css", "app_generators/codex/templates/ui/default/pretty.css", "app_generators/codex/templates/ui/default/print.css", "app_generators/codex/templates/ui/default/s5-core.css", "app_generators/codex/templates/ui/default/slides.css", "app_generators/codex/templates/ui/default/slides.js", "bin/codex", "codex.gemspec", "config/hoe.rb", "config/requirements.rb", "lib/codex.rb", "lib/codex/content.rb", "lib/codex/pressie.rb", "lib/codex/version.rb", "lib/stylesheets/pressie.css", "lib/stylesheets/print.css", "lib/stylesheets/ruby.png", "script/console", "script/destroy", "script/generate", "setup.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/test_codex.rb", "test/test_codex_generator.rb", "test/test_generator_helper.rb", "test/test_helper.rb"]
16
+ s.has_rdoc = true
17
+ s.homepage = %q{http://codex.rubyforge.org}
18
+ s.post_install_message = %q{
19
+ To create new presentations:
20
+
21
+ codex path/to/presentation/folder
22
+
23
+ }
24
+ s.rdoc_options = ["--main", "README.txt"]
25
+ s.require_paths = ["lib"]
26
+ s.rubyforge_project = %q{codex}
27
+ s.rubygems_version = %q{1.1.1}
28
+ s.summary = %q{Simple tool for creating source-code intensive presentations and courses}
29
+ s.test_files = ["test/test_codex.rb", "test/test_codex_generator.rb", "test/test_generator_helper.rb", "test/test_helper.rb"]
30
+ end
data/config/hoe.rb ADDED
@@ -0,0 +1,76 @@
1
+ require 'codex/version'
2
+
3
+ AUTHOR = 'Dave Thomas' # can also be an array of Authors
4
+ EMAIL = "dave@pragprog.com"
5
+ DESCRIPTION = "Simple tool for creating source-code intensive presentations and courses"
6
+ GEM_NAME = 'codex' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'codex' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+ EXTRA_DEPENDENCIES = [
11
+ ['rake', '>= 0.8.1'],
12
+ ['RedCloth', '>= 3.0.4'],
13
+ ['ritex', '>= 0.1'],
14
+ ['rubigen', '>=1.3.2']
15
+ ] # An array of rubygem dependencies [name, version]
16
+
17
+ @config_file = "~/.rubyforge/user-config.yml"
18
+ @config = nil
19
+ RUBYFORGE_USERNAME = "unknown"
20
+ def rubyforge_username
21
+ unless @config
22
+ begin
23
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
24
+ rescue
25
+ puts <<-EOS
26
+ ERROR: No rubyforge config file found: #{@config_file}
27
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
28
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
29
+ EOS
30
+ exit
31
+ end
32
+ end
33
+ RUBYFORGE_USERNAME.replace @config["username"]
34
+ end
35
+
36
+
37
+ REV = nil
38
+ # UNCOMMENT IF REQUIRED:
39
+ # REV = YAML.load(`svn info`)['Revision']
40
+ VERS = Codex::VERSION::STRING + (REV ? ".#{REV}" : "")
41
+ RDOC_OPTS = ['--quiet', '--title', 'codex documentation',
42
+ "--opname", "index.html",
43
+ "--line-numbers",
44
+ "--main", "README",
45
+ "--inline-source"]
46
+
47
+ class Hoe
48
+ def extra_deps
49
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
50
+ @extra_deps
51
+ end
52
+ end
53
+
54
+ # Generate all the Rake tasks
55
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
56
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
57
+ p.developer(AUTHOR, EMAIL)
58
+ p.description = DESCRIPTION
59
+ p.summary = DESCRIPTION
60
+ p.url = HOMEPATH
61
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
62
+ p.test_globs = ["test/**/test_*.rb"]
63
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
64
+
65
+ # == Optional
66
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
67
+ #p.extra_deps = EXTRA_DEPENDENCIES
68
+
69
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
70
+ end
71
+
72
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
73
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
74
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
75
+ $hoe.rsync_args = '-av --delete --ignore-errors'
76
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib lib/filters]))
data/lib/codex.rb ADDED
@@ -0,0 +1,23 @@
1
+ base_dir = File.dirname(__FILE__)
2
+ $:.unshift(base_dir) unless
3
+ $:.include?(base_dir) || $:.include?(File.expand_path(base_dir))
4
+
5
+ module Codex; end
6
+
7
+ require 'codex/content'
8
+ require 'codex/pressie'
9
+ require 'codex/filter'
10
+
11
+ # Filters:
12
+
13
+ # If a filter fails to load, simply ignore it (it may be a missing local gem, such
14
+ # as ritex). This means that folks who write filters must ensure that their source
15
+ # throws an exception should it fail to find all its dependencies
16
+
17
+ Dir.glob(File.join(base_dir, 'codex/filters/*.rb')) do |filter|
18
+ begin
19
+ require(filter)
20
+ rescue Exception => e
21
+ ;
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ require 'redcloth'
2
+
3
+ class Codex::Content
4
+ START_SLIDE = %{<div class="slide">\n}
5
+ END_SLIDE = %{</div>\n}
6
+ BETWEEN_SLIDES = END_SLIDE + "\n" + START_SLIDE
7
+
8
+ def initialize(original)
9
+ @original = original.sub(/__END__.*/m, '').gsub(/__SKIP__.*?__ENDSKIP__/m, '')
10
+ end
11
+
12
+ def to_html
13
+ textile = Codex::Filters.instance.filter_all(@original)
14
+ content = split_into_slides(textile)
15
+ html = RedCloth.new(content).to_html
16
+ end
17
+
18
+ def split_into_slides(textile)
19
+ result = []
20
+ slides = textile.split(/^h1/).each do |slide|
21
+ unless slide.empty?
22
+ result << START_SLIDE << "\nh1" << slide << END_SLIDE
23
+ end
24
+ end
25
+ result.join
26
+ end
27
+ end
@@ -0,0 +1,108 @@
1
+ require 'yaml'
2
+
3
+ S5_HEAD = %{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml">
7
+
8
+ <head>
9
+ <title>&title;</title>
10
+ <!-- metadata -->
11
+ <meta name="generator" content="S5" />
12
+ <meta name="version" content="S5 1.1" />
13
+ <meta name="presdate" content="&date" />
14
+ <meta name="author" content="&author;" />
15
+ <meta name="organization" content="&organization;" />
16
+ <meta name="company" content="&company;" />
17
+ <!-- configuration parameters -->
18
+ <meta name="defaultView" content="slideshow" />
19
+ <meta name="controlVis" content="hidden" />
20
+ <!-- style sheet links -->
21
+ <link rel="stylesheet" href="../ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
22
+ <link rel="stylesheet" href="../ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
23
+ <link rel="stylesheet" href="../lib/stylesheets/print.css" type="text/css" media="print" id="slidePrint" />
24
+ <link rel="stylesheet" href="../ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
25
+
26
+ <link rel="stylesheet" href="../lib/stylesheets/pressie.css" type="text/css" />
27
+
28
+ <!-- S5 JS -->
29
+ <script src="../ui/default/slides.js" type="text/javascript"></script>
30
+
31
+ <!-- Syntax Highlighter -->
32
+ <link rel="stylesheet" href="../dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css"></link>
33
+
34
+ </head>
35
+ <body>
36
+
37
+ <div class="layout">
38
+ <div id="controls"><!-- DO NOT EDIT --></div>
39
+ <div id="currentSlide"><!-- DO NOT EDIT --></div>
40
+ <div id="header"></div>
41
+ <div id="footer">
42
+ <h2>Copyright &copy; &copyright;</h2>
43
+ </div>
44
+
45
+ </div>
46
+
47
+
48
+ <div class="presentation">
49
+ }
50
+
51
+ S5_TAIL = %{
52
+ <!-- Syntax Highlighter -->
53
+ <script language="javascript" src="../dp.SyntaxHighlighter/Scripts/shCore.js"></script>
54
+ <script language="javascript" src="../dp.SyntaxHighlighter/Scripts/shBrushCpp.js"></script>
55
+ <script language="javascript" src="../dp.SyntaxHighlighter/Scripts/shBrushRuby.js"></script>
56
+ <script language="javascript" src="../dp.SyntaxHighlighter/Scripts/shBrushXml.js"></script>
57
+ <script language="javascript">
58
+ dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf';
59
+ dp.SyntaxHighlighter.HighlightAll('code');
60
+ </script>
61
+ </div>
62
+ </body>
63
+ </html>
64
+ }
65
+
66
+
67
+ module Codex
68
+ class Pressie
69
+
70
+ def self.process
71
+ new.process
72
+ end
73
+
74
+ def process
75
+ metadata_name = ARGV.shift || usage("Missing metadata file name")
76
+ load_metadata(metadata_name)
77
+ input_name = ARGV.shift || usage("Missing input file name")
78
+ content = Content.new(File.read(input_name)) rescue usage($!.message)
79
+ header = substitute_metadata_into(S5_HEAD)
80
+ puts header, content.to_html, S5_TAIL
81
+ end
82
+
83
+
84
+ private
85
+
86
+ def usage(msg = nil)
87
+ STDERR.puts "pressie.rb <metadatafile> <inputfile>"
88
+ if msg
89
+ STDERR.puts
90
+ STDERR.puts msg
91
+ end
92
+ exit 1
93
+ end
94
+
95
+ def load_metadata(file_name)
96
+ @metadata = YAML.load_file(file_name)
97
+ end
98
+
99
+ def substitute_metadata_into(text)
100
+ text = text.dup
101
+ %w{author company organization date copyright title}.each do |key|
102
+ text.gsub!(/&#{key};/, @metadata[key]) if @metadata.has_key?(key)
103
+ end
104
+ text
105
+ end
106
+
107
+ end
108
+ end
@@ -0,0 +1,9 @@
1
+ module Codex #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ TINY = 3
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
@@ -0,0 +1,196 @@
1
+ code {
2
+ font-family: Monaco;
3
+ }
4
+
5
+
6
+ div.slide code {
7
+ font-weight: normal;
8
+ font-size: 85%;
9
+ color: #228;
10
+ }
11
+
12
+ div.dp-highlighter
13
+ {
14
+ font-family: "Gill Sans", "Consolas", "Courier New", Courier, mono;
15
+ font-size: 100%;
16
+ background-color: white;
17
+ overflow: auto;
18
+ /* margin: 18px 0px 18px 0px; */
19
+ padding-top: 1px; /* adds a little border on top when controls are hidden */
20
+ margin-bottom: 0px;
21
+ border: 2px solid;
22
+ }
23
+
24
+ div.dp-highlighter ol
25
+ {
26
+ margin-top: 1px;
27
+ margin-bottom: 10px;
28
+ padding: 0px;
29
+ }
30
+
31
+ div.dp-highlighter ol li
32
+ {
33
+ background-color: white;
34
+ }
35
+
36
+ div.dp-highlighter .keyword {
37
+ font-weight: normal;
38
+ color: #33b;
39
+ }
40
+
41
+ div.dp-highlighter .variable {
42
+ font-weight: normal;
43
+ }
44
+
45
+ div.dp-highlighter .string {
46
+ color: #22c;
47
+ font-style: italic;
48
+ }
49
+
50
+ .dp-cpp span.datatypes {
51
+ font-weight: normal;
52
+ }
53
+
54
+ div.codeurl {
55
+ margin-top: 0.5em;
56
+ margin-bottom: 1.5em;
57
+ padding-right: 1em;
58
+ text-align: right;
59
+ font-size: 50%;
60
+ }
61
+
62
+ div.slide ul {
63
+ margin-left: 0pt;
64
+ }
65
+
66
+ div.slide td {
67
+ padding: 0.3em 1em;
68
+ }
69
+
70
+ div.slide th {
71
+ background: #337;
72
+ color: white;
73
+ font-weight: bold;
74
+ padding: 0.2em 0em 0.2em 0em;
75
+ }
76
+
77
+
78
+ body {
79
+ background: white;
80
+ }
81
+
82
+
83
+
84
+
85
+ div#header {
86
+ background: white;
87
+ display: none;
88
+ }
89
+
90
+ div#footer {
91
+ background: white;
92
+ font-size: 50%;
93
+ height: 1em;
94
+ }
95
+
96
+ div#footer h2 {
97
+ font-weight: normal;
98
+ font-size: 60%;
99
+ }
100
+
101
+ div.slide h1 {
102
+ background: white;
103
+ color: #993333;
104
+ left: 1em;
105
+ top: 0.5em;
106
+ width: 95%;
107
+ padding: 0em 0em 0em 0em;
108
+ border-bottom: 6px solid #ffaaaa;
109
+ text-transform: none;
110
+ }
111
+
112
+
113
+ div.slide h1.exercise {
114
+ background: white;
115
+ color: #339933;
116
+ left: 1em;
117
+ top: 0.5em;
118
+ width: 95%;
119
+ padding: 0em 0em 0em 0em;
120
+ border-bottom: 6px solid #aaffaa;
121
+ }
122
+
123
+
124
+ div#slide0, div.title {
125
+ height: 100%;
126
+ background-image: url(ruby.png);
127
+ background-repeat: no-repeat;
128
+ background-position: bottom right;
129
+ }
130
+
131
+ div#slide0 h1, div.title h1 {
132
+ color: #993333;
133
+ background:transparent none repeat scroll 0%;
134
+ font-family:Helvetica,sans-serif;
135
+ font-size:2em;
136
+ font-size-adjust:none;
137
+ font-stretch:normal;
138
+ font-style:normal;
139
+ font-variant:normal;
140
+ font-weight:bold;
141
+ line-height:normal;
142
+ margin:10% 0pt 0pt;
143
+ padding:0pt;
144
+ position:static;
145
+ white-space:normal;
146
+ }
147
+ }
148
+
149
+ /* code layout */
150
+ div.code-large {
151
+ font-size: 150% !important;
152
+ line-height: 1.6em !important;
153
+ }
154
+
155
+
156
+ div.code-normal {
157
+ font-size: 90% !important;
158
+ line-height: 2em !important;
159
+ }
160
+
161
+ div.code-normal li {
162
+ margin-top: 0.6em;
163
+ }
164
+
165
+ div.code-small {
166
+ font-size: 75% !important;
167
+ line-height: 2em !important;
168
+ }
169
+
170
+ div.code-small li {
171
+ margin-top: 0.6em;
172
+ }
173
+
174
+ div.code-tiny {
175
+ font-size: 50% !important;
176
+ line-height: 2em !important;
177
+ }
178
+
179
+ div.code-tiny li {
180
+ margin-top: 0.6em;
181
+ }
182
+
183
+ div.code-supertiny {
184
+ font-size: 33% !important;
185
+ line-height: 2em !important;
186
+ }
187
+
188
+ div.code-supertiny li {
189
+ margin-top: 0.6em;
190
+ }
191
+
192
+ .caption {
193
+ color: #448;
194
+ font-family: Gil Sans;
195
+ font-size: 70%;
196
+ }