markdown_presenter 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/markdown_presenter.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9f9121ee2a813ab86a1509206a2c7e2ce7a0475
|
4
|
+
data.tar.gz: 82c2a0c7ac60d6ec0a3730ba9dd93cf14e555c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c581aad00fb56b386f2a512882c32e6e0a994664ade3da76b756ce99493602fe2f4bd78cb679e2f53b18e451121b2c9e06a9dc5016492aeb84aa801ef22dcf3
|
7
|
+
data.tar.gz: 7fb4773a320b972699ee3a33d8a4cf9da7d9efd72a618091f9b6fdabdf3a5d26c7f96390edac15ea872c8287188449b165b82cfa3de08ec55a270d1371ea69d6
|
data/lib/markdown_presenter.rb
CHANGED
@@ -6,7 +6,7 @@ require 'kramdown'
|
|
6
6
|
def present title, content
|
7
7
|
template = File.read(File.join(File.dirname(__FILE__), "../presenter.html.haml"))
|
8
8
|
haml_engine = Haml::Engine.new(template)
|
9
|
-
haml_engine.render(Object.new, {slides: content.split(/(?=<h1)/), title: title}) do |filename|
|
9
|
+
haml_engine.render(Object.new, {slides: content.split(/(?=<h1)/).reject {|s| s.chomp.empty?}, title: title}) do |filename|
|
10
10
|
File.read File.join(File.dirname(__FILE__), "../", filename)
|
11
11
|
end
|
12
12
|
end
|
@@ -16,7 +16,9 @@ def content_of filename
|
|
16
16
|
Kramdown::Document.new(File.read(filename)).to_html
|
17
17
|
|
18
18
|
elsif filename.end_with? ".html"
|
19
|
-
|
19
|
+
require 'nokogiri'
|
20
|
+
doc = Nokogiri::HTML(File.read(filename))
|
21
|
+
doc.search('body')[0].inner_html
|
20
22
|
|
21
23
|
else
|
22
24
|
$stderr.puts "Format not supported: #{File.extname(filename)}"
|