codex 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
|
+
|
6
|
+
<head>
|
7
|
+
<title><%= @title %></title>
|
8
|
+
<!-- metadata -->
|
9
|
+
<meta name="generator" content="S5" />
|
10
|
+
<meta name="version" content="S5 1.1" />
|
11
|
+
<meta name="presdate" content="<%= @date %>" />
|
12
|
+
<meta name="author" content="<%= @author %>" />
|
13
|
+
<meta name="company" content="<%= @company %>" />
|
14
|
+
<!-- configuration parameters -->
|
15
|
+
<meta name="defaultView" content="slideshow" />
|
16
|
+
<meta name="controlVis" content="hidden" />
|
17
|
+
<!-- style sheet links -->
|
18
|
+
<link rel="stylesheet" href="../assets/ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
|
19
|
+
<link rel="stylesheet" href="../assets/ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
|
20
|
+
<link rel="stylesheet" href="../assets/stylesheets/print.css" type="text/css" media="print" id="slidePrint" />
|
21
|
+
<link rel="stylesheet" href="../assets/ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
|
22
|
+
<link rel="stylesheet" href="../assets/stylesheets/pressie.css" type="text/css" />
|
23
|
+
|
24
|
+
<!-- S5 JS -->
|
25
|
+
<script src="../assets/ui/default/slides.js" type="text/javascript"></script>
|
26
|
+
|
27
|
+
<!-- Syntax Highlighter -->
|
28
|
+
<link rel="stylesheet" href="../assets/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css"></link>
|
29
|
+
|
30
|
+
</head>
|
31
|
+
<body>
|
32
|
+
|
33
|
+
<div class="layout">
|
34
|
+
<div id="controls"><!-- DO NOT EDIT --></div>
|
35
|
+
<div id="currentSlide"><!-- DO NOT EDIT --></div>
|
36
|
+
<div id="header"></div>
|
37
|
+
<div id="footer">
|
38
|
+
<h2>Copyright © <%= @copyright %></h2>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
</div>
|
42
|
+
|
43
|
+
|
44
|
+
<div class="presentation">
|
45
|
+
<%= content %>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<!-- Syntax Highlighter -->
|
49
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shCore.js"></script>
|
50
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js"></script>
|
51
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushPhp.js"></script>
|
52
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushJScript.js"></script>
|
53
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushJava.js"></script>
|
54
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushVb.js"></script>
|
55
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushSql.js"></script>
|
56
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushXml.js"></script>
|
57
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js"></script>
|
58
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushPython.js"></script>
|
59
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushRuby.js"></script>
|
60
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushCss.js"></script>
|
61
|
+
<script class="javascript" src="../assets/dp.SyntaxHighlighter/Scripts/shBrushCpp.js"></script>
|
62
|
+
<script language="javascript">
|
63
|
+
dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf';
|
64
|
+
dp.SyntaxHighlighter.HighlightAll('code');
|
65
|
+
</script>
|
66
|
+
</body>
|
67
|
+
</html>
|
data/bin/codex
CHANGED
File without changes
|
data/codex.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = %q{codex}
|
3
|
-
s.version = "1.0
|
4
|
-
|
5
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
5
|
+
s.version = "1.1.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Dave Thomas"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2009-10-09}
|
10
10
|
s.default_executable = %q{codex}
|
11
11
|
s.description = %q{Simple tool for creating source-code intensive presentations and courses}
|
12
12
|
s.email = ["dave@pragprog.com"]
|
13
13
|
s.executables = ["codex"]
|
14
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/
|
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/assets/dp.SyntaxHighlighter/CSS.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/CSharp.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/CollapseCode.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Cpp.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/CrashTest.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Delphi.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/FirstLine.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Index.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Java.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/JavaScript.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/NoControls.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/NoGutter.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/PHP.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Python.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Ruby.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/SQL.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/clipboard.swf", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushCpp.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushCss.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushDelphi.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushJScript.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushJava.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushPhp.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushPython.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushRuby.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushSql.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushVb.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shBrushXml.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shCore.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/ShowColumns.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/SmartTabs.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Styles/TestPages.css", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/Templates/Test.dwt", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/VB.html", "app_generators/codex/templates/assets/dp.SyntaxHighlighter/XML.html", "app_generators/codex/templates/assets/stylesheets/pressie.css", "app_generators/codex/templates/assets/stylesheets/print.css", "app_generators/codex/templates/assets/stylesheets/ruby.png", "app_generators/codex/templates/assets/ui/default/blank.gif", "app_generators/codex/templates/assets/ui/default/bodybg.gif", "app_generators/codex/templates/assets/ui/default/framing.css", "app_generators/codex/templates/assets/ui/default/iepngfix.htc", "app_generators/codex/templates/assets/ui/default/opera.css", "app_generators/codex/templates/assets/ui/default/outline.css", "app_generators/codex/templates/assets/ui/default/pretty.css", "app_generators/codex/templates/assets/ui/default/print.css", "app_generators/codex/templates/assets/ui/default/s5-core.css", "app_generators/codex/templates/assets/ui/default/slides.css", "app_generators/codex/templates/assets/ui/default/slides.js", "app_generators/codex/templates/bin/build_all.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/code/graphviz/graph.dot", "app_generators/codex/templates/config/metadata.yml", "app_generators/codex/templates/content/basics.textile", "app_generators/codex/templates/content/building.textile", "app_generators/codex/templates/content/example.textile", "app_generators/codex/templates/content/graphviz.textile", "app_generators/codex/templates/content/including_code.textile", "app_generators/codex/templates/content/including_tex.textile", "app_generators/codex/templates/content/table_of_contents.textile", "app_generators/codex/templates/content/user_defined.textile", "app_generators/codex/templates/filters/example_filter.rb", "app_generators/codex/templates/html/all.html", "app_generators/codex/templates/post_processors/change_code_urls.rb", "app_generators/codex/templates/post_processors/upcase_titles.rb", "app_generators/codex/templates/readme.txt", "app_generators/codex/templates/templates/layout.erb", "bin/codex", "codex.gemspec", "config/hoe.rb", "config/requirements.rb", "lib/codex.rb", "lib/codex/content.rb", "lib/codex/filter.rb", "lib/codex/filters/code_filter.rb", "lib/codex/filters/graphviz_filter.rb", "lib/codex/filters/ritex_filter.rb", "lib/codex/post_processor.rb", "lib/codex/post_processors/01_slides_processor.rb", "lib/codex/post_processors/02_add_title_slides.rb", "lib/codex/pressie.rb", "lib/codex/rake/codextask.rb", "lib/codex/template_handler.rb", "lib/codex/version.rb", "script/console", "script/destroy", "script/generate", "setup.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/codex/post_processor/test_add_title_slides_processor.rb", "test/codex/post_processor/test_post_processors.rb", "test/codex/post_processor/test_slides_processor.rb", "test/codex/rake/test_codextask.rb", "test/codex/test_pressie.rb", "test/codex/test_template_handler.rb", "test/test_codex_generator.rb", "test/test_filter.rb", "test/test_helper.rb"]
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.homepage = %q{http://codex.rubyforge.org}
|
18
18
|
s.post_install_message = %q{
|
@@ -24,7 +24,20 @@ To create new presentations:
|
|
24
24
|
s.rdoc_options = ["--main", "README.txt"]
|
25
25
|
s.require_paths = ["lib"]
|
26
26
|
s.rubyforge_project = %q{codex}
|
27
|
-
s.rubygems_version = %q{1.
|
27
|
+
s.rubygems_version = %q{1.3.1}
|
28
28
|
s.summary = %q{Simple tool for creating source-code intensive presentations and courses}
|
29
|
-
s.test_files = ["test/
|
29
|
+
s.test_files = ["test/codex/post_processor/test_add_title_slides_processor.rb", "test/codex/post_processor/test_post_processors.rb", "test/codex/post_processor/test_slides_processor.rb", "test/codex/rake/test_codextask.rb", "test/codex/test_pressie.rb", "test/codex/test_template_handler.rb", "test/test_codex_generator.rb", "test/test_filter.rb", "test/test_helper.rb"]
|
30
|
+
|
31
|
+
if s.respond_to? :specification_version then
|
32
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
33
|
+
s.specification_version = 2
|
34
|
+
|
35
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
36
|
+
s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
|
37
|
+
else
|
38
|
+
s.add_dependency(%q<hoe>, [">= 2.3.3"])
|
39
|
+
end
|
40
|
+
else
|
41
|
+
s.add_dependency(%q<hoe>, [">= 2.3.3"])
|
42
|
+
end
|
30
43
|
end
|
data/config/hoe.rb
CHANGED
@@ -10,6 +10,7 @@ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
|
10
10
|
EXTRA_DEPENDENCIES = [
|
11
11
|
['rake', '>= 0.8.1'],
|
12
12
|
['RedCloth', '>= 3.0.4'],
|
13
|
+
['ritex', '>= 0.1'],
|
13
14
|
['rubigen', '>=1.3.2']
|
14
15
|
] # An array of rubygem dependencies [name, version]
|
15
16
|
|
@@ -72,4 +73,4 @@ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
|
72
73
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
73
74
|
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
74
75
|
$hoe.rsync_args = '-av --delete --ignore-errors'
|
75
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
76
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
CHANGED
data/lib/codex.rb
CHANGED
@@ -1,7 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Codex
|
2
|
+
class << self
|
3
|
+
# Where the codex slides are located
|
4
|
+
attr_accessor :root
|
5
|
+
# Where the codex libraries are located (it may be a gem or in vendor dir)
|
6
|
+
attr_accessor :lib_root
|
7
|
+
end
|
8
|
+
end
|
3
9
|
|
4
|
-
|
10
|
+
base_dir = File.dirname(__FILE__)
|
11
|
+
$:.unshift(base_dir) unless
|
12
|
+
$:.include?(base_dir) || $:.include?(File.expand_path(base_dir))
|
13
|
+
Codex.lib_root = base_dir
|
5
14
|
|
6
15
|
require 'codex/content'
|
7
|
-
require 'codex/pressie'
|
16
|
+
require 'codex/pressie'
|
17
|
+
require 'codex/filter'
|
18
|
+
require 'codex/post_processor'
|
19
|
+
require 'codex/template_handler'
|
data/lib/codex/content.rb
CHANGED
@@ -2,159 +2,15 @@ require 'redcloth'
|
|
2
2
|
|
3
3
|
class Codex::Content
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
class Descriptor
|
9
|
-
attr_reader :file_name, :part
|
10
|
-
attr_reader :css_class
|
11
|
-
attr_reader :lang
|
12
|
-
|
13
|
-
def initialize(string)
|
14
|
-
@css_class = "code-normal"
|
15
|
-
@lang = "ruby"
|
16
|
-
|
17
|
-
if string && string =~ /(.*?)\[(.*)\]/
|
18
|
-
@file_name = $1
|
19
|
-
parse_params($2.dup)
|
20
|
-
else
|
21
|
-
@file_name = string
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def parse_params(params)
|
26
|
-
params.split.each do |param|
|
27
|
-
if param =~ /(.*?)=(.*)/
|
28
|
-
case $1
|
29
|
-
when "class"
|
30
|
-
@css_class = $2
|
31
|
-
when "lang"
|
32
|
-
@lang = $2
|
33
|
-
else
|
34
|
-
fail "Unknown parameter #{$1} in '#{params}'"
|
35
|
-
end
|
36
|
-
else
|
37
|
-
@part = param
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
START_SLIDE = %{<div class="slide">\n}
|
45
|
-
END_SLIDE = %{</div>\n}
|
46
|
-
BETWEEN_SLIDES = END_SLIDE + "\n" + START_SLIDE
|
47
|
-
|
48
|
-
CODE_PATTERN = /^:code\s+(.+)/
|
49
|
-
|
50
|
-
# Temporarily prepended to lines of incldued code to stop them being processed
|
51
|
-
# as Textfile
|
52
|
-
|
53
|
-
INCLUDED_CODE_PREFIX = "XXX\001"
|
54
|
-
INCLUDED_CODE_PREFIX_REGEXP = /#{INCLUDED_CODE_PREFIX}/mo
|
55
|
-
|
56
|
-
|
57
|
-
def initialize(original)
|
58
|
-
@original = original.sub(/__END__.*/m, '').gsub(/__SKIP__.*?__ENDSKIP__/m, '')
|
5
|
+
def initialize(filename)
|
6
|
+
@filename = filename
|
7
|
+
@original = File.read(@filename).sub(/__END__.*/m, '').gsub(/__SKIP__.*?__ENDSKIP__/m, '')
|
59
8
|
end
|
60
9
|
|
61
10
|
def to_html
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
html = RedCloth.new(content).to_html
|
66
|
-
remove_code_escaping_from(html)
|
67
|
-
end
|
68
|
-
|
69
|
-
# look for :code filename[part] and substitute in the appropriate part
|
70
|
-
# of the given file. Do in two steps because the regexp engine isn;t reentrant
|
71
|
-
def preprocess_code(text)
|
72
|
-
chunks = {}
|
73
|
-
text.scan(CODE_PATTERN) do |file,|
|
74
|
-
desc = Descriptor.new(file)
|
75
|
-
chunks[file] = find_content_from(desc)
|
76
|
-
end
|
77
|
-
text.gsub(CODE_PATTERN) { file = $1.dup; format_code(Descriptor.new(file), chunks[file]) }
|
78
|
-
end
|
79
|
-
|
80
|
-
# Look for :inlinecode /.../:endinlinecode and substitute in as if it came from a file
|
81
|
-
def preprocess_inlinecode(text)
|
82
|
-
state = :copying
|
83
|
-
result = []
|
84
|
-
text.split(/\n/).each do |line|
|
85
|
-
case state
|
86
|
-
when :copying
|
87
|
-
if line =~ /^:inlinecode(.*)/
|
88
|
-
args = $1.strip
|
89
|
-
desc = Descriptor.new("--[#{args}]")
|
90
|
-
result << %{<div class="#{desc.css_class}">\n}
|
91
|
-
result << %{\n<pre name="code" class="#{desc.lang}:nogutter:nocontrols">\n}
|
92
|
-
state = :incode
|
93
|
-
else
|
94
|
-
result << line
|
95
|
-
end
|
96
|
-
when :incode
|
97
|
-
if line =~ /^:endinlinecode/
|
98
|
-
result << "</pre></div>\n\n"
|
99
|
-
state = :copying
|
100
|
-
else
|
101
|
-
result << INCLUDED_CODE_PREFIX + line
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
result.join("\n")
|
107
|
-
end
|
108
|
-
|
109
|
-
def split_into_slides(textile)
|
110
|
-
result = []
|
111
|
-
slides = textile.split(/^h1/).each do |slide|
|
112
|
-
unless slide.empty?
|
113
|
-
result << START_SLIDE << "\nh1" << slide << END_SLIDE
|
114
|
-
end
|
115
|
-
end
|
116
|
-
result.join
|
117
|
-
end
|
118
|
-
|
119
|
-
def find_content_from(desc)
|
120
|
-
begin
|
121
|
-
content = File.read(desc.file_name)
|
122
|
-
rescue Exception => e
|
123
|
-
STDERR.puts e.message
|
124
|
-
exit 2
|
125
|
-
end
|
126
|
-
|
127
|
-
find_part_in(content, desc.part)
|
128
|
-
end
|
129
|
-
|
130
|
-
def find_part_in(content, part_name)
|
131
|
-
result = []
|
132
|
-
state = part_name ? :skipping : :normal
|
133
|
-
content.each_line do |line|
|
134
|
-
if line.sub!(/(START|END):(\w+)/, '')
|
135
|
-
if $2 == part_name
|
136
|
-
if $1 == "START"
|
137
|
-
state = :normal
|
138
|
-
else
|
139
|
-
state = :skipping
|
140
|
-
end
|
141
|
-
end
|
142
|
-
next
|
143
|
-
end
|
144
|
-
result << line unless state == :skipping
|
145
|
-
end
|
146
|
-
result.join
|
147
|
-
end
|
148
|
-
|
149
|
-
def format_code(desc, code)
|
150
|
-
code = code.gsub(/^/m, INCLUDED_CODE_PREFIX)
|
151
|
-
%{<div class="#{desc.css_class}">\n} +
|
152
|
-
%{\n<pre name="code" class="#{desc.lang}:nogutter:nocontrols">#{code}} +
|
153
|
-
%{</pre></div>} +
|
154
|
-
%{<div class="codeurl"><a href="txmt://open?url=file://#{File.expand_path(desc.file_name)}">#{desc.file_name}</a></div>\n\n}
|
155
|
-
end
|
156
|
-
|
157
|
-
def remove_code_escaping_from(html)
|
158
|
-
html.gsub(INCLUDED_CODE_PREFIX_REGEXP, '')
|
11
|
+
content = Codex::Filters.instance.filter_all(@original)
|
12
|
+
html = Codex::TemplateHandler.choose(@filename).call(content)
|
13
|
+
Codex::PostProcessors.instance.process_all(html)
|
159
14
|
end
|
15
|
+
|
160
16
|
end
|
data/lib/codex/filter.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module Codex
|
4
|
+
# Filter is an abstract class for user defined filters.
|
5
|
+
# It lets them declare the tag they wish to use.
|
6
|
+
# When declaring a tag, it also registers with Filters.
|
7
|
+
class Filter
|
8
|
+
attr_accessor :tag
|
9
|
+
def self.tag(tag)
|
10
|
+
@tag = tag
|
11
|
+
Filters.instance[tag] = self.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Filters contains a hash of all loaded filters. It does all parsing of the input file
|
16
|
+
# and send chunks to be filtered to the individual filters.
|
17
|
+
class Filters
|
18
|
+
include Singleton
|
19
|
+
attr_accessor :filter_file_tags, :filter_inline_tags, :filter_inline_end_tags, :log
|
20
|
+
|
21
|
+
def []=(idx,val)
|
22
|
+
@filters[idx] = val
|
23
|
+
end
|
24
|
+
|
25
|
+
def [](idx)
|
26
|
+
@filters[idx]
|
27
|
+
end
|
28
|
+
|
29
|
+
# Parse the input text and parse chunks over to filters when encountering tags
|
30
|
+
def filter_all(text)
|
31
|
+
state = :copying
|
32
|
+
result = []
|
33
|
+
tagged_lines = []
|
34
|
+
tag = args = nil
|
35
|
+
text.split(/\n/).each do |line|
|
36
|
+
case state
|
37
|
+
when :copying
|
38
|
+
if line =~ inline_tag
|
39
|
+
tag = $1
|
40
|
+
args = $2.strip
|
41
|
+
state = :inside_tag
|
42
|
+
elsif line =~ single_tag
|
43
|
+
tag = $1
|
44
|
+
args = $2.strip
|
45
|
+
result << @filters[tag.to_sym].filter_single(args)
|
46
|
+
else
|
47
|
+
result << line
|
48
|
+
end
|
49
|
+
when :inside_tag
|
50
|
+
# :endinlinewhatever, :endwhatever or just plain :end
|
51
|
+
if line =~ /^:end(inline#{tag}|#{tag})?(\s.*)?$/
|
52
|
+
result << @filters[tag.to_sym].filter_inline(tagged_lines.join("\n"),args)
|
53
|
+
tagged_lines = []
|
54
|
+
state = :copying
|
55
|
+
else
|
56
|
+
tagged_lines << line
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
result.join("\n")
|
62
|
+
end
|
63
|
+
|
64
|
+
# Creates instance and loads all the user-defined filters in the generated filter/ subdirectory
|
65
|
+
private
|
66
|
+
def initialize
|
67
|
+
@filters = {}
|
68
|
+
end
|
69
|
+
|
70
|
+
# Create regular expression to match single tags (tags with no end tag)
|
71
|
+
def single_tag
|
72
|
+
@single_tag_regex ||= tag_regexp
|
73
|
+
end
|
74
|
+
|
75
|
+
# Create regular expression to match inline tags. By convention these are all prefixed "inline"
|
76
|
+
def inline_tag
|
77
|
+
@inline_tag_regex ||= tag_regexp("inline")
|
78
|
+
end
|
79
|
+
|
80
|
+
# Does the actually work of creating matcher regular expressions
|
81
|
+
def tag_regexp(prefix = "")
|
82
|
+
Regexp.new("^:#{prefix}(" + @filters.keys.join('|') + ")(.*)")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Loads all the filters:
|
88
|
+
# If a filter fails to load, simply ignore it (it may be a missing local gem, such
|
89
|
+
# as ritex). This means that folks who write filters must ensure that their source
|
90
|
+
# throws an exception should it fail to find all its dependencies
|
91
|
+
|
92
|
+
Dir.glob([
|
93
|
+
File.join(File.dirname(__FILE__), 'filters/*.rb'),
|
94
|
+
File.join(APP_ROOT, 'filters/*.rb')
|
95
|
+
]) do |filter|
|
96
|
+
begin
|
97
|
+
require(filter)
|
98
|
+
rescue Exception => e
|
99
|
+
;
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Codex::CodeFilter
|
2
|
+
class Descriptor
|
3
|
+
attr_reader :file_name, :part
|
4
|
+
attr_reader :css_class
|
5
|
+
attr_reader :lang
|
6
|
+
|
7
|
+
def initialize(string)
|
8
|
+
@css_class = "code-normal"
|
9
|
+
@lang = "ruby"
|
10
|
+
|
11
|
+
if string && string =~ /^\[(.*)\]/
|
12
|
+
@file_name = nil
|
13
|
+
parse_params($1.dup)
|
14
|
+
elsif string && string =~ /(.*?)\[(.*)\]/
|
15
|
+
@file_name = $1
|
16
|
+
parse_params($2.dup)
|
17
|
+
else
|
18
|
+
@file_name = string
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse_params(params)
|
23
|
+
params.split.each do |param|
|
24
|
+
if param =~ /(.*?)=(.*)/
|
25
|
+
case $1
|
26
|
+
when "class"
|
27
|
+
@css_class = $2
|
28
|
+
when "lang"
|
29
|
+
@lang = $2
|
30
|
+
else
|
31
|
+
fail "Unknown parameter #{$1} in '#{params}'"
|
32
|
+
end
|
33
|
+
else
|
34
|
+
@part = param
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class CodeFilter < Codex::Filter
|
41
|
+
tag :code
|
42
|
+
|
43
|
+
def filter_single(args)
|
44
|
+
desc = Descriptor.new(args)
|
45
|
+
content = find_content_from(desc)
|
46
|
+
format_code(desc, content)
|
47
|
+
end
|
48
|
+
|
49
|
+
def filter_inline(text,args)
|
50
|
+
desc = Descriptor.new(args)
|
51
|
+
format_code(desc, text)
|
52
|
+
end
|
53
|
+
|
54
|
+
def format_code(desc, code)
|
55
|
+
%{<div class="#{desc.css_class}">\n} +
|
56
|
+
%{\n<pre name="code" class="#{desc.lang}:nogutter:nocontrols">#{code}} +
|
57
|
+
%{</pre></div>} +
|
58
|
+
format_link(desc)
|
59
|
+
end
|
60
|
+
|
61
|
+
def format_link(desc)
|
62
|
+
if desc.file_name.nil?
|
63
|
+
"\n\n"
|
64
|
+
else
|
65
|
+
%{<div class="codeurl"><a href="txmt://open?url=file://#{File.expand_path(desc.file_name)}">#{desc.file_name}</a></div>\n\n}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def find_content_from(desc)
|
70
|
+
find_part_in(File.read(desc.file_name), desc.part)
|
71
|
+
end
|
72
|
+
|
73
|
+
def find_part_in(content, part_name)
|
74
|
+
result = []
|
75
|
+
state = part_name ? :skipping : :normal
|
76
|
+
content.each_line do |line|
|
77
|
+
if line.sub!(/(START|END):(\w+)/, '')
|
78
|
+
if $2 == part_name
|
79
|
+
if $1 == "START"
|
80
|
+
state = :normal
|
81
|
+
else
|
82
|
+
state = :skipping
|
83
|
+
end
|
84
|
+
end
|
85
|
+
next
|
86
|
+
end
|
87
|
+
result << line unless state == :skipping
|
88
|
+
end
|
89
|
+
result.join
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|