slideshow 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY.md +4 -0
- data/Manifest.txt +3 -48
- data/{README.markdown → README.md} +134 -132
- data/Rakefile +26 -17
- data/lib/slideshow.rb +19 -97
- data/lib/slideshow/cli/main.rb +38 -20
- data/lib/slideshow/cli/main_utils.rb +10 -4
- data/lib/slideshow/cli/opts.rb +3 -1
- data/lib/slideshow/cli/version.rb +26 -0
- metadata +63 -147
- data/History.markdown +0 -171
- data/config/slideshow.builtin.yml +0 -8
- data/config/slideshow.index.yml +0 -61
- data/config/slideshow.yml +0 -76
- data/lib/slideshow/cli/commands/fetch.rb +0 -121
- data/lib/slideshow/cli/commands/gen.rb +0 -330
- data/lib/slideshow/cli/commands/gen_templates.rb +0 -52
- data/lib/slideshow/cli/commands/list.rb +0 -70
- data/lib/slideshow/cli/commands/plugins.rb +0 -44
- data/lib/slideshow/cli/commands/quick.rb +0 -86
- data/lib/slideshow/config.rb +0 -241
- data/lib/slideshow/filters/debug_filter.rb +0 -74
- data/lib/slideshow/filters/headers_filter.rb +0 -45
- data/lib/slideshow/filters/slide_filter.rb +0 -113
- data/lib/slideshow/filters/text_filter.rb +0 -140
- data/lib/slideshow/headers.rb +0 -87
- data/lib/slideshow/helpers/background_helper.rb +0 -121
- data/lib/slideshow/helpers/capture_helper.rb +0 -136
- data/lib/slideshow/helpers/directive_helper.rb +0 -43
- data/lib/slideshow/helpers/markdown_helper.rb +0 -18
- data/lib/slideshow/helpers/source_helper.rb +0 -39
- data/lib/slideshow/helpers/step_helper.rb +0 -33
- data/lib/slideshow/helpers/syntax/coderay_helper.rb +0 -84
- data/lib/slideshow/helpers/syntax/sh_helper.rb +0 -61
- data/lib/slideshow/helpers/syntax/uv_helper.rb +0 -90
- data/lib/slideshow/helpers/text_helper.rb +0 -130
- data/lib/slideshow/manifest_helpers.rb +0 -94
- data/lib/slideshow/markup/markdown.rb +0 -18
- data/lib/slideshow/markup/mediawiki.rb +0 -38
- data/lib/slideshow/markup/rest.rb +0 -17
- data/lib/slideshow/markup/textile.rb +0 -68
- data/lib/slideshow/plugin_helpers.rb +0 -62
- data/lib/slideshow/slide.rb +0 -118
- data/lib/slideshow/version.rb +0 -3
- data/templates/s6.txt +0 -27
- data/templates/s6.txt.gen +0 -19
- data/templates/s6/jquery.js +0 -8176
- data/templates/s6/jquery.microsoft.js +0 -31
- data/templates/s6/jquery.slideshow.js +0 -534
- data/templates/s6/print.css +0 -1
- data/templates/s6/projection.css +0 -109
- data/templates/s6/screen.css +0 -50
- data/templates/slides.html.erb +0 -55
- data/templates/slides.pdf.html.erb +0 -62
- data/templates/style.css.erb +0 -91
- data/templates/welcome.text +0 -167
- data/templates/welcome.txt.quick +0 -6
data/config/slideshow.index.yml
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
###########################################################################################
|
2
|
-
# Slide Show (S9) Update Index for Template Packs, Quick Starter Samples 'n' Plugins
|
3
|
-
|
4
|
-
# find the latest version online at
|
5
|
-
# - https://github.com/slideshow-s9/update
|
6
|
-
#
|
7
|
-
# use $ slideshow update -- for automatic update e.g. download the latest slideshow.index.yml file
|
8
|
-
|
9
|
-
|
10
|
-
#############
|
11
|
-
# shortcuts for fetching template packs (w/ optional quick starter samples)
|
12
|
-
# maps shortcut to URI
|
13
|
-
|
14
|
-
|
15
|
-
s6blank: https://raw.github.com/slideshow-s9/slideshow-s6-blank/master/s6blank.txt
|
16
|
-
|
17
|
-
s6syntax: https://raw.github.com/slideshow-s9/slideshow-s6-syntax-highlighter/master/s6syntax.txt
|
18
|
-
|
19
|
-
s5blank: https://raw.github.com/slideshow-s9/slideshow-s5-blank/master/s5blank.txt
|
20
|
-
|
21
|
-
s5themes: https://raw.github.com/slideshow-s9/slideshow-s5-themes/master/s5themes.txt
|
22
|
-
|
23
|
-
g5: https://raw.github.com/slideshow-s9/slideshow-google-html5-slides/master/g5.txt
|
24
|
-
|
25
|
-
slidy:
|
26
|
-
- https://raw.github.com/slideshow-s9/slideshow-slidy/master/slidy.txt
|
27
|
-
- https://raw.github.com/slideshow-s9/slideshow-slidy/master/slidy.txt.quick
|
28
|
-
|
29
|
-
csss:
|
30
|
-
- https://raw.github.com/slideshow-s9/slideshow-csss/master/csss.txt
|
31
|
-
- https://raw.github.com/slideshow-s9/slideshow-csss/master/csss.txt.quick
|
32
|
-
|
33
|
-
deck.js:
|
34
|
-
- https://raw.github.com/slideshow-s9/slideshow-deck.js/master/deck.js.txt
|
35
|
-
- https://raw.github.com/slideshow-s9/slideshow-deck.js/master/deck.js.txt.quick
|
36
|
-
|
37
|
-
impress.js:
|
38
|
-
- https://raw.github.com/slideshow-s9/slideshow-impress.js/master/impress.js.txt
|
39
|
-
- https://raw.github.com/slideshow-s9/slideshow-impress.js/master/impress.js.txt.quick
|
40
|
-
|
41
|
-
shower: https://raw.github.com/slideshow-s9/slideshow-shower/master/shower.txt
|
42
|
-
|
43
|
-
|
44
|
-
##############
|
45
|
-
# Plugins
|
46
|
-
|
47
|
-
analytics: https://raw.github.com/slideshow-s9/analytics/master/analytics.txt.plugin
|
48
|
-
|
49
|
-
tables: https://raw.github.com/slideshow-s9/tables/master/tables.txt.plugin
|
50
|
-
|
51
|
-
snippets: https://raw.github.com/slideshow-s9/snippets/master/snippets.txt.plugin
|
52
|
-
|
53
|
-
plugins:
|
54
|
-
- https://raw.github.com/slideshow-s9/analytics/master/analytics.txt.plugin
|
55
|
-
- https://raw.github.com/slideshow-s9/tables/master/tables.txt.plugin
|
56
|
-
- https://raw.github.com/slideshow-s9/snippets/master/snippets.txt.plugin
|
57
|
-
|
58
|
-
#############################
|
59
|
-
# Quick Starter Stamples
|
60
|
-
|
61
|
-
formatting: https://raw.github.com/slideshow-s9/formatting/master/formatting.txt.quick
|
data/config/slideshow.yml
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#########################################
|
2
|
-
# slideshow configuration defaults
|
3
|
-
#
|
4
|
-
# override settings in:
|
5
|
-
# ~/slideshow.yml in home folder
|
6
|
-
# or
|
7
|
-
# ./slideshow.yml in working folder
|
8
|
-
|
9
|
-
|
10
|
-
######################
|
11
|
-
# lets you define default/fallback headers
|
12
|
-
|
13
|
-
headers:
|
14
|
-
generator: "<%= Slideshow.generator %>"
|
15
|
-
author: Your Name Here
|
16
|
-
email: Your Email Here
|
17
|
-
company: Your Company Here
|
18
|
-
title: Your Title Here
|
19
|
-
subtitle: Your Subtitle Here
|
20
|
-
footer: Your Footer Here
|
21
|
-
subfooter: Your Subfooter Here
|
22
|
-
date: "<%= Date.today %>"
|
23
|
-
|
24
|
-
# todo: use nested config?? eg.
|
25
|
-
# gradient:
|
26
|
-
# theme: dark
|
27
|
-
# color1:
|
28
|
-
gradient-theme: diagonal
|
29
|
-
gradient-colors: red orange
|
30
|
-
|
31
|
-
# todo: use nested config??
|
32
|
-
#
|
33
|
-
# SyntaxHighligher (sh) | ultraviolet (uv) | coderay (cr)
|
34
|
-
code-engine: sh
|
35
|
-
# Text Mate Hyperlink for Source?
|
36
|
-
code-txmt: false
|
37
|
-
# todo: add code-linenumbers??
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# your google analytics code
|
43
|
-
analytics:
|
44
|
-
google: UA-XXX
|
45
|
-
|
46
|
-
|
47
|
-
########################################################3
|
48
|
-
### text/markup (textile, markdown) processing config
|
49
|
-
|
50
|
-
# filters to run before markup processing
|
51
|
-
filters:
|
52
|
-
- skip-end-directive
|
53
|
-
- directives_bang_style_to_percent_style
|
54
|
-
- directives_percent_style
|
55
|
-
- comments-percent-style
|
56
|
-
- leading-headers
|
57
|
-
- erb-django-style
|
58
|
-
- erb-rename-helper-hack
|
59
|
-
- dump_content_to_file_debug_text_erb
|
60
|
-
- erb
|
61
|
-
- code-block-curly-style
|
62
|
-
- dump_content_to_file_debug_text
|
63
|
-
|
64
|
-
|
65
|
-
# markup (textile, markdown, rest) config
|
66
|
-
|
67
|
-
textile:
|
68
|
-
extnames: [ .textile, .t ]
|
69
|
-
|
70
|
-
rest:
|
71
|
-
extnames: [ .rst, .rest ]
|
72
|
-
|
73
|
-
mediawiki:
|
74
|
-
extnames: [ .wiki, .mediawiki, .mw ]
|
75
|
-
|
76
|
-
# NB: markdown now configured in markdown.yml (using markdown gem)
|
@@ -1,121 +0,0 @@
|
|
1
|
-
module Slideshow
|
2
|
-
|
3
|
-
class Fetch
|
4
|
-
|
5
|
-
### fix: remove opts, use config (wrapped!!)
|
6
|
-
|
7
|
-
include LogUtils::Logging
|
8
|
-
|
9
|
-
def initialize( opts, config )
|
10
|
-
@opts = opts
|
11
|
-
@config = config
|
12
|
-
end
|
13
|
-
|
14
|
-
attr_reader :opts, :config
|
15
|
-
|
16
|
-
|
17
|
-
def fetch_all
|
18
|
-
config.default_fetch_shortcuts.each do |shortcut|
|
19
|
-
fetch( shortcut )
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
def update # update shortcut index
|
25
|
-
dest = config.shortcut_index_file
|
26
|
-
|
27
|
-
destfull = File.expand_path( dest )
|
28
|
-
destpath = File.dirname( destfull )
|
29
|
-
FileUtils.makedirs( destpath ) unless File.directory?( destpath )
|
30
|
-
|
31
|
-
logger.debug "destfull=>#{destfull}<"
|
32
|
-
logger.debug "destpath=>#{destpath}<"
|
33
|
-
|
34
|
-
## todo/fix: use a config setting for index url (do NOT hard core)
|
35
|
-
src = 'https://raw.github.com/slideshow-s9/update/master/slideshow.index.yml'
|
36
|
-
|
37
|
-
puts "Updating shortcut index - downloading '#{src}'..."
|
38
|
-
::Fetcher::Worker.new( logger ).copy( src, destfull )
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def fetch( shortcut_or_source )
|
43
|
-
|
44
|
-
logger.debug "fetch >#{shortcut_or_source}<"
|
45
|
-
|
46
|
-
## check for builtin shortcut (assume no / or \)
|
47
|
-
if shortcut_or_source.index( '/' ).nil? && shortcut_or_source.index( '\\' ).nil?
|
48
|
-
shortcut = shortcut_or_source
|
49
|
-
sources = config.map_fetch_shortcut( shortcut )
|
50
|
-
|
51
|
-
if sources.empty?
|
52
|
-
puts "** Error: No mapping found for shortcut '#{shortcut}'."
|
53
|
-
return
|
54
|
-
end
|
55
|
-
puts " Mapping fetch shortcut '#{shortcut}' to: #{sources.join(',')}"
|
56
|
-
else
|
57
|
-
sources = [shortcut_or_source] # pass arg through unmapped
|
58
|
-
end
|
59
|
-
|
60
|
-
sources.each do |source|
|
61
|
-
|
62
|
-
## if manifest includes .plugin assume it's a plugin
|
63
|
-
if source.include?( '.txt.plugin' ) || source.include?( '.plugin.txt' )
|
64
|
-
fetch_plugin( source )
|
65
|
-
elsif source.include?( '.txt.quick' ) || source.include?( '.quick.txt' )
|
66
|
-
fetch_quick( source )
|
67
|
-
else # otherwise assume it's a template pack
|
68
|
-
fetch_template( source )
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
end # method run
|
74
|
-
|
75
|
-
|
76
|
-
def fetch_template( src )
|
77
|
-
# src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt'
|
78
|
-
# src = 'http://github.com/geraldb/sandbox/raw/13d4fec0908fbfcc456b74dfe2f88621614b5244/s5blank/s5blank.txt'
|
79
|
-
uri = URI.parse( src )
|
80
|
-
logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
|
81
|
-
|
82
|
-
pakname = File.basename( uri.path ).downcase.gsub('.txt','')
|
83
|
-
pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
|
84
|
-
|
85
|
-
logger.debug "packname >#{pakname}<"
|
86
|
-
logger.debug "pakpath >#{pakpath}<"
|
87
|
-
|
88
|
-
Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
|
89
|
-
end
|
90
|
-
|
91
|
-
def fetch_quick( src )
|
92
|
-
uri = URI.parse( src )
|
93
|
-
logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
|
94
|
-
|
95
|
-
# downcase basename w/ extension (remove .txt)
|
96
|
-
pakname = File.basename( uri.path ).downcase.gsub('.txt','')
|
97
|
-
pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
|
98
|
-
|
99
|
-
logger.debug "pakname >#{pakname}<"
|
100
|
-
logger.debug "pakpath >#{pakpath}<"
|
101
|
-
|
102
|
-
Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
|
103
|
-
end
|
104
|
-
|
105
|
-
def fetch_plugin( src )
|
106
|
-
uri = URI.parse( src )
|
107
|
-
logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
|
108
|
-
|
109
|
-
# downcase basename w/ extension (remove .txt)
|
110
|
-
pakname = File.basename( uri.path ).downcase.gsub('.txt','').gsub('.plugin','')
|
111
|
-
pakpath = File.expand_path( "#{config.config_dir}/plugins/#{pakname}" )
|
112
|
-
|
113
|
-
logger.debug "pakname >#{pakname}<"
|
114
|
-
logger.debug "pakpath >#{pakpath}<"
|
115
|
-
|
116
|
-
Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
|
117
|
-
end
|
118
|
-
|
119
|
-
end # class Fetch
|
120
|
-
|
121
|
-
end # module Slideshow
|
@@ -1,330 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Slideshow
|
4
|
-
|
5
|
-
## fix:/todo: move generation code out of command into its own class
|
6
|
-
## not residing/depending on cli
|
7
|
-
|
8
|
-
class Gen ## todo: rename command to build
|
9
|
-
|
10
|
-
include LogUtils::Logging
|
11
|
-
|
12
|
-
include ManifestHelper
|
13
|
-
|
14
|
-
### fix: remove opts, use config (wrapped!!)
|
15
|
-
|
16
|
-
def initialize( opts, config, headers )
|
17
|
-
@opts = opts
|
18
|
-
@config = config
|
19
|
-
@headers = headers
|
20
|
-
|
21
|
-
## todo: check if we need to use expand_path - Dir.pwd always absolute (check ~/user etc.)
|
22
|
-
@usrdir = File.expand_path( Dir.pwd ) # save original (current) working directory
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_reader :usrdir # original working dir (user called slideshow from)
|
26
|
-
attr_reader :srcdir, :outdir, :pakdir # NB: "initalized" in create_slideshow
|
27
|
-
|
28
|
-
|
29
|
-
attr_reader :opts, :config, :headers
|
30
|
-
attr_reader :session # give helpers/plugins a session-like hash
|
31
|
-
|
32
|
-
attr_reader :markup_type # :textile, :markdown, :mediawiki, :rest
|
33
|
-
|
34
|
-
# uses configured markup processor (textile,markdown,rest,mediawiki) to generate html
|
35
|
-
def text_to_html( content )
|
36
|
-
content = case @markup_type
|
37
|
-
when :markdown
|
38
|
-
markdown_to_html( content )
|
39
|
-
when :textile
|
40
|
-
textile_to_html( content )
|
41
|
-
when :mediawiki
|
42
|
-
mediawiki_to_html( content )
|
43
|
-
when :rest
|
44
|
-
rest_to_html( content )
|
45
|
-
end
|
46
|
-
content
|
47
|
-
end
|
48
|
-
|
49
|
-
def guard_text( text )
|
50
|
-
# todo/fix 2: note for Textile we need to differentiate between blocks and inline
|
51
|
-
# thus, to avoid runs - use guard_block (add a leading newline to avoid getting include in block that goes before)
|
52
|
-
|
53
|
-
# todo/fix: remove wrap_markup; replace w/ guard_text
|
54
|
-
# why: text might be css, js, not just html
|
55
|
-
|
56
|
-
## todo: add print depreciation warning
|
57
|
-
|
58
|
-
wrap_markup( text )
|
59
|
-
end
|
60
|
-
|
61
|
-
def guard_block( text )
|
62
|
-
if markup_type == :textile
|
63
|
-
# saveguard with notextile wrapper etc./no further processing needed
|
64
|
-
# note: add leading newlines to avoid block-runons
|
65
|
-
"\n\n<notextile>\n#{text}\n</notextile>\n"
|
66
|
-
elsif markup_type == :markdown
|
67
|
-
# wrap in newlines to avoid runons
|
68
|
-
"\n\n#{text}\n\n"
|
69
|
-
elsif markup_type == :mediawiki
|
70
|
-
"\n\n<nowiki>\n#{text}\n</nowiki>\n"
|
71
|
-
else
|
72
|
-
text
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def guard_inline( text )
|
77
|
-
wrap_markup( text )
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
def wrap_markup( text )
|
82
|
-
if markup_type == :textile
|
83
|
-
# saveguard with notextile wrapper etc./no further processing needed
|
84
|
-
"<notextile>\n#{text}\n</notextile>"
|
85
|
-
else
|
86
|
-
text
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
# move into a filter??
|
92
|
-
def post_processing_slides( content )
|
93
|
-
|
94
|
-
# 1) add slide breaks
|
95
|
-
|
96
|
-
if config.slide? # only allow !SLIDE directives fo slide breaks?
|
97
|
-
# do nothing (no extra automagic slide breaks wanted)
|
98
|
-
else
|
99
|
-
if (@markup_type == :markdown && Markdown.lib == 'pandoc-ruby') || @markup_type == :rest
|
100
|
-
content = add_slide_directive_before_div_h1( content )
|
101
|
-
else
|
102
|
-
if config.header_level == 2
|
103
|
-
content = add_slide_directive_before_h2( content )
|
104
|
-
else # assume level 1
|
105
|
-
content = add_slide_directive_before_h1( content )
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
dump_content_to_file_debug_html( content )
|
112
|
-
|
113
|
-
# 2) use generic slide break processing instruction to
|
114
|
-
# split content into slides
|
115
|
-
|
116
|
-
slide_counter = 0
|
117
|
-
|
118
|
-
slides = []
|
119
|
-
slide_buf = ""
|
120
|
-
|
121
|
-
content.each_line do |line|
|
122
|
-
if line.include?( '<!-- _S9SLIDE_' )
|
123
|
-
if slide_counter > 0 # found start of new slide (and, thus, end of last slide)
|
124
|
-
slides << slide_buf # add slide to slide stack
|
125
|
-
slide_buf = "" # reset slide source buffer
|
126
|
-
else # slide_counter == 0
|
127
|
-
# check for first slide with missing leading SLIDE directive (possible/allowed in takahashi, for example)
|
128
|
-
## remove html comments and whitspaces (still any content?)
|
129
|
-
### more than just whitespace? assume its a slide
|
130
|
-
if slide_buf.gsub(/<!--.*?-->/m, '').gsub( /[\n\r\t ]/, '').length > 0
|
131
|
-
logger.debug "add slide with missing leading slide directive >#{slide_buf}< with slide_counter == 0"
|
132
|
-
slides << slide_buf
|
133
|
-
slide_buf = ""
|
134
|
-
else
|
135
|
-
logger.debug "skipping slide_buf >#{slide_buf}< with slide_counter == 0"
|
136
|
-
end
|
137
|
-
end
|
138
|
-
slide_counter += 1
|
139
|
-
end
|
140
|
-
slide_buf << line
|
141
|
-
end
|
142
|
-
|
143
|
-
if slide_counter > 0
|
144
|
-
slides << slide_buf # add slide to slide stack
|
145
|
-
slide_buf = "" # reset slide source buffer
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
slides2 = []
|
150
|
-
slides.each do |source|
|
151
|
-
slides2 << Slide.new( source, config )
|
152
|
-
end
|
153
|
-
|
154
|
-
|
155
|
-
puts "#{slides2.size} slides found:"
|
156
|
-
|
157
|
-
slides2.each_with_index do |slide,i|
|
158
|
-
print " [#{i+1}] "
|
159
|
-
if slide.header.present?
|
160
|
-
print slide.header
|
161
|
-
else
|
162
|
-
# remove html comments
|
163
|
-
print "-- no header -- | #{slide.content.gsub(/<!--.*?-->/m, '').gsub(/\n/,'$')[0..40]}"
|
164
|
-
end
|
165
|
-
puts
|
166
|
-
end
|
167
|
-
|
168
|
-
|
169
|
-
# make content2 and slide2 available to erb template
|
170
|
-
# -- todo: cleanup variable names and use attr_readers for content and slide
|
171
|
-
|
172
|
-
### fix: use class SlideDeck or Deck?? for slides array?
|
173
|
-
|
174
|
-
content2 = ""
|
175
|
-
slides2.each do |slide|
|
176
|
-
content2 << slide.to_classic_html
|
177
|
-
end
|
178
|
-
|
179
|
-
@content = content2
|
180
|
-
@slides = slides2 # strutured content
|
181
|
-
end
|
182
|
-
|
183
|
-
|
184
|
-
def create_slideshow( fn )
|
185
|
-
|
186
|
-
manifest_path_or_name = opts.manifest
|
187
|
-
|
188
|
-
# add .txt file extension if missing (for convenience)
|
189
|
-
if manifest_path_or_name.downcase.ends_with?( '.txt' ) == false
|
190
|
-
manifest_path_or_name << '.txt'
|
191
|
-
end
|
192
|
-
|
193
|
-
logger.debug "manifest=#{manifest_path_or_name}"
|
194
|
-
|
195
|
-
# check if file exists (if yes use custom template package!) - allows you to override builtin package with same name
|
196
|
-
if File.exists?( manifest_path_or_name )
|
197
|
-
manifestsrc = manifest_path_or_name
|
198
|
-
else
|
199
|
-
# check for builtin manifests
|
200
|
-
manifests = installed_template_manifests
|
201
|
-
matches = manifests.select { |m| m[0] == manifest_path_or_name }
|
202
|
-
|
203
|
-
if matches.empty?
|
204
|
-
puts "*** error: unknown template manifest '#{manifest_path_or_name}'"
|
205
|
-
# todo: list installed manifests
|
206
|
-
exit 2
|
207
|
-
end
|
208
|
-
|
209
|
-
manifestsrc = matches[0][1]
|
210
|
-
end
|
211
|
-
|
212
|
-
### todo: use File.expand_path( xx, relative_to ) always with second arg
|
213
|
-
## do NOT default to cwd (because cwd will change!)
|
214
|
-
|
215
|
-
# Reference src with absolute path, because this can be used with different pwd
|
216
|
-
manifestsrc = File.expand_path( manifestsrc, usrdir )
|
217
|
-
|
218
|
-
# expand output path in current dir and make sure output path exists
|
219
|
-
@outdir = File.expand_path( opts.output_path, usrdir )
|
220
|
-
logger.debug "setting outdir to >#{outdir}<"
|
221
|
-
FileUtils.makedirs( outdir ) unless File.directory? outdir
|
222
|
-
|
223
|
-
dirname = File.dirname( fn )
|
224
|
-
basename = File.basename( fn, '.*' )
|
225
|
-
extname = File.extname( fn )
|
226
|
-
logger.debug "dirname=#{dirname}, basename=#{basename}, extname=#{extname}"
|
227
|
-
|
228
|
-
# change working dir to sourcefile dir
|
229
|
-
# todo: add a -c option to commandline? to let you set cwd?
|
230
|
-
|
231
|
-
@srcdir = File.expand_path( dirname, usrdir )
|
232
|
-
logger.debug "setting srcdir to >#{srcdir}<"
|
233
|
-
|
234
|
-
unless usrdir == srcdir
|
235
|
-
logger.debug "changing cwd to src - new >#{srcdir}<, old >#{Dir.pwd}<"
|
236
|
-
Dir.chdir srcdir
|
237
|
-
end
|
238
|
-
|
239
|
-
puts "Preparing slideshow '#{basename}'..."
|
240
|
-
|
241
|
-
if config.known_textile_extnames.include?( extname )
|
242
|
-
@markup_type = :textile
|
243
|
-
elsif config.known_rest_extnames.include?( extname )
|
244
|
-
@markup_type = :rest
|
245
|
-
elsif config.known_mediawiki_extnames.include?( extname )
|
246
|
-
@markup_type = :mediawiki
|
247
|
-
else # default/fallback use markdown
|
248
|
-
@markup_type = :markdown
|
249
|
-
end
|
250
|
-
|
251
|
-
# shared variables for templates (binding)
|
252
|
-
@content_for = {} # reset content_for hash
|
253
|
-
|
254
|
-
@name = basename
|
255
|
-
@extname = extname
|
256
|
-
|
257
|
-
@session = {} # reset session hash for plugins/helpers
|
258
|
-
|
259
|
-
inname = "#{basename}#{extname}"
|
260
|
-
|
261
|
-
logger.debug "inname=#{inname}"
|
262
|
-
|
263
|
-
content = File.read( inname )
|
264
|
-
|
265
|
-
# run text filters
|
266
|
-
|
267
|
-
config.text_filters.each do |filter|
|
268
|
-
mn = filter.tr( '-', '_' ).to_sym # construct method name (mn)
|
269
|
-
content = send( mn, content ) # call filter e.g. include_helper_hack( content )
|
270
|
-
end
|
271
|
-
|
272
|
-
|
273
|
-
if config.takahashi?
|
274
|
-
content = takahashi_slide_breaks( content )
|
275
|
-
end
|
276
|
-
|
277
|
-
|
278
|
-
# convert light-weight markup to hypertext
|
279
|
-
|
280
|
-
content = text_to_html( content )
|
281
|
-
|
282
|
-
# post-processing
|
283
|
-
|
284
|
-
# make content2 and slide2 available to erb template
|
285
|
-
# -- todo: cleanup variable names and use attr_readers for content and slide
|
286
|
-
|
287
|
-
if @markup_type == :markdown && config.markdown_post_processing?( Markdown.lib ) == false
|
288
|
-
puts " Skipping post-processing (passing content through as is)..."
|
289
|
-
@content = content # content all-in-one - make it available in erb templates
|
290
|
-
else
|
291
|
-
# sets @content (all-in-one string) and @slides (structured content; split into slides)
|
292
|
-
post_processing_slides( content )
|
293
|
-
end
|
294
|
-
|
295
|
-
|
296
|
-
#### pak merge
|
297
|
-
# nb: change cwd to template pak root
|
298
|
-
|
299
|
-
@pakdir = File.dirname( manifestsrc ) # template pak root - make availabe too in erb via binding
|
300
|
-
logger.debug " setting pakdir to >#{pakdir}<"
|
301
|
-
|
302
|
-
# todo/fix: change current work dir (cwd) in pakman gem itself
|
303
|
-
# for now lets do it here
|
304
|
-
|
305
|
-
logger.debug "changing cwd to pak - new >#{pakdir}<, old >#{Dir.pwd}<"
|
306
|
-
Dir.chdir( pakdir )
|
307
|
-
|
308
|
-
|
309
|
-
pakpath = outdir
|
310
|
-
|
311
|
-
logger.debug( "manifestsrc >#{manifestsrc}<, pakpath >#{pakpath}<" )
|
312
|
-
|
313
|
-
Pakman::Templater.new( logger ).merge_pak( manifestsrc, pakpath, binding, basename )
|
314
|
-
|
315
|
-
logger.debug "restoring cwd to src - new >#{srcdir}<, old >#{Dir.pwd}<"
|
316
|
-
Dir.chdir( srcdir )
|
317
|
-
|
318
|
-
## pop/restore org (original) working folder/dir
|
319
|
-
unless usrdir == srcdir
|
320
|
-
logger.debug "restoring cwd to usr - new >#{usrdir}<, old >#{Dir.pwd}<"
|
321
|
-
Dir.chdir( usrdir )
|
322
|
-
end
|
323
|
-
|
324
|
-
puts "Done."
|
325
|
-
end # method create_slideshow
|
326
|
-
|
327
|
-
|
328
|
-
end # class Gen
|
329
|
-
|
330
|
-
end # class Slideshow
|