md2key 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29fd6b603848015b2693b9fcce9711bfa0263f5d
4
- data.tar.gz: ad03c56d3d802deb901ed64ec3114b36e976a05c
3
+ metadata.gz: 5bf3372d25640ed9712e7448a44282d821a19ca4
4
+ data.tar.gz: 7c0def31d4368cb7ce5c4e937079fbc0b77869f2
5
5
  SHA512:
6
- metadata.gz: 0f0d5622209334146fd148b4aae44a520066bab4df69f5fbb1ad56a9400bc6db3f091a3437b762ef471dcf641947e10b7e79c9a5346e3d0d92ec2b922f102bb0
7
- data.tar.gz: c5209f6eca3d337ed1c6f9023711042194fa04aaa1675c94d0f3b713bf41a1fe5f0f7d4f4876bb7c80fbe2872876bdcafe1a7146da1e7b4ccb53bb7e4e9ea666
6
+ metadata.gz: f008ec28023e80ab3911b591850422f8a8fe01ff966c13e95da32e641544c468ca24f99aa3aff7e4da93e266939f3aeb7ee2df02fc012dd6b745e507e6ffab5a
7
+ data.tar.gz: 406465a82cef73f131d84ef61030c143753d0cd653e0926f9ff7ba27777552df19e253bb2ee9d490f79fad5479dabf3e07b1b67273d2f57f95abd098dcea6863
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.3.2
2
+
3
+ - You no longer need to select the second slide by hand
4
+
1
5
  # v0.3.1
2
6
 
3
7
  - Support inserting images
data/README.md CHANGED
@@ -9,37 +9,12 @@ Convert your markdown to keynote.
9
9
  - 3. Create a second slide to choose a slide layout
10
10
  - 4. Then execute `gem install md2key && md2key markdown.md`
11
11
 
12
- ### Example
13
-
14
12
  ![](https://i.gyazo.com/9d4d00164683f516d44b3e536b3dd3e9.gif)
15
13
 
16
- The slides in the movie are generated from following markdown.
17
-
18
- ```markdown
19
- # The presentation
20
-
21
- @k0kubun
22
-
23
- ---
24
-
25
- # Hello world
26
-
27
- - I'm takashi kokubun
28
- - This is a pen
29
-
30
- ---
31
-
32
- # How are you?
33
-
34
- - I'm fine thank you
35
- ```
36
-
37
- This is designed to be compatible with [Deckset](http://www.decksetapp.com/).
38
-
39
- ### No horizontal lines
14
+ ### Basic example
40
15
 
41
- Currently md2key supports a short format that does not need `---`.
42
- Headers always create a new slide.
16
+ The slides in the movie can be generated with following markdown.
17
+ You can separate slides with `---` just for readability.
43
18
 
44
19
  ```markdown
45
20
  # The presentation
@@ -53,9 +28,9 @@ Headers always create a new slide.
53
28
  - I'm fine thank you
54
29
  ```
55
30
 
56
- ### Image
31
+ ### Insert image
57
32
 
58
- ![](https://i.gyazo.com/c9870e72ddf35a9dbd487fad4e6968bd.png)
33
+ <img src='https://i.gyazo.com/c9870e72ddf35a9dbd487fad4e6968bd.png' width='60%'>
59
34
 
60
35
  ```markdown
61
36
  # image slide
@@ -11,17 +11,26 @@ module Md2key
11
11
  end
12
12
 
13
13
  def generate_keynote!
14
- Keynote.activate
15
- Keynote.update_cover(@markdown.cover.title, @markdown.cover.lines.join('\n'))
14
+ prepare_document_base
15
+ generate_contents
16
+ ensure
17
+ Keynote.delete_template_slide
18
+ end
19
+
20
+ private
16
21
 
22
+ def prepare_document_base
23
+ Keynote.activate
24
+ Keynote.ensure_template_slide_availability
17
25
  Keynote.delete_extra_slides
18
- Keynote.show_template_slide # to select a layout of slide
26
+ end
27
+
28
+ def generate_contents
29
+ Keynote.update_cover(@markdown.cover.title, @markdown.cover.lines.join('\n'))
19
30
  @markdown.slides.each_with_index do |slide, index|
20
31
  Keynote.create_slide(slide.title, slide.lines.join('\n'))
21
32
  Keynote.insert_image(slide.image) if slide.image
22
33
  end
23
-
24
- Keynote.delete_template_slide
25
34
  end
26
35
  end
27
36
  end
@@ -24,14 +24,13 @@ module Md2key
24
24
  APPLE
25
25
  end
26
26
 
27
- # You must provide a second slide as a template slide.
28
- # This is just a workaround to select a layout of slides.
29
- # If you tell `make new slide`, your current slide's theme
30
- # will be used.
31
- def show_template_slide
32
- create_slide('', '') if slides_count < 2
27
+ def ensure_template_slide_availability
28
+ return if slides_count >= 2
29
+
33
30
  tell_keynote(<<-APPLE.unindent)
34
- show slide #{TEMPLATE_SLIDE_INDEX} of document 1
31
+ tell document 1
32
+ make new slide
33
+ end
35
34
  APPLE
36
35
  end
37
36
 
@@ -62,8 +61,12 @@ module Md2key
62
61
  def create_slide(title, content)
63
62
  tell_keynote(<<-APPLE.unindent)
64
63
  tell document 1
65
- set newSlide to make new slide
64
+ -- Workaround to select correct master slide. In spite of master slide can be selected by name,
65
+ -- name property is not limited to be unique.
66
+ -- So move the focus to second slide and force "make new slide" to use the exact master slide.
67
+ move slide #{TEMPLATE_SLIDE_INDEX} to before slide #{TEMPLATE_SLIDE_INDEX}
66
68
 
69
+ set newSlide to make new slide
67
70
  tell newSlide
68
71
  set object text of default title item to "#{title}"
69
72
  set object text of default body item to "#{content}"
@@ -1,3 +1,3 @@
1
1
  module Md2key
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md2key
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun