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 +4 -4
- data/examples/basic.rb +3 -2
- data/lib/term-slides.rb +6 -13
- data/lib/version.rb +1 -1
- data/term-slides.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7303882ed8374ac8cf3256cd706c9a5687c8abc7cc3696fec7ee088780fd56fb
|
4
|
+
data.tar.gz: 119277402543cbc0f5611635c7e2471dcb283d812d6ae03ef370f0395f0beeec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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 =
|
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 "
|
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
|
253
|
+
elsif ["p", "\e[D", "\e[A", "h", "k"].include?(s)
|
261
254
|
i -= 1 if i > 0
|
262
|
-
elsif
|
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
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.
|
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-
|
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
|