hyaslide 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8da32a463b9e78e260618047ce41e372051cba35
4
+ data.tar.gz: e777a229d8ea06fd9c0244917b85f1fb76505b98
5
+ SHA512:
6
+ metadata.gz: febb2b046ecd82944a9d17de00a6ba4404e44f813f52192300f730d3119a3ba9ba1b4aa637c733030ca922a49bef264b51d3d072311de1df5ba488be97f03776
7
+ data.tar.gz: 9a0635689640c296a674deba02dd8f94777a98944627124b1539fe57ca8dd4568d9fd7384ff087fc9972279723afd342250c629290a501368de921d7fbee27e9
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "hyaslide"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/hyaslide ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path('../../lib/hyaslide', __FILE__)
4
+
5
+ Hyaslide::Cli.start(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,27 @@
1
+ require 'thor'
2
+ require 'fileutils'
3
+ require 'rouge'
4
+
5
+ module Hyaslide
6
+ class Cli < Thor
7
+ desc 'new', 'create new project'
8
+
9
+ def new(name)
10
+ puts "Create new project '#{name}'"
11
+
12
+ FileUtils.mkdir name
13
+ dir = Dir.new(__dir__+'/../../template/project')
14
+ dir.each do |file|
15
+ next if file == '..'
16
+ FileUtils.cp_r(dir.path + '/' + file, name)
17
+ end
18
+ end
19
+
20
+ desc 'highlight', 'generate highlight.css'
21
+
22
+ def highlight
23
+ puts Rouge::Themes::Base16.mode(:dark).render(scope: '.highlight')
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,218 @@
1
+ require 'unindent'
2
+ require 'rouge'
3
+ require 'redcarpet'
4
+
5
+ class String
6
+ def escape
7
+ if self =~ /<a>(.*)<\/a>/
8
+ "a(#{$1})"
9
+ elsif self =~ /<img>(.*)<\/img>/
10
+ "img(#{$1})"
11
+ elsif self =~ /<div>(.*)<\/div>/
12
+ "div(#{$1})"
13
+ elsif self =~ /<strong>(.*)<\/strong>/
14
+ "strong(nil, \"#{$1}\")"
15
+ else
16
+ "\"#{self.gsub(/\"/, "\\\"").gsub(/\\/, "\\\\")}\""
17
+ end
18
+ end
19
+ end
20
+
21
+ module Redcarpet
22
+ module Render
23
+ class Hyaslide < Base
24
+ def initialize
25
+ super
26
+ @enter_title_page = false
27
+ @enter_page = false
28
+ @page_count = 0
29
+ clear_list_state
30
+ end
31
+
32
+ def clear_list_state
33
+ @enter_list = false
34
+ @list_depth = 0
35
+ end
36
+
37
+ [
38
+ # block-level calls
39
+ :block_quote,
40
+
41
+ # span-level calls
42
+ :autolink,
43
+ :underline, :raw_html,
44
+ :triple_emphasis, :strikethrough,
45
+ :superscript, :highlight,
46
+
47
+ # footnotes
48
+ :footnotes, :footnote_def, :footnote_ref,
49
+
50
+ # low level rendering
51
+ #:entity, :normal_text
52
+ ].each do |method|
53
+ define_method method do |*args|
54
+ "#{method} #{args.first}"
55
+ end
56
+ end
57
+
58
+ def hrule
59
+ clear_list_state
60
+ "".tap do |result|
61
+ if @enter_title_page || @enter_page
62
+ result <<
63
+ <<EOD
64
+ end
65
+ end
66
+ end
67
+
68
+ EOD
69
+ @enter_title_page = @enter_page = false
70
+ end
71
+
72
+ result << <<EOD
73
+ class Hyaslide::Page#{@page_count} < Hyaslide::PageBase
74
+ def content
75
+ [].tap do |children|
76
+ EOD
77
+
78
+ @enter_page = true
79
+ @page_count += 1
80
+ end
81
+ end
82
+
83
+ def header(text, header_level)
84
+ clear_list_state
85
+
86
+ if header_level > 3
87
+ return " children << h#{header_level}(nil, #{text.escape})\n"
88
+ end
89
+
90
+ "".tap do |result|
91
+ if @enter_title_page || @enter_page
92
+ result <<
93
+ <<EOD
94
+ end
95
+ end
96
+ end
97
+
98
+ EOD
99
+ @enter_title_page = @enter_page = false
100
+ end
101
+
102
+ if header_level == 1
103
+ @enter_title_page = true
104
+ @title = text.escape
105
+ else
106
+ @enter_page = true
107
+ end
108
+
109
+
110
+ result <<
111
+ <<EOD
112
+ class Hyaslide::Page#{@page_count} < Hyaslide::PageBase
113
+ def header
114
+ h#{header_level}(nil, #{text.escape})
115
+ end
116
+
117
+ def content
118
+ [].tap do |children|
119
+ EOD
120
+
121
+ @page_count += 1
122
+ end
123
+ end
124
+
125
+ def doc_footer(*args)
126
+ <<EOD
127
+ end
128
+ end
129
+ end
130
+
131
+ Hyaslide.page_count = #{@page_count}
132
+ Hyaslide.title = #{@title}
133
+ EOD
134
+ end
135
+
136
+ def list_item(item, orderd)
137
+ "".tap do |result|
138
+ if item =~ /.*\n +children << /
139
+ result << item.sub(/(.*)\n +children << /) { " li(nil, #{$1.strip.escape}),\n " }.rstrip
140
+ result << ",\n"
141
+ @enter_list = false
142
+ else
143
+ result << " li(nil, #{item.strip.escape}),\n"
144
+ end
145
+ end
146
+ end
147
+
148
+ def list(text, ordered)
149
+ "".tap do |result|
150
+ result << " children << ul(nil,\n"
151
+ result << text.sub(/,\n\z/, "\n")
152
+ result << " )\n"
153
+ @enter_list = false
154
+ end
155
+ end
156
+
157
+ def link(link, title, content)
158
+ "<a>{href: #{link.escape}, target: \"_blank\"}, #{content.escape}</a>"
159
+ end
160
+
161
+ def image(link, title, alt_text)
162
+ "<img>{className: \"#{alt_text}\", src: #{link.escape}}</img>"
163
+ end
164
+
165
+ def block_code(code, language)
166
+ clear_list_state
167
+
168
+ formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true)
169
+ lexer = case language
170
+ when 'ruby'
171
+ Rouge::Lexers::Ruby.new
172
+ when 'javascript'
173
+ Rouge::Lexers::Javascript.new
174
+ else
175
+ Rouge::Lexers::PlainText.new
176
+ end
177
+ highlight = formatter.format(lexer.lex(code))
178
+ " children << code({ dangerouslySetInnerHTML: { __html: %q{#{highlight}} } })\n"
179
+ end
180
+
181
+ def block_html(html)
182
+ clear_list_state
183
+ " children << code({ dangerouslySetInnerHTML: { __html: %q{#{html}} } })\n"
184
+ end
185
+
186
+ def emphasis(*args)
187
+ "# #{args}"
188
+ end
189
+
190
+ def double_emphasis(*args)
191
+ "<strong>#{args.first}</strong>"
192
+ end
193
+
194
+ def paragraph(text)
195
+ lines = text.split(/ $/)
196
+ if text[0] == '%'
197
+ class_name = text[1...text.index(':')]
198
+ lines[0] = lines.first[(lines.first.index(':') + 1)...lines.first.length].lstrip
199
+ " children << p({className:\"#{class_name}\"}, #{lines.map{|l| l.escape}.join(',Hyalite.create_element(\'br\'),')})\n"
200
+ else
201
+ " children << p(nil, #{lines.map{|l| l.escape}.join(',Hyalite.create_element(\'br\'),')})\n"
202
+ end
203
+ end
204
+
205
+ def table(header, body)
206
+ "#{header}#{body}"
207
+ end
208
+
209
+ def table_row(content)
210
+ content + "\n"
211
+ end
212
+
213
+ def table_cell(content, alignment)
214
+ content + "\t"
215
+ end
216
+ end
217
+ end
218
+ end
File without changes
@@ -0,0 +1,34 @@
1
+ require 'rouge'
2
+ require 'fssm'
3
+ require 'eventmachine'
4
+ require 'redcarpet'
5
+
6
+ require_relative './render_hyaslide'
7
+
8
+ module Hyaslide
9
+ class SlideLoader
10
+ def initialize(dir)
11
+ @dir = dir
12
+ end
13
+
14
+ def self.load_slide(dir)
15
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::Hyaslide, fenced_code_blocks: true)
16
+ File.open("#{dir}/pages/pages.rb", "w+") do |f|
17
+ data = File.read("#{dir}/slide.md")
18
+ f.write markdown.render(data)
19
+ end
20
+ end
21
+
22
+ def run
23
+ Hyaslide::SlideLoader.load_slide(@dir)
24
+
25
+ EM.defer do
26
+ FSSM.monitor("#{@dir}", "slide.md") do
27
+ update {|base, relative| SlideLoader.load_slide }
28
+ delete {|base, relative|}
29
+ create {|base, relative|}
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module Hyaslide
2
+ VERSION = "0.2.0"
3
+ end
data/lib/hyaslide.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "hyaslide/version"
2
+
3
+ require 'hyaslide/cli'
4
+ require "hyaslide/slide_loader"
5
+ require "hyaslide/server"
6
+
7
+ module Hyaslide
8
+ end
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'hyaslide'
4
+ gem 'opal-browser'
5
+ gem 'opal-router', github: 'adambeynon/opal-router'
6
+ gem 'opal-haml', github: 'opal/opal-haml'
7
+ gem 'hyalite'
8
+
@@ -0,0 +1,96 @@
1
+ GIT
2
+ remote: git://github.com/adambeynon/opal-router.git
3
+ revision: bc8c242510794ecbb842b52423732f2ec55c2a1e
4
+ specs:
5
+ opal-router (0.0.1)
6
+ opal (>= 0.3.44)
7
+
8
+ GIT
9
+ remote: git://github.com/opal/opal-haml.git
10
+ revision: ca3d7339098dc115c0cedb9f1aeccd1f7187dd71
11
+ specs:
12
+ opal-haml (0.4.1)
13
+ haml
14
+ opal (>= 0.5.0, < 1.0.0)
15
+
16
+ PATH
17
+ remote: ../..
18
+ specs:
19
+ hyaslide (0.1.0)
20
+ eventmachine
21
+ fssm
22
+ haml
23
+ redcarpet
24
+ rouge
25
+ sass
26
+ sinatra
27
+ sinatra-contrib
28
+ thin
29
+ unindent
30
+
31
+ GEM
32
+ remote: https://rubygems.org/
33
+ specs:
34
+ backports (3.6.8)
35
+ concurrent-ruby (1.0.2)
36
+ daemons (1.2.4)
37
+ eventmachine (1.2.0.1)
38
+ fssm (0.2.10)
39
+ haml (4.0.7)
40
+ tilt
41
+ hike (1.2.3)
42
+ hyalite (0.0.2)
43
+ opal
44
+ opal-browser
45
+ multi_json (1.12.1)
46
+ opal (0.10.2)
47
+ hike (~> 1.2)
48
+ sourcemap (~> 0.1.0)
49
+ sprockets (~> 3.1)
50
+ tilt (>= 1.4)
51
+ opal-browser (0.2.0)
52
+ opal
53
+ paggio
54
+ paggio (0.2.6)
55
+ rack (1.6.4)
56
+ rack-protection (1.5.3)
57
+ rack
58
+ rack-test (0.6.3)
59
+ rack (>= 1.0)
60
+ redcarpet (3.3.4)
61
+ rouge (2.0.6)
62
+ sass (3.4.22)
63
+ sinatra (1.4.7)
64
+ rack (~> 1.5)
65
+ rack-protection (~> 1.4)
66
+ tilt (>= 1.3, < 3)
67
+ sinatra-contrib (1.4.7)
68
+ backports (>= 2.0)
69
+ multi_json
70
+ rack-protection
71
+ rack-test
72
+ sinatra (~> 1.4.0)
73
+ tilt (>= 1.3, < 3)
74
+ sourcemap (0.1.1)
75
+ sprockets (3.7.0)
76
+ concurrent-ruby (~> 1.0)
77
+ rack (> 1, < 3)
78
+ thin (1.7.0)
79
+ daemons (~> 1.0, >= 1.0.9)
80
+ eventmachine (~> 1.0, >= 1.0.4)
81
+ rack (>= 1, < 3)
82
+ tilt (2.0.5)
83
+ unindent (1.0)
84
+
85
+ PLATFORMS
86
+ ruby
87
+
88
+ DEPENDENCIES
89
+ hyalite
90
+ hyaslide!
91
+ opal-browser
92
+ opal-haml!
93
+ opal-router!
94
+
95
+ BUNDLED WITH
96
+ 1.12.5
@@ -0,0 +1,156 @@
1
+ require 'hyalite'
2
+ require 'opal-router'
3
+ require 'browser/interval'
4
+ require 'browser/location'
5
+ require 'track_field'
6
+ require 'page_base'
7
+
8
+ module App
9
+ def self.render
10
+ Hyalite.render(Hyalite.create_element(Hyaslide::Slide, nil), $document['.hyaslide'])
11
+ end
12
+ end
13
+
14
+ module Hyaslide
15
+ SLIDE_WIDTH = 960
16
+ SLIDE_HEIGHT = 720
17
+ TOTAL_TIME = 35 * 60
18
+
19
+ def self.page_count
20
+ @page_count
21
+ end
22
+
23
+ def self.page_count=(count)
24
+ @page_count = count
25
+ end
26
+
27
+ def self.title
28
+ @title
29
+ end
30
+
31
+ def self.title=(title)
32
+ @title = title
33
+ end
34
+
35
+ class Slide
36
+ include Hyalite::Component
37
+ include Hyalite::Component::ShortHand
38
+
39
+ def pages(height)
40
+ case @state[:mode]
41
+ when :slide
42
+ Hyaslide.page_count.times.map do |i|
43
+ Object.const_get("Hyaslide::Page#{i}").el({visible: @state[:page_number] == i, page_number: i, slide_height: height})
44
+ end
45
+ when :print
46
+ Hyaslide.page_count.times.map do |i|
47
+ Object.const_get("Hyaslide::Page#{i}").el({visible: true, page_number: i, slide_height: height})
48
+ end
49
+ end
50
+ end
51
+
52
+ def initial_state
53
+ page_num = $window.location.uri.sub(/.*\/#\/([0-9]+)/, '\1').to_i
54
+
55
+ {
56
+ page_number: page_num,
57
+ mode: :slide,
58
+ start: nil,
59
+ footer_visible: false
60
+ }
61
+ end
62
+
63
+ def component_did_mount
64
+ $window.on(:keydown) do |evt|
65
+ handle_key_down(evt)
66
+ end
67
+
68
+ router = Router.new
69
+ router.route('/') { page_to(num) }
70
+ router.route('/:page') {|params| p params; set_state(page_number: params[:page].to_i) }
71
+ end
72
+
73
+ def page_to(num)
74
+ $window.location.assign("/#/#{num}")
75
+ end
76
+
77
+ def handle_key_down(evt)
78
+ case evt.code
79
+ when 39
80
+ page_to(@state[:page_number] + 1) if @state[:page_number] < Hyaslide.page_count
81
+ when 37
82
+ page_to(@state[:page_number] - 1) if @state[:page_number] > 0
83
+ when 83
84
+ unless @state[:start]
85
+ set_state(start: Time.now)
86
+ else
87
+ set_state(start: nil)
88
+ end
89
+ when 80
90
+ if @state[:mode] == :slide
91
+ set_state(mode: :print)
92
+ else
93
+ set_state(mode: :slide)
94
+ end
95
+ when 70
96
+ set_state(footer_visible: !@state[:footer_visible])
97
+ else
98
+ puts "keycode = #{evt.code}"
99
+ end
100
+ end
101
+
102
+ def render
103
+ follow_height = $window.view.height / $window.view.width < SLIDE_HEIGHT / SLIDE_WIDTH
104
+ if follow_height
105
+ zoom = $window.view.height.to_f / SLIDE_HEIGHT * 0.98
106
+ else
107
+ zoom = $window.view.width.to_f / SLIDE_WIDTH * 0.98
108
+ end
109
+
110
+ top = ($window.view.height / zoom - SLIDE_HEIGHT) / 2
111
+ left = ($window.view.width / zoom - SLIDE_WIDTH) / 2
112
+
113
+ footer_style = @state[:page_number] == 1 || !@state[:footer_visible] ? {style: {display: 'none'}} : {}
114
+
115
+ case @state[:mode]
116
+ when :slide
117
+ div({className: 'background'},
118
+ div({
119
+ className: 'slide',
120
+ style: {zoom: zoom, top: "#{top}px", left: "#{left}px"},
121
+ onKeyDown: -> (evt) { handle_key_down(evt) }
122
+ },
123
+ pages(SLIDE_HEIGHT * zoom)
124
+ ),
125
+ Hyaslide::TrackField.el({total_time: TOTAL_TIME, start: @state[:start], page_number: @state[:page_number], page_count: Hyaslide.page_count}),
126
+ section({className: 'footer'}.merge(footer_style),
127
+ p({className: 'title'}, Hyaslide.title),
128
+ p({className: 'powered-by'}, "Powered by ", span({className: "hyalite"}, "Hyalite"))
129
+ )
130
+ )
131
+ when :print
132
+ div({
133
+ className: 'print',
134
+ onKeyDown: -> (evt) { handle_key_down(evt) } },
135
+ pages(SLIDE_HEIGHT * zoom).map do |page|
136
+ top += SLIDE_HEIGHT * zoom
137
+ div({
138
+ className: 'wrap-page',
139
+ style: {zoom: zoom, top: "#{top}px", left: "#{left}px"},
140
+ }, page)
141
+ end
142
+ )
143
+ end
144
+ end
145
+ end
146
+ end
147
+
148
+ require 'pages'
149
+
150
+ $document.ready do
151
+ $window.on(:resize) do
152
+ App.render
153
+ end
154
+
155
+ App.render
156
+ end
@@ -0,0 +1,46 @@
1
+ module Hyaslide
2
+ class PageBase
3
+ include Hyalite::Component
4
+ include Hyalite::Component::ShortHand
5
+
6
+ def initialize
7
+ @height = 0
8
+ end
9
+
10
+ # def component_did_mount
11
+ # every(0.05) do
12
+ # if @props[:visible]
13
+ # prev_height = @height
14
+ # el = $document.css(".#{page_class_name}")[0]
15
+ # if el
16
+ # height = el.height.to_i
17
+ # unless (height - prev_height).abs < 3
18
+ # @height = height
19
+ # set_state(top: "#{((700 - @height)/2).to_i}px")
20
+ # end
21
+ # end
22
+ # end
23
+ # end
24
+ # end
25
+
26
+ def page_class_name
27
+ "page_#{@props[:page_number]}"
28
+ end
29
+
30
+ def style
31
+ {top: @state[:top]}.merge(@props[:visible] ? {display: 'block'} : {display: 'none'})
32
+ end
33
+
34
+ def header
35
+ nil
36
+ end
37
+
38
+ def content
39
+ nil
40
+ end
41
+
42
+ def render
43
+ section({className: "page #{page_class_name}", style: style}, header, content)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,43 @@
1
+ require 'browser/interval'
2
+
3
+ module Hyaslide
4
+ class TrackField
5
+ include Hyalite::Component
6
+ include Hyalite::Component::ShortHand
7
+
8
+ def initialize
9
+ super
10
+ @width = 0
11
+ end
12
+
13
+ def initial_state
14
+ { tic: false }
15
+ end
16
+
17
+ def component_did_mount
18
+ every(1) do
19
+ set_state(tic: !@state[:tic])
20
+ if el = $document.css(".track-field")[0]
21
+ @width = el.width.to_i
22
+ spend_time = @props[:start] ? Time.now - @props[:start] : 0
23
+ rabbit_pos = [(spend_time / @props[:total_time]), 1].min * (@width - 40) * 0.96 + @width * 0.02
24
+ set_state(rabbit_pos: rabbit_pos)
25
+ end
26
+ end
27
+ end
28
+
29
+ def render
30
+ turtle_pos = (@props[:page_number] / @props[:page_count]) * (@width - 40) * 0.96 + @width * 0.02
31
+ mstyle = {transform: "rotate(#{@state[:tic]?'-':''}7deg)", left: "#{@state[:rabbit_pos]}px"}
32
+ ystyle = {transform: "rotate(#{@state[:tic]?'':'-'}7deg)"}
33
+ ystyle.merge!(left: "#{turtle_pos}px") if @width > 0
34
+
35
+ div({className: 'track-field'},
36
+ @props[:start] ? [
37
+ div({className: 'flag', style: {right: "#{@width * 0.02}px"}}),
38
+ div({className: 'rabbit avatar', style: mstyle}),
39
+ div({className: 'turtle avatar', style: ystyle})
40
+ ] : nil)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,29 @@
1
+ require 'bundler/setup'
2
+ Bundler.require(:default)
3
+
4
+ require 'opal'
5
+ require 'opal-browser'
6
+ require 'rack'
7
+
8
+ dir = 'data'
9
+ Dir.mkdir dir + '/pages' unless Dir.exist? dir + '/pages'
10
+
11
+ Hyaslide::SlideLoader.new(dir).run
12
+
13
+ server = Opal::Server.new do |s|
14
+ s.append_path dir + '/pages'
15
+ s.append_path 'app'
16
+ s.append_path 'images'
17
+ s.append_path 'css'
18
+ s.append_path 'fonts'
19
+
20
+ Opal.use_gem 'opal-router'
21
+ Opal.use_gem 'hyalite'
22
+ Opal.use_gem 'hyaslide'
23
+
24
+ s.debug = true
25
+ s.main = 'application'
26
+ s.index_path = 'index.html.haml'
27
+ end
28
+
29
+ Rack::Handler::WEBrick.run server
@@ -0,0 +1,193 @@
1
+ html {
2
+ height: 100%;
3
+ }
4
+
5
+ body {
6
+ height: 100%;
7
+ margin: 0;
8
+ }
9
+
10
+ ::selection {
11
+ background: #770;
12
+ }
13
+
14
+ .hyaslide {
15
+ height: 100%;
16
+ font-size: 32px;
17
+ }
18
+
19
+ .hyaslide .background {
20
+ height: 100%;
21
+ background-color: #222;
22
+ color: #fff;
23
+ }
24
+
25
+ .slide {
26
+ position: absolute;
27
+ width: 960px;
28
+ height: 720px;
29
+ margin: 0 auto;
30
+ }
31
+
32
+ .wrap-page {
33
+ width: 960px;
34
+ height: 720px;
35
+ margin: 0 auto;
36
+ color: #000;
37
+ background-color: #fff;
38
+ margin-bottom: 60px;
39
+ page-break-after: always;
40
+ }
41
+
42
+ .print {
43
+ background: #fff;
44
+ background-color: #fff;
45
+ color: #000;
46
+ }
47
+
48
+ .slide .page {
49
+ top: 50%;
50
+ transform: translateY(-50%);
51
+ position: absolute;
52
+ width: 100%;
53
+ }
54
+
55
+ .page code {
56
+ font-size: 0.8em;
57
+ }
58
+
59
+
60
+ .page h3 img {
61
+ width: 1.2em;
62
+ background-size: contain;
63
+ background-repeat: no-repeat;
64
+ }
65
+
66
+ .page h4 img {
67
+ width: 80%;
68
+ margin: 0 auto;
69
+ display: block;
70
+ background-size: contain;
71
+ background-repeat: no-repeat;
72
+ }
73
+
74
+ .page img {
75
+ width: 1em;
76
+ background-size: contain;
77
+ background-repeat: no-repeat;
78
+ }
79
+
80
+ h1 {
81
+ font-size: 1.6em;
82
+ text-align: center;
83
+ }
84
+
85
+ h2 {
86
+ font-size: 1.4em;
87
+ text-align: center;
88
+ }
89
+
90
+ h3 {
91
+ font-size: 1.2em;
92
+ text-align: center;
93
+ }
94
+
95
+ h4 {
96
+ font-size: 1.0em;
97
+ text-align: center;
98
+ }
99
+
100
+ .page ul ul {
101
+ font-size: 0.9em;
102
+ }
103
+
104
+ .page li {
105
+ padding-left: 16px;
106
+ }
107
+
108
+ .page .author {
109
+ text-align: right;
110
+ padding-right: 20%;
111
+ }
112
+
113
+ a:link {
114
+ color: #cee;
115
+ text-decoration: none;
116
+ }
117
+
118
+ a:visited {
119
+ color: #cee;
120
+ text-decoration: none;
121
+ }
122
+
123
+ a:hover {
124
+ color: #cca;
125
+ text-decoration: underline;
126
+ }
127
+
128
+ a:active {
129
+ color: #cee;
130
+ text-decoration: none;
131
+ }
132
+
133
+ .track-field {
134
+ position: absolute;
135
+ bottom: 1em;
136
+ width: 100%;
137
+ height: 70px;
138
+ }
139
+
140
+ .track-field .avatar {
141
+ position: absolute;
142
+ left: 2%;
143
+ width: 40px;
144
+ height: 40px;
145
+ background-size: contain;
146
+ border-radius: 4px;
147
+ }
148
+
149
+ .track-field .flag {
150
+ position: absolute;
151
+ width: 30px;
152
+ height: 60px;
153
+ background-image: url("../images/flag.png");
154
+ background-size: contain;
155
+ background-repeat: no-repeat;
156
+ z-index: 900;
157
+ }
158
+
159
+ .track-field .rabbit {
160
+ background-image: url("../images/rabbit.png");
161
+ background-repeat: no-repeat;
162
+ z-index: 1000;
163
+ }
164
+
165
+ .track-field .turtle {
166
+ background-image: url("../images/turtle.png");
167
+ background-repeat: no-repeat;
168
+ z-index: 999;
169
+ top: 30px;
170
+ }
171
+
172
+ .footer .title {
173
+ position: absolute;
174
+ bottom: 4px;
175
+ left: 16px;
176
+ margin: 0;
177
+ font-size: 0.6em;
178
+ color: #888;
179
+ }
180
+
181
+ .footer .powered-by {
182
+ position: absolute;
183
+ bottom: 4px;
184
+ right: 16px;
185
+ margin: 0;
186
+ font-size: 0.6em;
187
+ color: #888;
188
+ }
189
+
190
+ .footer .powered-by .hyalite {
191
+ color: #ee8;
192
+ font-weight: bold;
193
+ }
@@ -0,0 +1,101 @@
1
+ @font-face{
2
+ font-family: Inconsolata;
3
+ src: url(fonts/Inconsolata-Regular.ttf) format(truetype);
4
+ }
5
+
6
+ .highlight {
7
+ padding: 8px;
8
+ }
9
+
10
+ .highlight pre {
11
+ font-family: Inconsolata, monospace;
12
+ font-size: 0.9em;
13
+ }
14
+
15
+ .highlight .code pre {
16
+ margin-left: 16px;
17
+ }
18
+
19
+ .highlight table td { padding: 5px; }
20
+ .highlight table pre { margin: 0; }
21
+ .highlight, .highlight .w {
22
+ color: #d0d0d0;
23
+ background-color: #151515;
24
+ }
25
+ .highlight .err {
26
+ color: #151515;
27
+ background-color: #ac4142;
28
+ }
29
+ .highlight .c, .highlight .cd, .highlight .cm, .highlight .c1, .highlight .cs {
30
+ color: #505050;
31
+ }
32
+ .highlight .cp {
33
+ color: #f4bf75;
34
+ }
35
+ .highlight .nt {
36
+ color: #f4bf75;
37
+ }
38
+ .highlight .o, .highlight .ow {
39
+ color: #d0d0d0;
40
+ }
41
+ .highlight .p, .highlight .pi {
42
+ color: #d0d0d0;
43
+ }
44
+ .highlight .gi {
45
+ color: #90a959;
46
+ }
47
+ .highlight .gd {
48
+ color: #ac4142;
49
+ }
50
+ .highlight .gh {
51
+ color: #6a9fb5;
52
+ background-color: #151515;
53
+ font-weight: bold;
54
+ }
55
+ .highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv {
56
+ color: #aa759f;
57
+ }
58
+ .highlight .kc {
59
+ color: #d28445;
60
+ }
61
+ .highlight .kt {
62
+ color: #d28445;
63
+ }
64
+ .highlight .kd {
65
+ color: #d28445;
66
+ }
67
+ .highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 {
68
+ color: #90a959;
69
+ }
70
+ .highlight .sr {
71
+ color: #75b5aa;
72
+ }
73
+ .highlight .si {
74
+ color: #8f5536;
75
+ }
76
+ .highlight .se {
77
+ color: #8f5536;
78
+ }
79
+ .highlight .nn {
80
+ color: #f4bf75;
81
+ }
82
+ .highlight .nc {
83
+ color: #f4bf75;
84
+ }
85
+ .highlight .no {
86
+ color: #f4bf75;
87
+ }
88
+ .highlight .na {
89
+ color: #6a9fb5;
90
+ }
91
+ .highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx {
92
+ color: #90a959;
93
+ }
94
+ .highlight .ss {
95
+ color: #90a959;
96
+ }
97
+
98
+ .highlight .gutter {
99
+ border-right: solid 1px #666;
100
+ color: #882;
101
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ # Title
2
+
3
+ %author: Your Name
4
+
5
+ ---
6
+
7
+ #### Press 's' then starting the race of rabbit and turtle.
8
+
9
+ ## Slide
10
+
11
+ * Listing
12
+ * ...
Binary file
Binary file
Binary file
@@ -0,0 +1,14 @@
1
+ !!!
2
+ %html(lang="en" data-framework="hyalite")
3
+ %head
4
+ %meta{charset:"utf-8"}
5
+ %title Writting web application in Ruby
6
+ %link{rel:"stylesheet", href:"css/application.css"}
7
+ %link{rel:"stylesheet", href:"data/css/custom.css"}
8
+ %link{rel:"stylesheet", href:"css/highlight.css"}
9
+
10
+ %body
11
+ %section.hyaslide
12
+
13
+ = javascript_include_tag 'application'
14
+
metadata ADDED
@@ -0,0 +1,265 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hyaslide
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - youchan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra-contrib
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thin
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: haml
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sass
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: redcarpet
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: unindent
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rouge
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: fssm
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: eventmachine
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: bundler
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.11'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.11'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rake
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '10.0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '10.0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rspec
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '3.0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '3.0'
209
+ description: This is presentation app making slide from markdown file.
210
+ email:
211
+ - youchan01@gmail.com
212
+ executables:
213
+ - hyaslide
214
+ extensions: []
215
+ extra_rdoc_files: []
216
+ files:
217
+ - bin/console
218
+ - bin/hyaslide
219
+ - bin/setup
220
+ - lib/hyaslide.rb
221
+ - lib/hyaslide/cli.rb
222
+ - lib/hyaslide/render_hyaslide.rb
223
+ - lib/hyaslide/server.rb
224
+ - lib/hyaslide/slide_loader.rb
225
+ - lib/hyaslide/version.rb
226
+ - template/project/Gemfile
227
+ - template/project/Gemfile.lock
228
+ - template/project/app/application.rb
229
+ - template/project/app/page_base.rb
230
+ - template/project/app/track_field.rb
231
+ - template/project/config.ru
232
+ - template/project/css/application.css
233
+ - template/project/css/highlight.css
234
+ - template/project/data/css/custom.css
235
+ - template/project/data/slide.md
236
+ - template/project/fonts/Inconsolata-Regular.ttf
237
+ - template/project/images/flag.png
238
+ - template/project/images/rabbit.png
239
+ - template/project/images/turtle.png
240
+ - template/project/index.html.haml
241
+ homepage: https://github.com/youchan/hyalide
242
+ licenses:
243
+ - MIT
244
+ metadata: {}
245
+ post_install_message:
246
+ rdoc_options: []
247
+ require_paths:
248
+ - lib
249
+ required_ruby_version: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ">="
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ required_rubygems_version: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ">="
257
+ - !ruby/object:Gem::Version
258
+ version: '0'
259
+ requirements: []
260
+ rubyforge_project:
261
+ rubygems_version: 2.5.1
262
+ signing_key:
263
+ specification_version: 4
264
+ summary: Making slide from markdown file
265
+ test_files: []