nakajima-slidedown 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,24 @@
1
1
  class Slide
2
- attr_accessor :text, :classes
2
+ attr_accessor :text, :classes, :notes
3
3
 
4
4
  def initialize(text, *classes)
5
5
  @text = text
6
6
  @classes = classes
7
+ @notes = nil
8
+
9
+ extract_notes!
7
10
  end
8
11
 
9
12
  def html
10
13
  MakersMark::Generator.new(@text).to_html
11
14
  end
15
+
16
+ private
17
+
18
+ def extract_notes!
19
+ @text.gsub!(/^!NOTES\s*(.*\n)$/m) do |note|
20
+ @notes = note.to_s.chomp.gsub('!NOTES', '')
21
+ ''
22
+ end
23
+ end
12
24
  end
@@ -11,6 +11,7 @@ class SlideDown
11
11
  USAGE = "The SlideDown command line interface takes a .md (Markdown) file as its only required argument. It will convert the file to HTML in standard out. Options:
12
12
  -t, --template [TEMPLATE] the .erb files in /templates directory. Default is -t default, which prints stylesheets and javascripts inline. The import template uses link and script tags."
13
13
 
14
+ attr_accessor :stylesheets, :title
14
15
  attr_reader :classes
15
16
 
16
17
  def self.run!(argv = ARGV)
@@ -45,9 +46,12 @@ class SlideDown
45
46
  end
46
47
 
47
48
  # Ensures that the first slide has proper !SLIDE declaration
48
- def initialize(raw)
49
+ def initialize(raw, opts = {})
49
50
  @raw = raw =~ /\A!SLIDE/ ? raw : "!SLIDE\n#{raw}"
50
51
  extract_classes!
52
+
53
+ self.stylesheets = opts[:stylesheets] || local_stylesheets
54
+ self.title = opts[:title] || "Slides"
51
55
  end
52
56
 
53
57
  def slides
@@ -71,8 +75,8 @@ class SlideDown
71
75
  @lines ||= @raw.split(/^!SLIDE\s*([a-z\s]*)$/).reject { |line| line.empty? }
72
76
  end
73
77
 
74
- def stylesheets
75
- Dir[Dir.pwd + '/*.stylesheets'].map { |path| File.read(path) }
78
+ def local_stylesheets
79
+ Dir[Dir.pwd + '/*.stylesheets']
76
80
  end
77
81
 
78
82
  def jabascripts
@@ -87,4 +91,13 @@ class SlideDown
87
91
  end
88
92
  @classes
89
93
  end
94
+
95
+ def extract_notes!
96
+ @raw.gsub!(/^!NOTES\s*(.*)!SLIDE$/m) do |note|
97
+ '!SLIDE'
98
+ end
99
+ @raw.gsub!(/^!NOTES\s*(.*\n)$/m) do |note|
100
+ ''
101
+ end
102
+ end
90
103
  end
@@ -1,13 +1,11 @@
1
1
  <html>
2
2
  <head>
3
- <title>Slides</title>
3
+ <title><%= title %></title>
4
4
  <style type="text/css" media="screen">
5
5
  <%= read('stylesheets/slides.css') %>
6
6
  </style>
7
7
  <% stylesheets.each do |style| %>
8
- <style type="text/css" media="screen">
9
- <%= style %>
10
- </style>
8
+ <link rel="stylesheet" href="<%= style %>" type="text/css" media="screen" charset="utf-8" />
11
9
  <% end %>
12
10
  <script type="text/javascript">
13
11
  <%= read('javascripts/jquery-1.3.2.js') %>
@@ -41,7 +41,7 @@
41
41
  # Chris Wanstrath // chris@ozmm.org
42
42
  # GitHub // http://github.com
43
43
  #
44
- require 'open4'
44
+ require 'open3'
45
45
 
46
46
  class Albino
47
47
  @@bin = '/usr/local/bin/pygmentize'
@@ -60,7 +60,7 @@ class Albino
60
60
  end
61
61
 
62
62
  def execute(command)
63
- pid, stdin, stdout, stderr = Open4.popen4(command)
63
+ stdin, stdout, stderr = Open3.popen3(command)
64
64
  stdin.puts @target
65
65
  stdin.close
66
66
  stdout.read.strip
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nakajima-slidedown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Nakajima
@@ -59,6 +59,8 @@ files:
59
59
  - vendor/albino.rb
60
60
  has_rdoc: true
61
61
  homepage:
62
+ licenses: []
63
+
62
64
  post_install_message:
63
65
  rdoc_options: []
64
66
 
@@ -80,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
82
  requirements: []
81
83
 
82
84
  rubyforge_project:
83
- rubygems_version: 1.2.0
85
+ rubygems_version: 1.3.5
84
86
  signing_key:
85
87
  specification_version: 2
86
88
  summary: Create slides with Markdown