jekyll_reveal_generator 0.2.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +23 -0
  3. data/.gitignore +11 -0
  4. data/.rspec +3 -0
  5. data/Gemfile +4 -0
  6. data/README.md +80 -0
  7. data/Rakefile +22 -0
  8. data/bin/console +14 -0
  9. data/bin/rake +17 -0
  10. data/bin/setup +8 -0
  11. data/bin/thor +17 -0
  12. data/exe/jekyll_reveal_generator +4 -0
  13. data/exe/jrg +4 -0
  14. data/jekyll_reveal_generator.gemspec +34 -0
  15. data/lib/jekyll_reveal_generator/cli.rb +21 -0
  16. data/lib/jekyll_reveal_generator/create_new_presentation.rb +108 -0
  17. data/lib/jekyll_reveal_generator/create_slide.rb +82 -0
  18. data/lib/jekyll_reveal_generator/defaults.rb +56 -0
  19. data/lib/jekyll_reveal_generator/final_message.txt +34 -0
  20. data/lib/jekyll_reveal_generator/utils.rb +59 -0
  21. data/lib/jekyll_reveal_generator/version.rb +3 -0
  22. data/lib/jekyll_reveal_generator.rb +6 -0
  23. data/templates/presentation/.gitignore +4 -0
  24. data/templates/presentation/Gemfile +3 -0
  25. data/templates/presentation/Rakefile +11 -0
  26. data/templates/presentation/_config.yml +12 -0
  27. data/templates/presentation/_publish.yml.tt +3 -0
  28. data/templates/presentation/setup.sh +10 -0
  29. data/templates/presentation/source/_data/info.yml.tt +11 -0
  30. data/templates/presentation/source/_includes/slide_footer.html +4 -0
  31. data/templates/presentation/source/_includes/slide_header.html +4 -0
  32. data/templates/presentation/source/_includes/slides.html +3 -0
  33. data/templates/presentation/source/_layouts/printed_notes.html +22 -0
  34. data/templates/presentation/source/_layouts/slide.html +3 -0
  35. data/templates/presentation/source/_layouts/slideshow.html +37 -0
  36. data/templates/presentation/source/_slides/00-00-title-slide.md +37 -0
  37. data/templates/presentation/source/_slides/00-01-code-sample.html +39 -0
  38. data/templates/presentation/source/css/printed_styles.sass +23 -0
  39. data/templates/presentation/source/css/styles.sass +66 -0
  40. data/templates/presentation/source/css/zenburn.css +80 -0
  41. data/templates/presentation/source/index.html +3 -0
  42. data/templates/presentation/source/js/revealConfig.js +117 -0
  43. data/templates/presentation/source/notes.html +3 -0
  44. data/templates/slides/blank_slide.html.tt +7 -0
  45. data/templates/slides/blank_slide.markdown.tt +7 -0
  46. data/templates/slides/bullet_slide.html.tt +18 -0
  47. data/templates/slides/bullet_slide.markdown.tt +16 -0
  48. data/templates/slides/image_left_slide.html.tt +31 -0
  49. data/templates/slides/image_left_slide.markdown.tt +32 -0
  50. data/templates/slides/image_right_slide.html.tt +31 -0
  51. data/templates/slides/image_right_slide.markdown.tt +32 -0
  52. data/templates/slides/multi_slide.html.tt +19 -0
  53. data/templates/slides/multi_slide.markdown.tt +23 -0
  54. data/templates/slides/standard_slide.html.tt +10 -0
  55. data/templates/slides/standard_slide.markdown.tt +10 -0
  56. data/templates/slides/title_slide.html.tt +10 -0
  57. data/templates/slides/title_slide.markdown.tt +9 -0
  58. data/templates/slides/two_up_slide.html.tt +32 -0
  59. data/templates/slides/two_up_slide.markdown.tt +24 -0
  60. metadata +229 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d08fa0c08fb27a44a96e0ef462523bd849a6c91f
4
+ data.tar.gz: ce77550f90689c4ec42a2cf6edf0dbed5cc54499
5
+ SHA512:
6
+ metadata.gz: '05092d82c726399926066eebdf1977059859889b625805ca4ea43374645d0a2760a1339215ce77c739c684b93d1ed3391b24995f7af45a10f8924908cbc2cb55'
7
+ data.tar.gz: 9939bfe3445a393611cb69d62e492f3e8866a83318e663b0c03555b4ff5308806a3eab44f013813bfc452b9812e2cb00772e7862dd85f34b6f28eb141e398188
data/.editorconfig ADDED
@@ -0,0 +1,23 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+ # Sample (and default) .editorconfig file for projects
3
+
4
+ # top-most EditorConfig file
5
+ root = true
6
+
7
+ # Unix-style newlines with a newline ending every file
8
+ [*]
9
+ end_of_line = lf
10
+ insert_final_newline = true
11
+ charset = utf-8
12
+ indent_style = space
13
+ indent_size = 2
14
+
15
+ # Tab indentation (no size specified)
16
+ [Makefile]
17
+ indent_style = tab
18
+ indent_size = 1
19
+
20
+ # Matches the exact files either package.json or .travis.yml
21
+ [{package.json,.travis.yml}]
22
+ indent_style = space
23
+ indent_size = 2
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ .byebug-history
2
+ .byebug_history
3
+ /.bundle/
4
+ /.yardoc
5
+ /Gemfile.lock
6
+ /_yardoc/
7
+ /coverage/
8
+ /doc/
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll_reveal_generator.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # JekyllRevealGenerator
2
+
3
+ Generate Jekyll-Reveal.js Slide Presentations
4
+
5
+ You should be familiar with [Jekyll] and [Reveal] to use this generator
6
+ effectively.
7
+
8
+ [Jekyll]: http://jekyllrb.com "The blog-aware static site generator"
9
+ [Reveal]: http://lab.hakim.se/reveal-js/#/ "The HTML presentation framework"
10
+
11
+ ## Installation
12
+
13
+ Install it yourself as:
14
+
15
+ $ gem install jekyll_reveal_generator
16
+
17
+ ## Usage
18
+
19
+ $ jekyll_reveal_generator help
20
+
21
+ or
22
+
23
+ $ jrg help
24
+
25
+ To create a new presentation, use `init`:
26
+
27
+ $ jrg init my_prez
28
+
29
+ and answer the prompts. This will run the `setup.sh` script and
30
+ initialize a git repository and make the first commit.
31
+
32
+ To create a slide, from the presentation root directory, run:
33
+
34
+ $ cd my_pres
35
+ $ jrg slide
36
+
37
+ and answer the prompts.
38
+
39
+ The included Rakefile has two tasks, `serve` and `publish`:
40
+
41
+ * `serve` launches the jekyll server on port 4000
42
+ * `publish` builds the presentation adding the `_publish.yml`
43
+ configuration to the normal configuration
44
+
45
+ ## Templates
46
+
47
+ The slide presentation template is in the `templates/presentation/`
48
+ directory.
49
+
50
+ The new slide templates are in `templates/slides`
51
+
52
+ There is no provision for adding or modifying the templates.
53
+
54
+ ## Development
55
+
56
+ After checking out the repo, run `bin/setup` to install
57
+ dependencies. Then, run `rake test` to run the tests. You can also run
58
+ `bin/console` for an interactive prompt that will allow you to
59
+ experiment.
60
+
61
+ To install this gem onto your local machine, run `bundle exec rake
62
+ install`. To release a new version, update the version number in
63
+ `version.rb`, and then run `bundle exec rake release`, which will
64
+ create a git tag for the version, push git commits and tags, and push
65
+ the `.gem` file to [rubygems.org](https://rubygems.org).
66
+
67
+ This gem utilizes [Thor] as a generator.
68
+
69
+ ## Testing
70
+
71
+ Testing is using [RSpec] for unit testing, and [Aruba] for
72
+ command-line testing.
73
+
74
+ [RSpec]: http://rspec.info/ "Behavior-Driven Development for Ruby. Making TDD Productive and Fun"
75
+ [Aruba]: https://github.com/cucumber/aruba "Test command-line applications with Cucumber-Ruby, Rspec, or Minitest"
76
+
77
+ ## Contributing
78
+
79
+ Bug reports and pull requests are welcome on GitHub
80
+ at <https://github.com/tamouse/jekyll_reveal_generator>.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ require 'cucumber'
8
+ require 'cucumber/rake/task'
9
+
10
+ Cucumber::Rake::Task.new(:features) do |t|
11
+ t.cucumber_opts = "features --format pretty"
12
+ end
13
+
14
+ task :default => [:spec, :features]
15
+
16
+ rescue LoadError
17
+ $stderr.puts "Could not load Cucumber"
18
+ end
19
+
20
+ task :serve do |t|
21
+ sh 'bundle exec jekyll serve'
22
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jekyll_reveal_generator"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
12
+
13
+ # require "irb"
14
+ # IRB.start(__FILE__)
data/bin/rake ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rake", "rake")
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/thor ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'thor' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("thor", "thor")
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "jekyll_reveal_generator"
4
+ JekyllRevealGenerator::Cli.start
data/exe/jrg ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "jekyll_reveal_generator"
4
+ JekyllRevealGenerator::Cli.start
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll_reveal_generator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jekyll_reveal_generator"
8
+ spec.version = JekyllRevealGenerator::VERSION
9
+ spec.authors = ["Tamara Temple"]
10
+ spec.email = ["tamouse@gmail.com"]
11
+
12
+ spec.summary = %q{Generate Jekyll-Reveal.js Slides}
13
+ spec.description = %q{Generate a slide presentation that uses Jekyll and Reveal.js}
14
+ spec.homepage = "https://github.com/tamouse/jekyll_reveal_generator"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "bundler"
24
+ spec.add_dependency "rake"
25
+ spec.add_dependency "thor"
26
+ spec.add_dependency "recursive-open-struct"
27
+
28
+ spec.add_development_dependency "cucumber"
29
+ spec.add_development_dependency "aruba", "~> 1.0.0-alpha.2"
30
+ spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "faker"
32
+ spec.add_development_dependency "pry-byebug"
33
+
34
+ end
@@ -0,0 +1,21 @@
1
+ require "thor"
2
+ require "yaml"
3
+ require "json"
4
+ require "logger"
5
+ require "recursive-open-struct"
6
+ require "jekyll_reveal_generator/defaults"
7
+ require "jekyll_reveal_generator/create_new_presentation"
8
+ require "jekyll_reveal_generator/create_slide"
9
+
10
+ $logger = Logger.new(STDERR)
11
+
12
+ module JekyllRevealGenerator
13
+ class Cli < Thor
14
+ include Thor::Actions
15
+
16
+ add_runtime_options!
17
+
18
+ register(JekyllRevealGenerator::CreateNewPresentation, "init", "init", "Creates a new jekyll-reveal presentation")
19
+ register(JekyllRevealGenerator::CreateSlide, "slide", "slide", "Create a new slide")
20
+ end
21
+ end
@@ -0,0 +1,108 @@
1
+ require "yaml"
2
+ require "thor"
3
+
4
+ module JekyllRevealGenerator
5
+ class CreateNewPresentation < Thor::Group
6
+ include Thor::Actions
7
+
8
+ add_runtime_options!
9
+
10
+ desc "Creates a new Jekyll-Reveal Presentation"
11
+ argument :folder, type: :string, desc: "Folder to generate new presention"
12
+
13
+ attr_accessor :init_options
14
+
15
+ def init
16
+ self.init_options = RecursiveOpenStruct.new({
17
+ title: '',
18
+ description: '',
19
+ author: {
20
+ name: '',
21
+ email: '',
22
+ twitter: '',
23
+ github: ''
24
+ },
25
+ venue: {
26
+ name: '',
27
+ ssid: '',
28
+ password: ''
29
+ },
30
+ publishing: {
31
+ site_url: '',
32
+ base_url: '',
33
+ destination: 'docs'
34
+ }
35
+ }
36
+ .merge({"folder" => folder})
37
+ .merge(options))
38
+
39
+ self.init_options.title = ask("Title of presentation:", :green)
40
+ if init_options.title.match(%r{\A\s*\z})
41
+ $logger.error("You must give a title")
42
+ exit -1;
43
+ end
44
+ self.init_options.description = ask("Description:")
45
+ self.init_options.author.name = ask("Author's name:")
46
+ self.init_options.author.email = ask("Author's email:")
47
+ self.init_options.author.twitter = ask("Author's twitter handle:")
48
+ self.init_options.author.github = ask("Author's github name:")
49
+ self.init_options.venue.name = ask("Name of venue:", default: "T.B.D.")
50
+ self.init_options.venue.ssid = ask("What is the SSID?", default: "T.B.D.")
51
+ self.init_options.venue.password = ask("What is the network password? ", default: "T.B.D.")
52
+ self.init_options.publishing.site_url = ask("What is the published site url?")
53
+ self.init_options.publishing.base_url = ask("What is the base URL for the published site?")
54
+ self.init_options.publishing.destination = ask("What is the destination folder for the published site?", default: "docs")
55
+
56
+ puts init_options.to_h.to_yaml
57
+ unless yes?("Is this correct?", :red)
58
+ $logger.error("quitting, try again")
59
+ exit -1;
60
+ end
61
+ puts "Creating site"
62
+ end
63
+
64
+ def self.source_root
65
+ File.expand_path("../../../templates", __FILE__)
66
+ end
67
+
68
+ def intiialize_directory
69
+ config = {
70
+ verbose: init_options.quiet || true,
71
+ force: init_options.force || false,
72
+ pretend: init_options.pretend || false,
73
+ quiet: init_options.quient || false
74
+ }
75
+ empty_directory(init_options.folder, config)
76
+ destination_root = init_options.folder
77
+ directory("presentation", init_options.folder, config)
78
+ end
79
+
80
+ def initialize_presentation
81
+ if defined? Bundler
82
+ Bundler.with_clean_env do
83
+ run_initial_directory_setup
84
+ end
85
+ else
86
+ run_initial_directory_setup
87
+ end
88
+ end
89
+
90
+ def final_message
91
+ msg = File.read(File.expand_path("../final_message.txt", __FILE__))
92
+ say(msg, :green)
93
+ end
94
+
95
+ private
96
+
97
+ def run_initial_directory_setup
98
+ inside(init_options.folder) do
99
+ run 'git init'
100
+ run 'sh setup.sh'
101
+ run 'git add --all -v'
102
+ run 'git commit -m "Initial Commit"'
103
+ end
104
+ end
105
+
106
+ end
107
+
108
+ end
@@ -0,0 +1,82 @@
1
+ require "recursive-open-struct"
2
+ require "yaml"
3
+ require "thor"
4
+ require "jekyll_reveal_generator/utils"
5
+ require "pathname"
6
+
7
+ module JekyllRevealGenerator
8
+ class CreateSlide < Thor::Group
9
+ include Thor::Actions
10
+ include JekyllRevealGenerator::Utils
11
+
12
+ SLIDE_STYLES = [
13
+ 'blank',
14
+ 'bullet',
15
+ 'image_left',
16
+ 'image_right',
17
+ 'multi',
18
+ 'standard',
19
+ 'title',
20
+ 'two_up'
21
+ ]
22
+
23
+ SLIDE_FORMATS = ['html', 'markdown']
24
+
25
+
26
+ add_runtime_options!
27
+
28
+ class_option(:working_dir, default: Pathname.pwd,
29
+ desc: "Working Directory; root of presentation",
30
+ type: :string, aliases: ['--WD'])
31
+
32
+ desc "Creates a new slide"
33
+
34
+ attr_accessor :slide_options
35
+
36
+ def slide
37
+
38
+ self.slide_options = RecursiveOpenStruct.new({
39
+ title: '',
40
+ group: 0,
41
+ sequence: 0,
42
+ slug: '',
43
+ format: 'html',
44
+ style: 'standard'
45
+ }
46
+ .merge(options))
47
+
48
+ self.slide_options.working_dir = Pathname.new(slide_options.working_dir)
49
+
50
+ Dir.chdir(slide_options.working_dir) do |wd|
51
+ self.slide_options.group = ask("Group?", default: last_slide_group).to_i
52
+ $logger.debug("slide_options.group: #{slide_options.group}")
53
+ self.slide_options.sequence = ask("Sequence?", default: last_slide_sequence(slide_options.group) + 1).to_i
54
+ end
55
+
56
+ self.slide_options.title = ask("Title of slide?")
57
+ self.slide_options.slug = ask("Slide slug?", default: slide_slug(slide_options))
58
+ self.slide_options.format = ask("Format? [#{SLIDE_FORMATS.join(", ")}]", limit_to: SLIDE_FORMATS, default: slide_options.format)
59
+ self.slide_options.style = ask("Slide style? [#{SLIDE_STYLES.join(", ")}]",
60
+ limit_to: SLIDE_STYLES,
61
+ default: 'standard')
62
+ $logger.debug("Slide Options: \n#{slide_options.to_h.to_yaml}")
63
+ end
64
+
65
+ def self.source_root
66
+ File.expand_path("../../../templates/slides", __FILE__)
67
+ end
68
+
69
+ def create_slide
70
+ source="#{slide_options.style}_slide.#{slide_options.format}"
71
+ $logger.debug("template_file: #{source}")
72
+ target_file="#{slide_options.slug}.#{slide_options.format}"
73
+ $logger.debug("target_file: #{target_file}")
74
+ destination=slide_options.working_dir.join("source", "_slides", target_file)
75
+ $logger.debug("destination: #{destination}")
76
+ template(source, destination)
77
+ end
78
+
79
+
80
+ end
81
+
82
+ end
@@ -0,0 +1,56 @@
1
+
2
+ module JekyllRevealGenerator
3
+
4
+ DEFAULT_CONFIGURATION = {
5
+ title: 'My Cool Talk',
6
+ subtitle: "It's the bee's knees",
7
+ author: {
8
+ name: 'Nobody',
9
+ email: 'nobody@example.com',
10
+ github: nil,
11
+ twitter: nil
12
+ },
13
+ collections: [
14
+ 'slides'
15
+ ],
16
+ exclude: [
17
+ 'bs-config.js',
18
+ 'package.json',
19
+ 'node_modules'
20
+ ],
21
+ kramdown: {
22
+ input: 'GFM',
23
+ hard_wrap: false,
24
+ parse_block_html: true,
25
+ parse_span_html: true
26
+ }
27
+ }
28
+
29
+ DEFAULT_PUBLISH_CONFIGURATION = {
30
+ url: '',
31
+ baseurl: ''
32
+ }
33
+
34
+
35
+ DEFAULT_PACKAGE_JSON = {
36
+ name: 'my-cool-talk',
37
+ version: JekyllRevealGenerator::VERSION,
38
+ description: "My cool talk",
39
+ main: "index.js",
40
+ scripts: {
41
+ "jekyll:serve": "bundle exec jekyll serve",
42
+ "jekyll:build": "bundle exec jekyll build --config=_configy.yml,_publish.yml",
43
+ "bs:serve": "browser-sync start --config bs-config.js",
44
+ "start": "concurrently \"npm run bs:serve\" \"npm run jekyll:serve\"",
45
+ "test": "echo \"Error: no tests specified\" && exit 1"
46
+ },
47
+ author: 'nobody',
48
+ license: "MIT"
49
+ }
50
+
51
+ NPM_PACKAGES = [
52
+ 'browser-sync',
53
+ 'concurrently'
54
+ ]
55
+
56
+ end
@@ -0,0 +1,34 @@
1
+
2
+ Congratulations, your new presentation is now ready
3
+ for editing.
4
+
5
+ You can start up a server that will point to http://localhost:4000
6
+
7
+ cd #{init_options.folder}
8
+ bin/rake serve
9
+
10
+ If you add any node.js components, you can add to the setup.sh
11
+ script, it would be a good place to add the "npm install" or
12
+ "yarn" command.
13
+
14
+ I've already performed the initial git commit. You should keep
15
+ committing changes as you go along.
16
+
17
+ The "_publish.yml" file is used to modify the links and the
18
+ destination directory for publishing. This is mainly set up
19
+ for publishing to github pages using the "docs/" directory on
20
+ the master branch. If you want to go this way, the "_publish.yml"
21
+ file settings should be something like:
22
+
23
+ url: "https://YOURGITHUB.github.io"
24
+ baseurl: "/REPO_NAME"
25
+ destination: docs
26
+
27
+ In the REPO_NAME settings you can specify the location for
28
+ your github pages.
29
+
30
+ When you want to add slides, you can run "jrg" from the
31
+ presentation root and answer the questions.
32
+
33
+ cd #{init_options.folder}
34
+ jrg slide
@@ -0,0 +1,59 @@
1
+ require "pathname"
2
+
3
+ module JekyllRevealGenerator
4
+
5
+ module Utils
6
+
7
+ def slide_slug(o)
8
+ pattern = "%02d-%02d-%s"
9
+ pattern % [
10
+ o.group.to_i,
11
+ o.sequence.to_i,
12
+ o.title.downcase
13
+ .gsub(/[^[:alnum:]]+/,'-')
14
+ .sub(/-+\z/,'')
15
+ ]
16
+ end
17
+
18
+ def group_num(file)
19
+ file.to_s.split("-")[0].to_i
20
+ end
21
+
22
+ def sequence_num(file)
23
+ file.to_s.split("-")[1].to_i
24
+ end
25
+
26
+ def last_slide_group(files=nil)
27
+ files ||= slide_files
28
+ files
29
+ .map{|file| group_num(file) }
30
+ .uniq.sort.last
31
+ end
32
+
33
+ def last_slide_sequence(group, files=nil)
34
+ files ||= slide_files
35
+ files
36
+ .reject{|file| group != group_num(file) }
37
+ .map{|file| sequence_num(file)}
38
+ .uniq.sort.last || -1
39
+ end
40
+
41
+ def slides
42
+ @slides ||= source.join(source, '_slides')
43
+ end
44
+
45
+ def slide_files
46
+ @slide_files ||= slides.children
47
+ .map{|f| f.basename}
48
+ end
49
+
50
+ def source
51
+ @source ||= root_dir.join("source")
52
+ end
53
+
54
+ def root_dir(dir=nil)
55
+ @root_dir ||= (dir ? Pathname.new(dir) : Pathname.pwd)
56
+ end
57
+
58
+ end # module Utils
59
+ end
@@ -0,0 +1,3 @@
1
+ module JekyllRevealGenerator
2
+ VERSION = "0.2.0.alpha"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "thor"
2
+ require "jekyll_reveal_generator/version"
3
+ require "jekyll_reveal_generator/cli"
4
+
5
+ module JekyllRevealGenerator
6
+ end
@@ -0,0 +1,4 @@
1
+ node_modules/
2
+ *.log
3
+ _site/
4
+ _reveal.js-master/
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+ gem "jekyll"
3
+ gem "rake"
@@ -0,0 +1,11 @@
1
+
2
+ desc "Run the jekyll development server"
3
+ task :serve do |t|
4
+ sh 'bundle exec jekyll serve --config=_config.yml'
5
+ end
6
+
7
+
8
+ desc "Build the published version"
9
+ task :publish do |t|
10
+ sh 'bundle exec jekyll build --config=_config.yml,_publish.yml'
11
+ end
@@ -0,0 +1,12 @@
1
+ # Jekyll configuration file
2
+ source: source
3
+ destination: build
4
+ markdown: kramdown
5
+ kramdown:
6
+ input: GFM
7
+ hard_wrap: false
8
+ parse_block_html: true
9
+ parse_span_html: true
10
+
11
+ collections:
12
+ - slides