md2key 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/README.md +13 -0
- data/lib/md2key/converter.rb +1 -0
- data/lib/md2key/keynote.rb +25 -1
- data/lib/md2key/markdown.rb +7 -1
- data/lib/md2key/slide.rb +1 -1
- data/lib/md2key/version.rb +1 -1
- 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: 29fd6b603848015b2693b9fcce9711bfa0263f5d
|
4
|
+
data.tar.gz: ad03c56d3d802deb901ed64ec3114b36e976a05c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f0d5622209334146fd148b4aae44a520066bab4df69f5fbb1ad56a9400bc6db3f091a3437b762ef471dcf641947e10b7e79c9a5346e3d0d92ec2b922f102bb0
|
7
|
+
data.tar.gz: c5209f6eca3d337ed1c6f9023711042194fa04aaa1675c94d0f3b713bf41a1fe5f0f7d4f4876bb7c80fbe2872876bdcafe1a7146da1e7b4ccb53bb7e4e9ea666
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
# v0.3.1
|
2
|
+
|
3
|
+
- Support inserting images
|
4
|
+
|
1
5
|
# v0.3.0
|
2
6
|
|
3
|
-
-
|
4
|
-
-
|
7
|
+
- Old extra slides before execution are deleted automatically
|
8
|
+
- Changed not to fail even if a second slide does not exist
|
5
9
|
|
6
10
|
# v0.2.2
|
7
11
|
|
data/README.md
CHANGED
@@ -53,6 +53,19 @@ Headers always create a new slide.
|
|
53
53
|
- I'm fine thank you
|
54
54
|
```
|
55
55
|
|
56
|
+
### Image
|
57
|
+
|
58
|
+

|
59
|
+
|
60
|
+
```markdown
|
61
|
+
# image slide
|
62
|
+
|
63
|
+
- This is an example
|
64
|
+
- You can insert an image
|
65
|
+
|
66
|
+

|
67
|
+
```
|
68
|
+
|
56
69
|
## License
|
57
70
|
|
58
71
|
MIT License
|
data/lib/md2key/converter.rb
CHANGED
@@ -18,6 +18,7 @@ module Md2key
|
|
18
18
|
Keynote.show_template_slide # to select a layout of slide
|
19
19
|
@markdown.slides.each_with_index do |slide, index|
|
20
20
|
Keynote.create_slide(slide.title, slide.lines.join('\n'))
|
21
|
+
Keynote.insert_image(slide.image) if slide.image
|
21
22
|
end
|
22
23
|
|
23
24
|
Keynote.delete_template_slide
|
data/lib/md2key/keynote.rb
CHANGED
@@ -31,7 +31,7 @@ module Md2key
|
|
31
31
|
def show_template_slide
|
32
32
|
create_slide('', '') if slides_count < 2
|
33
33
|
tell_keynote(<<-APPLE.unindent)
|
34
|
-
show slide #{TEMPLATE_SLIDE_INDEX}
|
34
|
+
show slide #{TEMPLATE_SLIDE_INDEX} of document 1
|
35
35
|
APPLE
|
36
36
|
end
|
37
37
|
|
@@ -72,6 +72,30 @@ module Md2key
|
|
72
72
|
APPLE
|
73
73
|
end
|
74
74
|
|
75
|
+
# Insert image to the last slide
|
76
|
+
def insert_image(path)
|
77
|
+
tell_keynote(<<-APPLE.unindent)
|
78
|
+
tell document 1
|
79
|
+
set theSlide to slide #{slides_count}
|
80
|
+
set theImage to POSIX file "#{path}"
|
81
|
+
set docWidth to its width
|
82
|
+
set docHeight to its height
|
83
|
+
|
84
|
+
tell slide #{TEMPLATE_SLIDE_INDEX}
|
85
|
+
set imgFile to make new image with properties { file: theImage, width: docWidth / 3 }
|
86
|
+
tell imgFile
|
87
|
+
set imgWidth to its width
|
88
|
+
set imgHeight to its width
|
89
|
+
end tell
|
90
|
+
end tell
|
91
|
+
|
92
|
+
tell theSlide
|
93
|
+
make new image with properties { file: theImage, width: imgWidth, position: { docWidth - imgWidth - 60, docHeight / 2 - imgHeight / 2} }
|
94
|
+
end tell
|
95
|
+
end tell
|
96
|
+
APPLE
|
97
|
+
end
|
98
|
+
|
75
99
|
private
|
76
100
|
|
77
101
|
def slides_count
|
data/lib/md2key/markdown.rb
CHANGED
@@ -49,7 +49,13 @@ module Md2key
|
|
49
49
|
# FIXME: support nested list
|
50
50
|
slide.lines += li_texts(node).flatten
|
51
51
|
when 'p'
|
52
|
-
|
52
|
+
node.children.each do |child|
|
53
|
+
if child.is_a?(Oga::XML::Element) && child.name == 'img'
|
54
|
+
slide.image = child.attribute('src').value
|
55
|
+
next
|
56
|
+
end
|
57
|
+
slide.lines << child.text
|
58
|
+
end
|
53
59
|
when 'hr'
|
54
60
|
# noop
|
55
61
|
end
|
data/lib/md2key/slide.rb
CHANGED
data/lib/md2key/version.rb
CHANGED