slideshow 0.8.5 → 0.9

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.
@@ -0,0 +1,39 @@
1
+ module AnalyticsHelper
2
+
3
+
4
+ def google_analytics( opts = {} )
5
+
6
+ # if no user account code (e.g. UA-397343-10) passed along use
7
+ # code from *.yml settings
8
+ code = opts.fetch( :code, config.google_analytics_code )
9
+
10
+ puts " Adding JavaScript for Google Analytics tracker (#{code})..."
11
+
12
+ text = <<EOS
13
+ <!-- begin google-analytics #{opts.inspect} -->
14
+ <script type="text/javascript">
15
+
16
+ var _gaq = _gaq || [];
17
+ _gaq.push(['_setAccount', '#{code}']);
18
+ _gaq.push(['_trackPageview']);
19
+
20
+ (function() {
21
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
22
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
23
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
24
+ })();
25
+
26
+ </script>
27
+ <!-- end google-analytics -->
28
+ EOS
29
+
30
+ guard_text( text )
31
+ end
32
+
33
+
34
+ end # module AnalyticsHelper
35
+
36
+ class Slideshow::Gen
37
+ include AnalyticsHelper
38
+ end
39
+
@@ -0,0 +1,31 @@
1
+ module StepHelper
2
+
3
+
4
+ def step( opts={}, &blk )
5
+
6
+ puts " Adding HTML div block for step (incremental display)..."
7
+
8
+ text = capture_erb(&blk)
9
+
10
+ before = "<!-- begin step #{opts.inspect} -->\n"
11
+ before << "<div class='step' markdown='block'>\n"
12
+
13
+ after = "</div>\n"
14
+ after << "<!-- end step -->\n"
15
+
16
+ html = ""
17
+ html << guard_text( before )
18
+ html << text
19
+ html << guard_text( after )
20
+
21
+ concat_erb( html, blk.binding )
22
+ return
23
+ end
24
+
25
+
26
+ end # module StepHelper
27
+
28
+ class Slideshow::Gen
29
+ include StepHelper
30
+ end
31
+
@@ -0,0 +1,61 @@
1
+ module TableHelper
2
+
3
+ # todo: add center, plus generic col helper
4
+
5
+
6
+ def left( opts={}, &blk )
7
+
8
+ width = opts.fetch( :width, "50%" )
9
+ clazz = opts.fetch( :class, nil )
10
+
11
+ puts " Adding HTML for left column (using table layout)..."
12
+
13
+ text = capture_erb(&blk)
14
+
15
+ before = "<!-- begin left #{opts.inspect} -->\n"
16
+ before << "<div class='#{clazz}'>\n" if clazz
17
+ before << "<table width='100%'><tr><td width='#{width}' markdown='block' style='vertical-align: top;'>\n"
18
+
19
+ after = "</td>\n"
20
+ after << "<!-- end left -->\n"
21
+
22
+ html = ""
23
+ html << guard_text( before )
24
+ html << text
25
+ html << guard_text( after )
26
+
27
+ concat_erb( html, blk.binding )
28
+ return
29
+ end
30
+
31
+ def right( opts={}, &blk )
32
+
33
+ width = opts.fetch( :width, "50%" )
34
+ clazz = opts.fetch( :class, nil )
35
+
36
+ puts " Adding HTML for right column (using table layout)..."
37
+
38
+ text = capture_erb(&blk)
39
+
40
+ before = "<!-- begin right #{opts.inspect} -->\n"
41
+ before << "<td width='#{width}' markdown='block' style='vertical-align: top;'>\n"
42
+
43
+ after = "</td></tr></table>\n"
44
+ after << "</div>\n" if clazz
45
+ after << "<!-- end right -->\n"
46
+
47
+ html = ""
48
+ html << guard_text( before )
49
+ html << text
50
+ html << guard_text( after )
51
+
52
+ concat_erb( html, blk.binding )
53
+ return
54
+ end
55
+
56
+
57
+ end # module TableHelper
58
+
59
+ class Slideshow::Gen
60
+ include TableHelper
61
+ end
@@ -6,7 +6,8 @@ def __include__( name, opts = {} )
6
6
  end
7
7
 
8
8
  def help()
9
-
9
+ puts " Adding HTML for Slide Show help instructions..."
10
+
10
11
  text = <<EOS
11
12
  *Slide Show Keyboard Controls (Help)*
12
13
 
@@ -17,7 +18,13 @@ def help()
17
18
  | Show/hide slide controls (&#216; &laquo; &raquo;) | C, Move mouse to bottom right corner |
18
19
  EOS
19
20
 
20
- wrap_markup( textile_to_html( text ) )
21
+ html = <<EOS
22
+ <!-- begin help -->
23
+ #{textile_to_html( text )}
24
+ <!-- end help -->
25
+ EOS
26
+
27
+ guard_text( html )
21
28
  end
22
29
 
23
30
 
@@ -0,0 +1,27 @@
1
+ module MarkdownEngines
2
+
3
+ def rdiscount_to_html( content )
4
+ RDiscount.new( content ).to_html
5
+ end
6
+
7
+ def rpeg_markdown_to_html( content )
8
+ PEGMarkdown.new( content ).to_html
9
+ end
10
+
11
+ def maruku_to_html( content )
12
+ Maruku.new( content, {:on_error => :raise} ).to_html
13
+ end
14
+
15
+ def bluecloth_to_html( content )
16
+ BlueCloth.new( content ).to_html
17
+ end
18
+
19
+ def kramdown_to_html( content )
20
+ Kramdown::Document.new( content ).to_html
21
+ end
22
+
23
+ end # module MarkdownEngines
24
+
25
+ class Slideshow::Gen
26
+ include MarkdownEngines
27
+ end
@@ -70,15 +70,7 @@ class Opts
70
70
  # fix: use os-agnostic delimiter (use : for Mac/Unix?)
71
71
  has_includes? ? @hash[ :include ].split( ';' ) : []
72
72
  end
73
-
74
- def s5?
75
- get_boolean( 's5', false )
76
- end
77
-
78
- def fullerscreen?
79
- get_boolean( 'fuller', false ) || get_boolean( 'fullerscreen', false )
80
- end
81
-
73
+
82
74
  def manifest
83
75
  get( 'manifest', 's6.txt' )
84
76
  end
@@ -0,0 +1,40 @@
1
+ module Slideshow
2
+
3
+ class Slide < Struct.new(:header, :content, :classes)
4
+
5
+ def to_classic_html
6
+
7
+ buf = ""
8
+ buf << "<div class='slide "
9
+ buf << classes if classes
10
+ buf << "'>\n"
11
+
12
+ buf << header if header
13
+ buf << content if content
14
+
15
+ buf << "</div>\n"
16
+ buf
17
+ end
18
+
19
+ def to_google_html5
20
+
21
+ buf = ""
22
+ buf << "<div class='slide'>\n"
23
+
24
+ if header
25
+ buf << "<header>#{header}</header>\n"
26
+ end
27
+
28
+ buf << "<section class='"
29
+ buf << classes if classes
30
+ buf << "'>\n"
31
+
32
+ buf << content if content
33
+ buf << "</section>\n"
34
+ buf << "</div>\n"
35
+ buf
36
+ end
37
+
38
+ end # class slide
39
+
40
+ end # module Slideshow
@@ -0,0 +1,50 @@
1
+ module TextileEngines
2
+
3
+ def redcloth_java_fix_escape_nonascii( txt )
4
+ txt.chars.map{ |x| x.size > 1 ? "&##{x.unpack("U*")};" : x }.join
5
+ end
6
+
7
+ def redcloth_java_fix_escape_nonascii_exclude_pre( txt )
8
+
9
+ buf = ""
10
+ from = 0
11
+
12
+ while (pos = txt.index( /<pre.*?>.*?<\/pre>/m, from ))
13
+ # add text before pre block escaped
14
+ buf << redcloth_java_fix_escape_nonascii( txt[ from, pos-from] )
15
+
16
+ # add pre block unescaped (otherwise html entities get escaped twice)
17
+ from = Regexp.last_match.end(0)
18
+ buf << txt[pos, from-pos]
19
+ end
20
+ buf << redcloth_java_fix_escape_nonascii( txt[from, txt.length-from] )
21
+
22
+ buf
23
+ end
24
+
25
+
26
+ def textile_to_html( content )
27
+ puts " Converting Textile-text (#{content.length} bytes) to HTML..."
28
+
29
+ # JRuby workaround for RedCloth 4 multi-byte character bug
30
+ # see http://jgarber.lighthouseapp.com/projects/13054/tickets/149-redcloth-4-doesnt-support-multi-bytes-content
31
+ # basically convert non-ascii chars (>127) to html entities
32
+
33
+ if RedCloth::EXTENSION_LANGUAGE == "Java"
34
+ puts " Patching RedCloth for Java; converting non-Ascii/multi-byte chars to HTML-entities..."
35
+ content = redcloth_java_fix_escape_nonascii_exclude_pre( content )
36
+ end
37
+
38
+ # turn off hard line breaks
39
+ # turn off span caps (see http://rubybook.ca/2008/08/16/redcloth)
40
+ red = RedCloth.new( content, [:no_span_caps] )
41
+ red.hard_breaks = false
42
+ content = red.to_html
43
+ end
44
+
45
+ end # module TextileEngines
46
+
47
+
48
+ class Slideshow::Gen
49
+ include TextileEngines
50
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 8
9
- - 5
10
- version: 0.8.5
8
+ - 9
9
+ version: "0.9"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Gerald Bauer
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-06-25 00:00:00 +02:00
17
+ date: 2010-07-04 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -42,12 +41,12 @@ dependencies:
42
41
  requirements:
43
42
  - - ">="
44
43
  - !ruby/object:Gem::Version
45
- hash: 63
44
+ hash: 59
46
45
  segments:
47
46
  - 0
48
- - 8
47
+ - 9
49
48
  - 0
50
- version: 0.8.0
49
+ version: 0.9.0
51
50
  type: :runtime
52
51
  version_requirements: *id002
53
52
  - !ruby/object:Gem::Dependency
@@ -93,43 +92,33 @@ executables:
93
92
  extensions: []
94
93
 
95
94
  extra_rdoc_files:
96
- - History.txt
97
95
  - Manifest.txt
98
- - README.txt
99
- - templates/fullerscreen.txt
100
- - templates/s5.txt
101
96
  - templates/s6.txt
102
97
  files:
103
- - History.txt
98
+ - History.rdoc
104
99
  - Manifest.txt
105
- - README.txt
100
+ - README.rdoc
106
101
  - Rakefile
107
102
  - bin/slideshow
103
+ - config/slideshow.builtin.yml
104
+ - config/slideshow.yml
108
105
  - lib/slideshow.rb
106
+ - lib/slideshow/config.rb
107
+ - lib/slideshow/filters/headers_filter.rb
108
+ - lib/slideshow/filters/text_filter.rb
109
109
  - lib/slideshow/gen.rb
110
+ - lib/slideshow/helpers/analytics_helper.rb
110
111
  - lib/slideshow/helpers/capture_helper.rb
111
112
  - lib/slideshow/helpers/coderay_helper.rb
113
+ - lib/slideshow/helpers/step_helper.rb
114
+ - lib/slideshow/helpers/table_helper.rb
112
115
  - lib/slideshow/helpers/text_helper.rb
113
116
  - lib/slideshow/helpers/uv_helper.rb
117
+ - lib/slideshow/markdown.rb
114
118
  - lib/slideshow/opts.rb
115
- - templates/fullerscreen.txt
116
- - templates/fullerscreen.txt.gen
117
- - templates/fullerscreen.txt.sample
118
- - templates/fullerscreen/footer.html.erb
119
- - templates/fullerscreen/header.html.erb
120
- - templates/fullerscreen/style.css.erb
119
+ - lib/slideshow/slide.rb
120
+ - lib/slideshow/textile.rb
121
121
  - templates/gradient.svg.erb
122
- - templates/s5.txt
123
- - templates/s5.txt.gen
124
- - templates/s5.txt.sample
125
- - templates/s5/footer.html.erb
126
- - templates/s5/header.html.erb
127
- - templates/s5/opera.css
128
- - templates/s5/outline.css
129
- - templates/s5/print.css
130
- - templates/s5/s5-core.css
131
- - templates/s5/slides.js
132
- - templates/s5/style.css.erb
133
122
  - templates/s6.txt
134
123
  - templates/s6.txt.gen
135
124
  - templates/s6.txt.sample
@@ -151,7 +140,7 @@ licenses: []
151
140
  post_install_message:
152
141
  rdoc_options:
153
142
  - --main
154
- - README.txt
143
+ - README.rdoc
155
144
  require_paths:
156
145
  - lib
157
146
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -1,5 +0,0 @@
1
- # builtin FullerScreen template package manifest
2
-
3
- __file__.html fullerscreen/header.html.erb + fullerscreen/footer.html.erb
4
- __file__.css fullerscreen/style.css.erb
5
- __file__.svg gradient.svg.erb
@@ -1,7 +0,0 @@
1
- # FullerScreen manifest to generate sample template package from builtin templates
2
-
3
- fullerscreen.txt fullerscreen.txt.sample
4
- gradient.svg.erb
5
- header.html.erb fullerscreen/header.html.erb
6
- footer.html.erb fullerscreen/footer.html.erb
7
- style.css.erb fullerscreen/style.css.erb
@@ -1,11 +0,0 @@
1
- # FullerScreen template package manifest sample
2
- # Change as desired/needed
3
- #
4
- # Questions? Comments?
5
- # Send them along to the Free Web Slide Show Alternatives (S5, S6, S9 And Friends) Forum/Mailing List.
6
- # http://groups.google.com/group/webslideshow
7
-
8
- __file__.html header.html.erb + footer.html.erb
9
- __file__.svg gradient.svg.erb
10
- __file__.css style.css.erb
11
-
@@ -1,3 +0,0 @@
1
-
2
- </body>
3
- </html>
@@ -1,27 +0,0 @@
1
- <html>
2
- <head>
3
-
4
- <meta name="slideselector" content=".slide">
5
- <meta name="titleselector" content="h1">
6
- <meta name="stepselector" content=".step">
7
-
8
- <title><%= @headers['title'] %></title>
9
-
10
- <link title="Style" href="<%= "#{@name}.css" %>" type="text/css" rel="STYLESHEET">
11
-
12
- </head>
13
- <body>
14
-
15
- <div class="layout">
16
- <div class="background">
17
- <object data="<%= "#{@name}.svg" %>" width="100%" height="100%"></object>
18
- </div>
19
- </div>
20
-
21
- <div class="banner">
22
- Turn this document into a (PowerPoint/KeyNote-style) slide show pressing F11.
23
- (Free <a href="https://addons.mozilla.org/en-US/firefox/addon/4650">FullerScreen</a> Firefox addon required).
24
- Learn more at the <a href="http://slideshow.rubyforge.org">Slide Show (S9)</a>
25
- RubyForge project site.
26
- </div>
27
-