slideshow 0.8.5 → 0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ === 0.9 / 2010-07-04
2
+
3
+ * Added support for !SLIDE (and alternative syntax %slide)
4
+ * Added support for comments using %, %begin/%end and %end
5
+ * Added more helpers (step, google_analytics, left/right for two-column layouts)
6
+ * Added support for Django-style expressions and statements as an alternative to <% %>
7
+ * Added support for configuring text filters in slideshow.yml
8
+ * Added support for configuring Markdown engines in slideshow.yml
9
+ * Added fetch shortcuts (configure in slideshow.yml)
10
+ * Added support for template manifests w/o .txt extensions
11
+ * Removed old options -s5,--fullerscreen (use -t s5blank or -t fullerscreen instead)
12
+
1
13
  === 0.8.5 / 2010-06-25
2
14
 
3
15
  * Added workaround for RedCloth 4 (Java-only) multi-byte character bug
@@ -1,33 +1,27 @@
1
- History.txt
1
+ History.rdoc
2
2
  Manifest.txt
3
- README.txt
3
+ README.rdoc
4
4
  Rakefile
5
5
  bin/slideshow
6
+ config/slideshow.builtin.yml
7
+ config/slideshow.yml
6
8
  lib/slideshow.rb
9
+ lib/slideshow/config.rb
10
+ lib/slideshow/filters/headers_filter.rb
11
+ lib/slideshow/filters/text_filter.rb
7
12
  lib/slideshow/gen.rb
13
+ lib/slideshow/helpers/analytics_helper.rb
8
14
  lib/slideshow/helpers/capture_helper.rb
9
15
  lib/slideshow/helpers/coderay_helper.rb
16
+ lib/slideshow/helpers/step_helper.rb
17
+ lib/slideshow/helpers/table_helper.rb
10
18
  lib/slideshow/helpers/text_helper.rb
11
19
  lib/slideshow/helpers/uv_helper.rb
20
+ lib/slideshow/markdown.rb
12
21
  lib/slideshow/opts.rb
13
- templates/fullerscreen.txt
14
- templates/fullerscreen.txt.gen
15
- templates/fullerscreen.txt.sample
16
- templates/fullerscreen/footer.html.erb
17
- templates/fullerscreen/header.html.erb
18
- templates/fullerscreen/style.css.erb
22
+ lib/slideshow/slide.rb
23
+ lib/slideshow/textile.rb
19
24
  templates/gradient.svg.erb
20
- templates/s5.txt
21
- templates/s5.txt.gen
22
- templates/s5.txt.sample
23
- templates/s5/footer.html.erb
24
- templates/s5/header.html.erb
25
- templates/s5/opera.css
26
- templates/s5/outline.css
27
- templates/s5/print.css
28
- templates/s5/s5-core.css
29
- templates/s5/slides.js
30
- templates/s5/style.css.erb
31
25
  templates/s6.txt
32
26
  templates/s6.txt.gen
33
27
  templates/s6.txt.sample
@@ -1,6 +1,4 @@
1
- = slideshow
2
-
3
- Slide Show (S9) - A Free Web Alternative to PowerPoint and KeyNote in Ruby
1
+ = Slide Show (S9) - A Free Web Alternative to PowerPoint and KeyNote in Ruby
4
2
 
5
3
  * http://slideshow.rubyforge.org
6
4
 
@@ -15,10 +13,8 @@ The Slide Show (S9) project also collects and welcomes themes and ships
15
13
 
16
14
  Usage: slideshow [options] name
17
15
  -o, --output PATH Output Path
18
- -g, --generate Generate Slide Show Templates
16
+ -g, --generate Generate Slide Show Templates (Using Built-In S6 Pack)
19
17
  -t, --template MANIFEST Template Manifest
20
- --s5 S5-Compatible Slide Show (same as -t s5.txt)
21
- --fullerscreen FullerScreen-Compatible Slide Show (same as -t fullerscreen.txt)
22
18
  -f, --fetch URI Fetch Templates
23
19
  -c, --config PATH Configuration Path (default is ~/.slideshow)
24
20
  -l, --list List Installed Templates
@@ -27,28 +23,27 @@ The Slide Show (S9) project also collects and welcomes themes and ships
27
23
 
28
24
  Examples:
29
25
 
30
- slideshow microformats
31
- slideshow microformats.textile
26
+ slideshow microformats
27
+ slideshow microformats.textile # Process slides using Textile
28
+ slideshow microformats.text # Process slides using Markdown
29
+
32
30
  slideshow -o slides microformats # Output slideshow to slides folder
33
- slideshow --s5 microformats # Use S5-compatible slide show templates
34
- slideshow --fullerscreen microformats # Use FullerScreen-compatible slide show templates
35
31
 
36
32
  More examles:
37
33
 
38
- slideshow -g # Generate slide show templates
39
- slideshow -g --s5 # Generate S5 compatible slide show templates
40
- slideshow -g --fullerscreen # Generate FullerScreen compatible slide show templates
34
+ slideshow -g # Generate slide show templates using built-in S6 pack
41
35
 
42
36
  slideshow -l # List installed slide show templates
43
37
  slideshow -f s5blank # Fetch (install) S5 blank starter template from internet
44
- slideshow -t s5blank.txt microformats # Use your own slide show templates (e.g. s5blank.txt)
38
+ slideshow -t s5blank.txt microformats # Use your own slide show templates (e.g. s5blank)
45
39
 
46
40
 
47
41
  == REQUIREMENTS:
48
42
 
49
43
  * RedCloth (Textile Markup)
50
- * BlueCloth (Markdown Markup)
44
+ * Kramdown (Markdown Markup)
51
45
 
46
+ * BlueCloth (Markdown Markup) [Optional]
52
47
  * RDiscount (Markdown Markup) [Optional]
53
48
  * Coderay (Syntax Highlighting) [Optional]
54
49
  * Ultraviolet (Syntax Highlighting) [Optional]
data/Rakefile CHANGED
@@ -13,8 +13,12 @@ Hoe.spec 'slideshow' do
13
13
 
14
14
  self.extra_deps = [
15
15
  ['RedCloth','>= 4.0.0'],
16
- ['kramdown','>= 0.8.0']
16
+ ['kramdown','>= 0.9.0']
17
17
  ]
18
18
 
19
- self.remote_rdoc_dir = 'doc'
19
+ self.remote_rdoc_dir = 'doc'
20
+
21
+ # switch extension to .rdoc for gihub formatting
22
+ self.readme_file = 'README.rdoc'
23
+ self.history_file = 'History.rdoc'
20
24
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
  require 'slideshow'
4
+
4
5
  Slideshow.main
@@ -0,0 +1,42 @@
1
+ ### builtin configuration for arrays
2
+ #
3
+ # access or overwrite using nested builtin context e.g.
4
+ # builtin:
5
+ # textile:
6
+ # libs: [ whatever ]
7
+
8
+
9
+ # text filters
10
+
11
+ filters:
12
+ - comments-percent-style
13
+ - leading-headers
14
+ - skip-end-directive
15
+ - erb-django-style
16
+ - include-helper-hack
17
+ - erb
18
+ - code-block-curly-style
19
+
20
+
21
+ # markup (textile, markdown) config
22
+
23
+ textile:
24
+ extnames: [ .textile, .t ]
25
+
26
+ markdown:
27
+ extnames: [ .markdown, .m, .mark, .mkdn, .md, .txt, .text ]
28
+
29
+ # note: only kramdown is listed as a dependency in gem specs (because it's Ruby only and, thus, easy to install)
30
+ # if you want to use other markdown libs install the required/desired lib e.g.
31
+ # use gem install rdiscount for rdiscount and so on
32
+ #
33
+ # also note for now the first present markdown library gets used
34
+ # the search order is first come, first serve, that is: rdiscount, rpeg-markdown, maruku, bluecloth, kramdown (fallback, always present)
35
+
36
+ libs:
37
+ - rdiscount
38
+ - rpeg-markdown
39
+ - maruku
40
+ - bluecloth
41
+ - kramdown
42
+
@@ -0,0 +1,67 @@
1
+ # built-in slideshow configuration
2
+ #
3
+ # override settings in:
4
+ # ~/.slideshow/slideshow.yml
5
+ # or
6
+ # ./slideshow.yml or ./.slideshow.yml
7
+
8
+ #lets you define default/fallback headers
9
+
10
+ headers:
11
+ generator: <%= Slideshow.generator %>
12
+ author: Your Name Here
13
+ email: Your Email Here
14
+ company: Your Company Here
15
+ title: Your Title Here
16
+ subtitle: Your Subtitle Here
17
+ footer: Your Footer Here
18
+ subfooter: Your Subfooter Here
19
+ date: <%= Date.today %>
20
+
21
+ # todo: use nested config?? eg.
22
+ # gradient:
23
+ # theme: dark
24
+ # color1:
25
+ gradient-theme: dark
26
+ gradient-color1: red
27
+ gradient-color2: black
28
+
29
+ # todo: use nested config??
30
+ #
31
+ # ultraviolet (uv) | coderay (cr)
32
+ code-engine: uv
33
+ # Text Mate Hyperlink for Source?
34
+ code-txmt: false
35
+ # todo: add code-linenumbers??
36
+
37
+
38
+
39
+ # shortcuts for fetching template packs
40
+ # map shortcut to URI
41
+
42
+ fetch:
43
+ s6blank: http://github.com/geraldb/slideshow-s6-blank/raw/master/s6blank.txt
44
+ s5blank: http://github.com/geraldb/slideshow-s5-blank/raw/master/s5blank.txt
45
+ s5themes: http://github.com/geraldb/slideshow-s5-themes/raw/master/s5themes.txt
46
+ fullerscreen: http://github.com/geraldb/slideshow-fullerscreen/raw/master/fullerscreen.txt
47
+ slidy: http://github.com/geraldb/slideshow-slidy/raw/master/slidy.txt
48
+ g5: http://github.com/geraldb/slideshow-google-html5-slides/raw/master/g5.txt
49
+ slippy: http://github.com/geraldb/slideshow-slippy/raw/master/slippy.txt
50
+
51
+ # your google analytics code
52
+ analytics:
53
+ google: UA-XXX
54
+
55
+
56
+ ### markup (textile, markdown) config
57
+
58
+ # filters to run before markup processing
59
+ filters: []
60
+
61
+ textile:
62
+ extnames: []
63
+
64
+ markdown:
65
+ extnames: []
66
+ libs: []
67
+
@@ -1,7 +1,7 @@
1
1
  $KCODE = 'utf'
2
2
 
3
3
  LIB_PATH = File.expand_path( File.dirname(__FILE__) )
4
- $:.unshift(LIB_PATH)
4
+ $LOAD_PATH.unshift(LIB_PATH)
5
5
 
6
6
  # core and stlibs
7
7
  require 'optparse'
@@ -12,19 +12,42 @@ require 'pp'
12
12
  require 'uri'
13
13
  require 'net/http'
14
14
  require 'ostruct'
15
+ require 'date'
16
+ require 'yaml'
15
17
 
16
18
  # required gems
17
19
  require 'redcloth' # default textile library
18
20
  require 'kramdown' # default markdown library
19
21
 
20
22
 
21
- # own code
23
+ # our own code
22
24
  require 'slideshow/opts'
25
+ require 'slideshow/config'
23
26
  require 'slideshow/gen'
27
+ require 'slideshow/slide'
28
+ require 'slideshow/textile'
29
+ require 'slideshow/markdown'
30
+
31
+ # load built-in (required) helpers/plugins
32
+ require 'slideshow/helpers/text_helper'
33
+ require 'slideshow/helpers/capture_helper'
34
+ require 'slideshow/helpers/analytics_helper'
35
+ require 'slideshow/helpers/table_helper'
36
+ require 'slideshow/helpers/step_helper'
37
+
38
+ # load built-in filters
39
+ require 'slideshow/filters/headers_filter'
40
+ require 'slideshow/filters/text_filter'
41
+
24
42
 
25
43
  module Slideshow
26
44
 
27
- VERSION = '0.8.5'
45
+ VERSION = '0.9'
46
+
47
+ # version string for generator meta tag (includes ruby version)
48
+ def Slideshow.generator
49
+ "Slide Show (S9) #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
50
+ end
28
51
 
29
52
  def Slideshow.main
30
53
 
@@ -41,10 +64,6 @@ module Slideshow
41
64
 
42
65
  end # module Slideshow
43
66
 
44
- # load built-in (required) helpers/plugins
45
- require 'slideshow/helpers/text_helper.rb'
46
- require 'slideshow/helpers/capture_helper.rb'
47
-
48
67
  # load built-in (optional) helpers/plugins
49
68
  # If a helper fails to load, simply ingnore it
50
69
  # If you want to use it install missing required gems e.g.:
@@ -0,0 +1,88 @@
1
+ module Slideshow
2
+
3
+ class Config
4
+
5
+ def initialize
6
+ @hash = {}
7
+ end
8
+
9
+ def []( key )
10
+ value = @hash[ normalize_key( key ) ]
11
+ if value.nil?
12
+ puts "** Warning: config key '#{key}' undefined (returning nil)"
13
+ end
14
+
15
+ value
16
+ end
17
+
18
+ def load
19
+ # load builtin config file @ <gem>/config/slideshow.yml
20
+ config_file = "#{File.dirname( LIB_PATH )}/config/slideshow.yml"
21
+ config_builtin_file = "#{File.dirname( LIB_PATH )}/config/slideshow.builtin.yml"
22
+
23
+ # run through erb
24
+ config_txt = File.read( config_file )
25
+ config_txt = ERB.new( config_txt ).result( binding() )
26
+
27
+ @hash = YAML.load( config_txt )
28
+
29
+ # for now builtin has no erb processing; add builtin hash to main hash
30
+ @hash[ 'builtin' ] = YAML.load_file( config_builtin_file )
31
+ end
32
+
33
+
34
+ def known_textile_extnames
35
+ # returns an array of known file extensions e.g.
36
+ # [ '.textile', '.t' ]
37
+ #
38
+ # using nested key
39
+ # textile:
40
+ # extnames: [ .textile, .t ]
41
+
42
+ @hash[ 'textile' ][ 'extnames' ] + @hash[ 'builtin' ][ 'textile' ][ 'extnames' ]
43
+ end
44
+
45
+ def known_markdown_extnames
46
+ @hash[ 'markdown' ][ 'extnames' ] + @hash[ 'builtin' ][ 'markdown' ][ 'extnames' ]
47
+ end
48
+
49
+ def known_markdown_libs
50
+ # returns an array of known markdown engines e.g.
51
+ # [ rdiscount, rpeg-markdown, maruku, bluecloth, kramdown ]
52
+
53
+ @hash[ 'markdown' ][ 'libs' ] + @hash[ 'builtin' ][ 'markdown' ][ 'libs' ]
54
+ end
55
+
56
+ def known_extnames
57
+ # ruby check: is it better self. ?? or more confusing
58
+ # possible conflict only with write access (e.g. prop=)
59
+
60
+ known_textile_extnames + known_markdown_extnames
61
+ end
62
+
63
+ def text_filters
64
+ @hash[ 'builtin' ][ 'filters' ] + @hash[ 'filters' ]
65
+ end
66
+
67
+ def google_analytics_code
68
+ @hash[ 'analytics' ][ 'google' ]
69
+ end
70
+
71
+ def map_fetch_shortcut( key )
72
+ @hash[ 'fetch' ][ key ]
73
+ end
74
+
75
+ private
76
+
77
+ def normalize_key( key )
78
+ # make key all lower case/downcase (e.g. Content-Type => content-type)
79
+ # replace _ with - (e.g. gradient_color => gradient-color)
80
+ # todo: replace space(s) with - ??
81
+ # todo: strip leading and trailing spaces - possible use case ??
82
+
83
+ key.to_s.downcase.tr( '_', '-' )
84
+ end
85
+
86
+ end # class Config
87
+
88
+ end # module Slideshow
@@ -0,0 +1,45 @@
1
+ module HeadersFilter
2
+
3
+ def leading_headers( content_with_headers )
4
+
5
+ # todo: read headers before command line options (lets you override options using commandline switch)?
6
+
7
+ # read source document; split off optional header from source
8
+ # strip leading optional headers (key/value pairs) including optional empty lines
9
+
10
+ read_headers = true
11
+ content = ""
12
+
13
+ headers = [] # track header keys for stats
14
+
15
+ content_with_headers.each_line do |line|
16
+ if read_headers && line =~ /^\s*(\w[\w-]*)[ \t]*:[ \t]*(.*)/
17
+ key = $1.downcase
18
+ value = $2.strip
19
+
20
+ headers << key
21
+
22
+ logger.debug " adding option: key=>#{key}< value=>#{value}<"
23
+ opts.put( key, value )
24
+ elsif line =~ /^\s*$/
25
+ content << line unless read_headers
26
+ else
27
+ read_headers = false
28
+ content << line
29
+ end
30
+ end
31
+
32
+ # fix: do a merge w/ config instead, possible??
33
+ opts.set_defaults
34
+
35
+ puts " Reading #{headers.length} headers: #{headers.join(', ')}..."
36
+
37
+ content
38
+ end
39
+
40
+ end # module HeadersFilter
41
+
42
+
43
+ class Slideshow::Gen
44
+ include HeadersFilter
45
+ end