slideshow 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/slideshow.rb +46 -6
- metadata +4 -24
data/lib/slideshow.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
$KCODE=
|
1
|
+
$KCODE = 'utf'
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'erb'
|
5
5
|
require 'redcloth'
|
6
|
-
require 'maruku'
|
7
6
|
require 'logger'
|
8
7
|
require 'fileutils'
|
9
8
|
require 'ftools'
|
10
|
-
require 'hpricot'
|
11
|
-
require 'uv'
|
12
9
|
require 'pp'
|
13
10
|
|
11
|
+
# todo: move code highlighting in (optional) plugin/extension
|
12
|
+
# require 'hpricot'
|
13
|
+
# require 'uv'
|
14
|
+
|
14
15
|
|
15
16
|
module Slideshow
|
16
17
|
|
17
|
-
VERSION = '0.7.
|
18
|
+
VERSION = '0.7.3'
|
18
19
|
|
19
20
|
class Params
|
20
21
|
|
@@ -169,6 +170,20 @@ class Gen
|
|
169
170
|
|
170
171
|
KNOWN_TEXTILE_EXTNAMES = [ '.textile', '.t' ]
|
171
172
|
KNOWN_MARKDOWN_EXTNAMES = [ '.markdown', '.mark', '.m', '.txt', '.text' ]
|
173
|
+
|
174
|
+
# note: only bluecloth is listed as a dependency in gem specs (because it's Ruby only and, thus, easy to install)
|
175
|
+
# if you want to use other markdown libs install the required/desired lib e.g.
|
176
|
+
# use gem install rdiscount for rdiscount and so on
|
177
|
+
#
|
178
|
+
# also note for now the first present markdown library gets used
|
179
|
+
# the search order is first come, first serve, that is: rdiscount, rpeg-markdown, maruku, bluecloth (fallback, always present)
|
180
|
+
KNOWN_MARKDOWN_LIBS = [
|
181
|
+
[ 'rdiscount', lambda { |content| RDiscount.new( content ).to_html } ],
|
182
|
+
[ 'rpeg-markdown', lambda { |content| PEGMarkdown.new( content ).to_html } ],
|
183
|
+
[ 'maruku', lambda { |content| Maruku.new( content, {:on_error => :raise} ).to_html } ],
|
184
|
+
[ 'bluecloth', lambda { |content| BlueCloth.new( content ).to_html } ]
|
185
|
+
]
|
186
|
+
|
172
187
|
BUILTIN_MANIFESTS = [ 'fullerscreen.txt', 'fullerscreen.txt.gen',
|
173
188
|
's5.txt','s5.txt.gen',
|
174
189
|
's6.txt','s6.txt.gen' ]
|
@@ -186,6 +201,28 @@ class Gen
|
|
186
201
|
def opts
|
187
202
|
@opts
|
188
203
|
end
|
204
|
+
|
205
|
+
def check_markdown_libs
|
206
|
+
# check for available markdown libs/gems
|
207
|
+
# try to require each lib and remove any not installed
|
208
|
+
@markdown_libs = []
|
209
|
+
|
210
|
+
KNOWN_MARKDOWN_LIBS.each do |lib|
|
211
|
+
begin
|
212
|
+
require lib[0]
|
213
|
+
@markdown_libs << lib
|
214
|
+
rescue LoadError => ex
|
215
|
+
logger.debug "Markdown library #{lib[0]} not found. Use gem install #{lib[0]} to install."
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
logger.debug "Installed Markdown libraries: #{@markdown_libs.map{ |lib| lib[0] }.join(', ')}"
|
220
|
+
logger.debug "Using Markdown library #{@markdown_libs.first[0]}."
|
221
|
+
end
|
222
|
+
|
223
|
+
def markdown_to_html( content )
|
224
|
+
@markdown_libs.first[1].call( content )
|
225
|
+
end
|
189
226
|
|
190
227
|
def cache_dir
|
191
228
|
PLATFORM =~ /win32/ ? win32_cache_dir : File.join(File.expand_path("~"), ".slideshow")
|
@@ -382,7 +419,8 @@ class Gen
|
|
382
419
|
# convert light-weight markup to hypertext
|
383
420
|
|
384
421
|
if KNOWN_MARKDOWN_EXTNAMES.include?( extname )
|
385
|
-
content =
|
422
|
+
content = markdown_to_html( content )
|
423
|
+
# old code: content = Maruku.new( content, {:on_error => :raise} ).to_html
|
386
424
|
# old code: content = BlueCloth.new( content ).to_html
|
387
425
|
else
|
388
426
|
# turn off hard line breaks
|
@@ -562,6 +600,8 @@ def run( args )
|
|
562
600
|
if opts.generate?
|
563
601
|
create_slideshow_templates
|
564
602
|
else
|
603
|
+
check_markdown_libs
|
604
|
+
|
565
605
|
args.each { |fn| create_slideshow( fn ) }
|
566
606
|
end
|
567
607
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slideshow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-04 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -23,34 +23,14 @@ dependencies:
|
|
23
23
|
version: 4.0.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: BlueCloth
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
34
|
-
version:
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: hpricot
|
37
|
-
type: :runtime
|
38
|
-
version_requirement:
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: "0.6"
|
44
|
-
version:
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: ultraviolet
|
47
|
-
type: :runtime
|
48
|
-
version_requirement:
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.10.2
|
33
|
+
version: 1.0.0
|
54
34
|
version:
|
55
35
|
description:
|
56
36
|
email: webslideshow@googlegroups.com
|