md2key 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/md2key/converter.rb +4 -2
- data/lib/md2key/keynote.rb +30 -2
- data/lib/md2key/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68f197459ebaa8c0d704124fbabe5848342323a3
|
4
|
+
data.tar.gz: 73c7143f88078d5e8c755a7657c68d77bcabd5f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92103cd03fb7421ba0f5a619257a7e29cfa2dc3589a38a3d9e3ba2cc64603fe0cd81d643a9d0062df5ce9e3025d3c033666b2ed841c87455849d7e7f5e6de882
|
7
|
+
data.tar.gz: da56aeb04ef8b4abfde8c3c5f0aef41f292bcc65b4c0a53fe515dbaf12da9d237c83ee0bcc4cd5b1bef65f8dc64c0cd4e0d3a55fb74ff9f4c141a895a4ca651e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/md2key/converter.rb
CHANGED
@@ -12,12 +12,14 @@ module Md2key
|
|
12
12
|
|
13
13
|
def generate_keynote!
|
14
14
|
Keynote.activate
|
15
|
-
Keynote.show_template_slide # to select a layout of slide
|
16
|
-
|
17
15
|
Keynote.update_cover(@markdown.cover.title, @markdown.cover.lines.join('\n'))
|
16
|
+
|
17
|
+
Keynote.delete_extra_slides
|
18
|
+
Keynote.show_template_slide # to select a layout of slide
|
18
19
|
@markdown.slides.each_with_index do |slide, index|
|
19
20
|
Keynote.create_slide(slide.title, slide.lines.join('\n'))
|
20
21
|
end
|
22
|
+
|
21
23
|
Keynote.delete_template_slide
|
22
24
|
end
|
23
25
|
end
|
data/lib/md2key/keynote.rb
CHANGED
@@ -29,11 +29,28 @@ module Md2key
|
|
29
29
|
# If you tell `make new slide`, your current slide's theme
|
30
30
|
# will be used.
|
31
31
|
def show_template_slide
|
32
|
+
create_slide('', '') if slides_count < 2
|
32
33
|
tell_keynote(<<-APPLE.unindent)
|
33
34
|
show slide #{TEMPLATE_SLIDE_INDEX}
|
34
35
|
APPLE
|
35
36
|
end
|
36
37
|
|
38
|
+
# All slides after a second slide are unnecessary and deleted.
|
39
|
+
def delete_extra_slides
|
40
|
+
tell_keynote(<<-APPLE.unindent)
|
41
|
+
set theSlides to slides of document 1
|
42
|
+
set n to #{slides_count}
|
43
|
+
|
44
|
+
repeat with theSlide in theSlides
|
45
|
+
if n > 2 then
|
46
|
+
delete slide n of document 1
|
47
|
+
end if
|
48
|
+
|
49
|
+
set n to n - 1
|
50
|
+
end repeat
|
51
|
+
APPLE
|
52
|
+
end
|
53
|
+
|
37
54
|
def delete_template_slide
|
38
55
|
tell_keynote(<<-APPLE.unindent)
|
39
56
|
tell document 1
|
@@ -57,10 +74,21 @@ module Md2key
|
|
57
74
|
|
58
75
|
private
|
59
76
|
|
77
|
+
def slides_count
|
78
|
+
tell_keynote(<<-APPLE.unindent).to_i
|
79
|
+
set n to 0
|
80
|
+
set theSlides to slides of document 1
|
81
|
+
repeat with theSlide in theSlides
|
82
|
+
set n to n + 1
|
83
|
+
end repeat
|
84
|
+
do shell script "echo " & n
|
85
|
+
APPLE
|
86
|
+
end
|
87
|
+
|
60
88
|
def tell_keynote(script)
|
61
89
|
lines = [
|
62
90
|
'tell application "Keynote"',
|
63
|
-
*script.split("\n")
|
91
|
+
*script.split("\n"),
|
64
92
|
'end tell',
|
65
93
|
]
|
66
94
|
execute_applescript(lines.join("\n"))
|
@@ -70,7 +98,7 @@ module Md2key
|
|
70
98
|
file = Tempfile.new('applescript')
|
71
99
|
file.write(script)
|
72
100
|
file.close
|
73
|
-
|
101
|
+
`osascript #{file.path}`.strip
|
74
102
|
ensure
|
75
103
|
file.delete
|
76
104
|
end
|
data/lib/md2key/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md2key
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|