gibier 0.8.10 → 0.8.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a10560339aa48e9a04da2106ff021ce223d312b2
4
- data.tar.gz: 2973da5a1bde0aaddc26d98fcc571880234b4714
2
+ SHA256:
3
+ metadata.gz: 5aabc0d1586e400deb20155328b6bb2a579fb54a75c76dba6ae52a6edcbc0831
4
+ data.tar.gz: 38c32fe911c3575483032e25f83428b19792b22f766be2494b5891c5d3a91340
5
5
  SHA512:
6
- metadata.gz: eea5bf41fb2aa99546211e9228fd7d2d637b239da10a5354a62bf119f448a7085c2b4b5d02bf57f4edf79d4300c8ad6ddf9171389c862dbb135ab42ae560750b
7
- data.tar.gz: 6e37edc935824720aef9a2ec3bec5dd445e592e13e06047a55da2b06e6dc65eabdb220cfdf2bf56da451b7365d3c3d0a53c2696e77143f9327a1bd36ebe83e59
6
+ metadata.gz: 0fb1c164b0464033c4bb989d502d1ffa06c5a726c146150766b30e2abbf4c5321c5f3f1299ee70e396c37d146732e1fecbfafe9cbde635defbb86c78c83ae073
7
+ data.tar.gz: e8352a563aba3f65a7d915e95572b97d03463e0fad48a638b1772ee5d56b341f98c7980a9033cd39e20b602759d332319a42046152960d65d446635681bb947a
@@ -22,7 +22,7 @@ class String
22
22
  end
23
23
 
24
24
  module Gibier
25
- class Renderer < Redcarpet::Render::Base
25
+ class Renderer < Redcarpet::Render::HTML
26
26
  def self.create(name)
27
27
  Class.new(Renderer) do
28
28
  def self.page_name
@@ -58,8 +58,8 @@ module Gibier
58
58
 
59
59
  # span-level calls
60
60
  :autolink,
61
- :underline, :raw_html,
62
- :triple_emphasis, :strikethrough,
61
+ :underline,
62
+ :triple_emphasis,
63
63
  :superscript, :highlight,
64
64
 
65
65
  # footnotes
@@ -203,12 +203,28 @@ EOD
203
203
  " children << code({ dangerouslySetInnerHTML: { __html: %q{#{html}} } })\n"
204
204
  end
205
205
 
206
- def emphasis(*args)
207
- "# #{args}"
206
+ def raw_html(html)
207
+ html
208
208
  end
209
209
 
210
- def double_emphasis(*args)
211
- "<strong>#{args.first}</strong>"
210
+ def emphasis(text)
211
+ "<i>#{text}</i>"
212
+ end
213
+
214
+ def double_emphasis(text)
215
+ "<strong>#{text}</strong>"
216
+ end
217
+
218
+ def stikethrough(text)
219
+ "<s>#{text}</s>"
220
+ end
221
+
222
+ def codespan(code)
223
+ "<code>#{code}</code>"
224
+ end
225
+
226
+ def normal_text(text)
227
+ text
212
228
  end
213
229
 
214
230
  def paragraph(text)
@@ -1,3 +1,3 @@
1
1
  module Gibier
2
- VERSION = "0.8.10"
2
+ VERSION = "0.8.11"
3
3
  end
@@ -0,0 +1,34 @@
1
+ class PageBackground
2
+ include Hyalite::Component
3
+
4
+ def background
5
+ case @props[:page_number]
6
+ when 0
7
+ [
8
+ div({class: 'particleground'},
9
+ div({class: 'logo'}),
10
+ div({class: 'copyright'}, "© 2017 Retrieva, Inc.")
11
+ ),
12
+ div({class: 'vborder'})
13
+ ]
14
+ when Gibier.page_count - 1
15
+ [
16
+ div({class: 'particleground'},
17
+ div({class: 'logo large'}),
18
+ div({class: 'copyright'}, "© 2017 Retrieva, Inc.")
19
+ ),
20
+ ]
21
+ else
22
+ [
23
+ div({class: 'border'}),
24
+ div({class: 'dog'}),
25
+ div({class: 'copyright'}, "© 2017 Retrieva, Inc.")
26
+ ]
27
+ end
28
+ end
29
+
30
+ def render
31
+ div({class: 'page-background', style: {zoom: @props[:zoom]}}, background)
32
+ end
33
+ end
34
+
@@ -1,7 +1,8 @@
1
+ require_relative './page_background'
2
+
1
3
  module Gibier
2
4
  class PageBase
3
5
  include Hyalite::Component
4
- include Hyalite::Component::ShortHand
5
6
 
6
7
  def initialize
7
8
  @height = 0
@@ -27,10 +28,6 @@ module Gibier
27
28
  "page_#{@props[:page_number]}"
28
29
  end
29
30
 
30
- def style
31
- {top: @state[:top]}.merge(@props[:visible] ? {display: 'block'} : {display: 'none'})
32
- end
33
-
34
31
  def header
35
32
  nil
36
33
  end
@@ -40,7 +37,16 @@ module Gibier
40
37
  end
41
38
 
42
39
  def render
43
- section({className: "page #{page_class_name}", style: style}, header, content)
40
+ rect = @props[:rect]
41
+ container_style = {zoom: rect.zoom, top: "#{rect.top}px", left: "#{rect.left}px", width: "#{rect.width}px", height: "#{rect.height}px"}
42
+ display = @props[:visible] ? 'block' : 'none'
43
+ section({class: "page #{page_class_name}", style: {width: "#{$window.width}px", height: "#{$window.height}px", display: display}},
44
+ div({class: 'page-container', style: container_style},
45
+ div({class: 'page-header'}, header),
46
+ div({class: 'page-content'}, content)
47
+ ),
48
+ PageBackground.el({zoom: rect.zoom, page_number: @props[:page_number]})
49
+ )
44
50
  end
45
51
  end
46
52
  end
@@ -1,10 +1,11 @@
1
1
  require 'hyalite'
2
2
  require 'opal-router'
3
3
  require 'track_field'
4
+ require 'ostruct'
4
5
 
5
6
  module Gibier
6
- SLIDE_WIDTH = 960
7
- SLIDE_HEIGHT = 720
7
+ SLIDE_WIDTH = 1920
8
+ SLIDE_HEIGHT = 1080
8
9
 
9
10
  def self.page_count
10
11
  @page_count
@@ -49,11 +50,11 @@ module Gibier
49
50
  class Slide
50
51
  include Hyalite::Component
51
52
 
52
- def pages(height)
53
+ def pages(rect)
53
54
  case @state[:mode]
54
55
  when :slide
55
56
  Gibier.page_count.times.map do |i|
56
- Object.const_get("Gibier::Page#{i}").el({visible: @state[:page_number] == i, page_number: i, slide_height: height})
57
+ Object.const_get("Gibier::Page#{i}").el({visible: @state[:visible] || @state[:page_number] == i, page_number: i, rect: rect})
57
58
  end
58
59
  when :print
59
60
  Gibier.page_count.times.map do |i|
@@ -109,9 +110,9 @@ module Gibier
109
110
  def handle_key_down(event)
110
111
  keycode = event.code
111
112
  case keycode
112
- when :Space, :ArrowRight, :ArrowUp
113
+ when :Space, :ArrowRight, :ArrowDown, :PageDown
113
114
  page_forward
114
- when :Backspace, :ArrowLeft, :ArrowDown
115
+ when :Backspace, :ArrowLeft, :ArrowUp, :PageUp
115
116
  page_back
116
117
  when :KeyS, :KeyB
117
118
  unless @state[:start]
@@ -163,16 +164,17 @@ module Gibier
163
164
  end
164
165
 
165
166
  def render
166
- follow_height = $window.height / $window.width < SLIDE_HEIGHT / SLIDE_WIDTH
167
- if follow_height
168
- zoom = $window.height.to_f / SLIDE_HEIGHT * 0.98
167
+ if $window.height / $window.width < SLIDE_HEIGHT / SLIDE_WIDTH
168
+ zoom = $window.height.to_f / SLIDE_HEIGHT
169
169
  else
170
- zoom = $window.width.to_f / SLIDE_WIDTH * 0.98
170
+ zoom = $window.width.to_f / SLIDE_WIDTH
171
171
  end
172
172
 
173
173
  top = ($window.height / zoom - SLIDE_HEIGHT) / 2
174
174
  left = ($window.width / zoom - SLIDE_WIDTH) / 2
175
175
 
176
+ rect = OpenStruct.new(top: top, left: left, width: SLIDE_WIDTH, height: SLIDE_HEIGHT, zoom: zoom)
177
+
176
178
  footer_style = @state[:page_number] == 1 || !@state[:footer_visible] ? {style: {display: 'none'}} : {}
177
179
 
178
180
  case @state[:mode]
@@ -184,10 +186,9 @@ module Gibier
184
186
  div({class: 'page-forward', onClick: -> { page_forward }, onTouchStart: -> { page_forward }}),
185
187
  div({
186
188
  className: 'slide',
187
- style: {zoom: zoom, top: "#{top}px", left: "#{left}px"},
188
189
  onKeyDown: -> (event) { handle_key_down(event) }
189
190
  },
190
- pages(SLIDE_HEIGHT * zoom)
191
+ pages(rect)
191
192
  ),
192
193
  Gibier::TrackField.el({total_time: duration, start: @state[:start], page_number: @state[:page_number], page_count: Gibier.page_count}),
193
194
  section({className: 'footer'}.merge(footer_style),
@@ -205,7 +206,7 @@ module Gibier
205
206
  top += SLIDE_HEIGHT * zoom
206
207
  div({
207
208
  className: 'wrap-page',
208
- style: {zoom: zoom, top: "#{top}px", left: "#{left}px"},
209
+ style: {zoom: zoom, width: "#{SLIDE_WIDTH}px", height: "#{SLIDE_HEIGHT}px", top: "#{top}px", left: "#{left}px"},
209
210
  }, page)
210
211
  end
211
212
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gibier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.10
4
+ version: 0.8.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - youchan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-21 00:00:00.000000000 Z
11
+ date: 2018-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -273,6 +273,7 @@ files:
273
273
  - template/gh_pages/index.haml
274
274
  - template/gh_pages/slide.haml
275
275
  - template/project/Gemfile
276
+ - template/project/app/page_background.rb
276
277
  - template/project/app/page_base.rb
277
278
  - template/project/app/slide.rb
278
279
  - template/project/app/track_field.rb
@@ -315,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
316
  version: '0'
316
317
  requirements: []
317
318
  rubyforge_project:
318
- rubygems_version: 2.6.13
319
+ rubygems_version: 2.7.3
319
320
  signing_key:
320
321
  specification_version: 4
321
322
  summary: A slide tool inspired by Rabbit