term-slides 0.12.0 → 0.13.0

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
  SHA256:
3
- metadata.gz: 291c6428c775da93ef7e019f155643b9906e2a73a68717dcac589a9b0232fdda
4
- data.tar.gz: 1bfc84cf10873d70ceb2c3c501962748a0fe8514c57a9460a7f76a843bf257a8
3
+ metadata.gz: 7303882ed8374ac8cf3256cd706c9a5687c8abc7cc3696fec7ee088780fd56fb
4
+ data.tar.gz: 119277402543cbc0f5611635c7e2471dcb283d812d6ae03ef370f0395f0beeec
5
5
  SHA512:
6
- metadata.gz: 1f48a8d1873ad8397086c3e4db96a950b221303a2547e7b7c0504dacdffc61b6029584997d99ce7390993cc5a1f0b416e1e815bf3347c16bb857291559eb3a6c
7
- data.tar.gz: 3f5ea544c0c73c1b7a783d31d8a8e37d613ed53f7bbaa737780c3ebfc4128449bdaf8f0729bfb50728b050fabe30f0b6c5e9c01e92d43997e6448b9c542fea95
6
+ metadata.gz: 775784799ab636f6f0deb82018d4bb0ba18178fc835f9545ceb3a477aeb4939cae7a7e5af20efafb3f78e9a36056b3dbfaef3e136e3d243a7dc41f351a9421e2
7
+ data.tar.gz: '09c7ae6a4eb3d72bde5bac34f0c9d7c499a81a44a9a2faebd3fda30f42eb0172d4518d2b4bcd543359a1081d686bd1c3b828f747d64cd918f264539605d0b133'
data/examples/basic.rb CHANGED
@@ -22,9 +22,10 @@ TermSlides::Slides.new(ARGV) do
22
22
  end
23
23
  end
24
24
  slide("diagram (requires dot (graphviz), terminal must support it)") do
25
- diagram "digraph {
25
+ diagram 'digraph {
26
26
  a -> b
27
- }"
27
+ dpi = 55
28
+ }'
28
29
  end
29
30
  slide("image (terminal must support it)") do
30
31
  image "#{File.dirname(__FILE__)}/cat.jpg"
data/lib/term-slides.rb CHANGED
@@ -7,6 +7,7 @@ module TermSlides
7
7
  require 'tty-command'
8
8
  require 'highline'
9
9
  require 'mkmf'
10
+ require 'rouge'
10
11
  require 'tempfile'
11
12
 
12
13
  module MakeMakefile::Logging
@@ -16,15 +17,7 @@ module TermSlides
16
17
 
17
18
  class TTYRenderer
18
19
  def render_code code
19
- path = Tempfile.new(['code', ".#{code.format}"]).path
20
- File.write(path, code.content)
21
- vimcat = 'vimcat'
22
- if find_executable vimcat
23
- out, err = TTY::Command.new(pty: true, printer: :null).run(vimcat, path)
24
- puts out
25
- else
26
- puts code
27
- end
20
+ puts ::Rouge.highlight(code.content, code.format, 'terminal256')
28
21
  end
29
22
  def render_table table
30
23
  puts center(TTY::Table.new(table.headers, table.rows).render(:unicode))
@@ -46,7 +39,7 @@ module TermSlides
46
39
  if terminals.size > 0
47
40
  command = commands[terminals.first]
48
41
  else
49
- command = ["icat"]
42
+ command = %w(icat)
50
43
  end
51
44
  if find_executable(command.first)
52
45
  co = (command << path)
@@ -252,14 +245,14 @@ module TermSlides
252
245
  end
253
246
  while true
254
247
  print `clear`
255
- puts "\u202e#{i + 1}/#{@slides.size}"
248
+ puts "#{i + 1}/#{@slides.size}"
256
249
  @slides[i].render
257
250
  s = read_char
258
251
  if s == "q"
259
252
  break
260
- elsif s == "p"
253
+ elsif ["p", "\e[D", "\e[A", "h", "k"].include?(s)
261
254
  i -= 1 if i > 0
262
- elsif s == "n"
255
+ elsif ["n", "\e[C", "\e[B", "l", "j"].include?(s)
263
256
  i += 1 if i < (@slides.size - 1)
264
257
  end
265
258
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Term
2
2
  module Slides
3
- VERSION = "0.12.0"
3
+ VERSION = "0.13.0"
4
4
  end
5
5
  end
data/term-slides.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency "tty-table", "~> 0.10"
29
29
  spec.add_runtime_dependency "tty-command", "~> 0.8"
30
30
  spec.add_runtime_dependency "highline", "~> 2.0"
31
+ spec.add_runtime_dependency "rouge", "~> 3.3"
31
32
 
32
33
  spec.add_development_dependency "bundler", "~> 2.0"
33
34
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-slides
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yazgoo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-10 00:00:00.000000000 Z
11
+ date: 2019-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rouge
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.3'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.3'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement