scarlet 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -0
- data/lib/scarlet/formatters/html.rb +1 -1
- data/lib/scarlet/slide.rb +2 -2
- data/lib/scarlet/slideshow.rb +4 -2
- data/lib/scarlet/templates/html/default.erb +2 -2
- data/lib/scarlet/templates/html/javascripts/slides.js +9 -0
- data/spec/scarlet/slide.rb +46 -0
- data/spec/scarlet/slideshow.rb +38 -0
- data/spec/spec_helper.rb +3 -0
- metadata +48 -19
data/README.textile
CHANGED
@@ -31,6 +31,7 @@ h3. Step 3 – Create and save your slideshow file with Textile in the previousl
|
|
31
31
|
|
32
32
|
<pre>
|
33
33
|
!SLIDE cover
|
34
|
+
!TITLE Welcome to Scarlet!
|
34
35
|
|
35
36
|
h1. Scarlet
|
36
37
|
|
@@ -64,6 +65,7 @@ In the previously created folder:
|
|
64
65
|
h2. Contributors
|
65
66
|
|
66
67
|
* *Matias Korhonen*: PDF and LaTeX generation
|
68
|
+
* *Blake Smith*: Slide titles and bug fixes
|
67
69
|
|
68
70
|
h2. Special Thanks
|
69
71
|
|
@@ -6,7 +6,7 @@ module Scarlet::Formatters
|
|
6
6
|
|
7
7
|
def text
|
8
8
|
process_code do |code, language, before, after|
|
9
|
-
before
|
9
|
+
"#{before}<notextile><div class=\"code\">" + Scarlet::Highlighter.run(code, :format => "html", :lexer => language) + "</div></notextile>#{after}"
|
10
10
|
end
|
11
11
|
|
12
12
|
RedCloth.new(slide.text).to_html
|
data/lib/scarlet/slide.rb
CHANGED
data/lib/scarlet/slideshow.rb
CHANGED
@@ -32,7 +32,9 @@ module Scarlet
|
|
32
32
|
enumerable.lines.each do |line|
|
33
33
|
if line.include? "!SLIDE"
|
34
34
|
slides << Scarlet::Slide.new
|
35
|
-
slides.last.classes = line.
|
35
|
+
slides.last.classes = line.gsub("!SLIDE", "").strip
|
36
|
+
elsif line.include? "!TITLE"
|
37
|
+
slides.last.title = line.gsub("!TITLE", "").strip
|
36
38
|
else
|
37
39
|
next if slides.empty?
|
38
40
|
slides.last.text << line
|
@@ -41,4 +43,4 @@ module Scarlet
|
|
41
43
|
return slides
|
42
44
|
end
|
43
45
|
end
|
44
|
-
end
|
46
|
+
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<div id="track">
|
19
19
|
<% for slide in @slides %>
|
20
20
|
<div class="<%= slide.classes %>">
|
21
|
-
|
21
|
+
<div title="<%= slide.title %>" id="<%= slide.identifier %>" class="content">
|
22
22
|
<%= slide.text %>
|
23
23
|
</div>
|
24
24
|
</div>
|
@@ -26,4 +26,4 @@
|
|
26
26
|
</div>
|
27
27
|
</div>
|
28
28
|
</body>
|
29
|
-
</html>
|
29
|
+
</html>
|
@@ -22,6 +22,13 @@
|
|
22
22
|
if ($(newSlide).size() < 1) { return false; }
|
23
23
|
document.location.hash = '#' + idx;
|
24
24
|
}
|
25
|
+
|
26
|
+
var setTitle = function(idx) {
|
27
|
+
var newSlide = '#slide-' + idx;
|
28
|
+
var value = $(newSlide).attr("title");
|
29
|
+
if (value == "") { $('title').html("Slides"); }
|
30
|
+
else { $('title').html(value); }
|
31
|
+
}
|
25
32
|
|
26
33
|
var setSlideDimensions = function() {
|
27
34
|
var dimensions = slideDimensions();
|
@@ -86,6 +93,7 @@
|
|
86
93
|
} else {
|
87
94
|
setIndex(getIndex() + dir);
|
88
95
|
}
|
96
|
+
setTitle(getIndex());
|
89
97
|
}
|
90
98
|
}
|
91
99
|
|
@@ -103,6 +111,7 @@
|
|
103
111
|
$(document).bind('click', clickMove);
|
104
112
|
$(document).ready(function() {
|
105
113
|
setIndex(getIndex() || 0);
|
114
|
+
setTitle(getIndex() || 0);
|
106
115
|
$(this).trigger('hash.changed');
|
107
116
|
if (document.location.search.indexOf('notes') == 1) {
|
108
117
|
$('.notes').show();
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
|
3
|
+
module Scarlet
|
4
|
+
describe Slide do
|
5
|
+
context "defining slide classes" do
|
6
|
+
context "the class is missing" do
|
7
|
+
it "should be empty" do
|
8
|
+
text = <<-EOF
|
9
|
+
!SLIDE
|
10
|
+
Slide 1
|
11
|
+
EOF
|
12
|
+
slideshow = Slideshow.new(text)
|
13
|
+
slideshow.slides.first.classes.should be_empty
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "one class is specified" do
|
18
|
+
it "should have one class" do
|
19
|
+
text = <<-EOF
|
20
|
+
!SLIDE myclass
|
21
|
+
Slide 1
|
22
|
+
EOF
|
23
|
+
slideshow = Slideshow.new(text)
|
24
|
+
slideshow.slides.first.classes.should == "myclass"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "three classes are specified" do
|
29
|
+
it "should have the three classes" do
|
30
|
+
text = <<-EOF
|
31
|
+
!SLIDE class1 class2 class3
|
32
|
+
Slide 1
|
33
|
+
EOF
|
34
|
+
slideshow = Slideshow.new(text)
|
35
|
+
slideshow.slides.first.classes.should == "class1 class2 class3"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "slide identifiers" do
|
41
|
+
it "should add slide identifiers automatically and incrementally" do
|
42
|
+
pending
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
|
3
|
+
module Scarlet
|
4
|
+
describe Slideshow do
|
5
|
+
context "slicing text into slides" do
|
6
|
+
it "should ignore text before the first slide" do
|
7
|
+
text = <<-EOF
|
8
|
+
Some comments about the slides
|
9
|
+
!SLIDE
|
10
|
+
Slide 1
|
11
|
+
EOF
|
12
|
+
slideshow = Slideshow.new(text)
|
13
|
+
slideshow.slides.count.should == 1
|
14
|
+
end
|
15
|
+
|
16
|
+
context "the text has no slide declarations" do
|
17
|
+
it "should not create any slides" do
|
18
|
+
text = ""
|
19
|
+
slideshow = Slideshow.new(text)
|
20
|
+
slideshow.slides.count.should == 0
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "the text has two slides" do
|
25
|
+
it "should create two slides" do
|
26
|
+
text = <<-EOF
|
27
|
+
!SLIDE
|
28
|
+
Slide 1
|
29
|
+
!SLIDE
|
30
|
+
Slide 2
|
31
|
+
EOF
|
32
|
+
slideshow = Slideshow.new(text)
|
33
|
+
slideshow.slides.count.should == 2
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scarlet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Joao Carlos Cardoso
|
@@ -9,39 +14,54 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-17 00:00:00 +03:00
|
13
18
|
default_executable: scarlet
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: open4
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 9
|
31
|
+
- 6
|
23
32
|
version: 0.9.6
|
24
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: RedCloth
|
27
|
-
|
28
|
-
|
29
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 4
|
45
|
+
- 2
|
46
|
+
- 2
|
33
47
|
version: 4.2.2
|
34
|
-
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
35
50
|
- !ruby/object:Gem::Dependency
|
36
51
|
name: rtex
|
37
|
-
|
38
|
-
|
39
|
-
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
40
55
|
requirements:
|
41
56
|
- - ">="
|
42
57
|
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 2
|
60
|
+
- 1
|
61
|
+
- 1
|
43
62
|
version: 2.1.1
|
44
|
-
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
45
65
|
description: Generates XHTML slideshows from text files using Textile for markup. Does syntax highlighting if Pygments is installed.
|
46
66
|
email: mail@joao-carlos.com
|
47
67
|
executables:
|
@@ -77,6 +97,9 @@ files:
|
|
77
97
|
- lib/scarlet/templates/latex/default.erb
|
78
98
|
- LICENSE
|
79
99
|
- README.textile
|
100
|
+
- spec/scarlet/slide.rb
|
101
|
+
- spec/scarlet/slideshow.rb
|
102
|
+
- spec/spec_helper.rb
|
80
103
|
has_rdoc: true
|
81
104
|
homepage: http://github.com/jcxplorer/scarlet
|
82
105
|
licenses: []
|
@@ -87,23 +110,29 @@ rdoc_options:
|
|
87
110
|
require_paths:
|
88
111
|
- lib
|
89
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
90
114
|
requirements:
|
91
115
|
- - ">="
|
92
116
|
- !ruby/object:Gem::Version
|
117
|
+
segments:
|
118
|
+
- 0
|
93
119
|
version: "0"
|
94
|
-
version:
|
95
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
96
122
|
requirements:
|
97
123
|
- - ">="
|
98
124
|
- !ruby/object:Gem::Version
|
125
|
+
segments:
|
126
|
+
- 0
|
99
127
|
version: "0"
|
100
|
-
version:
|
101
128
|
requirements: []
|
102
129
|
|
103
130
|
rubyforge_project: scarlet
|
104
|
-
rubygems_version: 1.3.
|
131
|
+
rubygems_version: 1.3.7
|
105
132
|
signing_key:
|
106
133
|
specification_version: 3
|
107
134
|
summary: Slideshow Generator with Textile
|
108
|
-
test_files:
|
109
|
-
|
135
|
+
test_files:
|
136
|
+
- spec/scarlet/slide.rb
|
137
|
+
- spec/scarlet/slideshow.rb
|
138
|
+
- spec/spec_helper.rb
|