rubytext 0.0.92 → 0.0.93
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/win_centering.rb +3 -0
- data/lib/version.rb +1 -1
- data/tutorial/sym_nav.png +0 -0
- data/tutorial/sym_nav.rb +33 -0
- data/tutorial/sym_nav.rb.html +61 -0
- data/tutorial/tutorial.html +12 -5
- data/tutorial/tutorial.lt3 +7 -4
- data/tutorial/wrap-brackets.html +2 -2
- data/tutorial/wrap-colortest.html +2 -2
- data/tutorial/wrap-hw.html +2 -2
- data/tutorial/wrap-stdscr.html +2 -2
- data/tutorial/wrap-sym_nav.html +63 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51e87c6fce84220925a60c3160da5b206f05cce503d04fb0a0567f4eb5455e9a
|
4
|
+
data.tar.gz: 99b5c7b09061903726b9b945d2eee25fd8aea94e022c383c15bc4410c573de66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c37fd680c86ed9803b33038e238315ac1fb5bde67fb2ee1d425c6b55d0561c1b9afc1c78665034e99a29fbc17230c406f5de281467417ff624e7167baa7bef9
|
7
|
+
data.tar.gz: 273b34ee5bb9fd997cc060c91658bba2783db22a3dd0d74d50a2cfd0bd2f6504db9134498abad6759bce330385a950c4eb534f4f46f97594942c3513523076dd
|
data/examples/win_centering.rb
CHANGED
@@ -2,6 +2,9 @@ puts "If row (or column) is omitted for window placement,"
|
|
2
2
|
puts "the window will be screen-centered on one axis or both."
|
3
3
|
|
4
4
|
w1 = RubyText.window(3, 21, r: 6, c: 9); w1.puts "Both row and column"
|
5
|
+
sleep 1
|
5
6
|
w2 = RubyText.window(3, 21, r: 4); w2.puts "Row, no column"
|
7
|
+
sleep 1
|
6
8
|
w3 = RubyText.window(3, 21, c: 4); w3.puts "Column, no row"
|
9
|
+
sleep 1
|
7
10
|
w4 = RubyText.window(3, 21); w4.puts "No row, no column"
|
data/lib/version.rb
CHANGED
Binary file
|
data/tutorial/sym_nav.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubytext'
|
2
|
+
|
3
|
+
RubyText.start
|
4
|
+
|
5
|
+
puts "\n Methods such as go, rcprint, and putch"
|
6
|
+
puts " can accept symbols such as"
|
7
|
+
puts " :top :bottom :left :right :center"
|
8
|
+
|
9
|
+
win = RubyText.window(7, 25, r: 5, c: 10, fg: Red, bg: Black)
|
10
|
+
|
11
|
+
win.putch "1", r: :bottom, c: :left
|
12
|
+
sleep 0.4
|
13
|
+
win.go :center, :left
|
14
|
+
win.puts "abc"
|
15
|
+
sleep 0.4
|
16
|
+
win.go :top, :left
|
17
|
+
win.puts "def"
|
18
|
+
sleep 0.4
|
19
|
+
win.rcprint :top, :center, "4"
|
20
|
+
sleep 0.4
|
21
|
+
|
22
|
+
others = [[:top, :right, "5"], [:center, :right, "6"],
|
23
|
+
[:bottom, :right, "7"], [:bottom, :center, "8"],
|
24
|
+
[:center, :center, "9"]]
|
25
|
+
|
26
|
+
others.each do |args|
|
27
|
+
r, c, ch = *args
|
28
|
+
win.go r,c
|
29
|
+
win.putch(ch)
|
30
|
+
sleep 0.4
|
31
|
+
end
|
32
|
+
|
33
|
+
getch
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<style type="text/css">
|
2
|
+
<!--
|
3
|
+
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
4
|
+
body { font-family: monospace; color: #ffffff; background-color: #000000; }
|
5
|
+
pre { font-size: 15 }
|
6
|
+
tt { font-size: 15 }
|
7
|
+
* { font-size: 1em; }
|
8
|
+
.Constant { color: #ff40ff; }
|
9
|
+
.Special { color: #ffff00; }
|
10
|
+
.Identifier { color: #00ffff; }
|
11
|
+
.Statement { color: #ffff00; }
|
12
|
+
.PreProc { color: #ff40ff; }
|
13
|
+
.Type { color: #00ff00; }
|
14
|
+
-->
|
15
|
+
</style>
|
16
|
+
|
17
|
+
<script type='text/javascript'>
|
18
|
+
<!--
|
19
|
+
|
20
|
+
-->
|
21
|
+
</script>
|
22
|
+
</head>
|
23
|
+
<body>
|
24
|
+
<pre id='vimCodeElement'>
|
25
|
+
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">rubytext</span><span class="Special">'</span>
|
26
|
+
|
27
|
+
<span class="Type">RubyText</span>.start
|
28
|
+
|
29
|
+
puts <span class="Special">"</span><span class="Special">\n</span><span class="Constant"> Methods such as go, rcprint, and putch</span><span class="Special">"</span>
|
30
|
+
puts <span class="Special">"</span><span class="Constant"> can accept symbols such as</span><span class="Special">"</span>
|
31
|
+
puts <span class="Special">"</span><span class="Constant"> :top :bottom :left :right :center</span><span class="Special">"</span>
|
32
|
+
|
33
|
+
win = <span class="Type">RubyText</span>.window(<span class="Constant">7</span>, <span class="Constant">25</span>, <span class="Constant">r</span>: <span class="Constant">5</span>, <span class="Constant">c</span>: <span class="Constant">10</span>, <span class="Constant">fg</span>: <span class="Type">Red</span>, <span class="Constant">bg</span>: <span class="Type">Black</span>)
|
34
|
+
|
35
|
+
win.putch <span class="Special">"</span><span class="Constant">1</span><span class="Special">"</span>, <span class="Constant">r</span>: <span class="Constant">:bottom</span>, <span class="Constant">c</span>: <span class="Constant">:left</span>
|
36
|
+
sleep <span class="Constant">0.4</span>
|
37
|
+
win.go <span class="Constant">:center</span>, <span class="Constant">:left</span>
|
38
|
+
win.puts <span class="Special">"</span><span class="Constant">abc</span><span class="Special">"</span>
|
39
|
+
sleep <span class="Constant">0.4</span>
|
40
|
+
win.go <span class="Constant">:top</span>, <span class="Constant">:left</span>
|
41
|
+
win.puts <span class="Special">"</span><span class="Constant">def</span><span class="Special">"</span>
|
42
|
+
sleep <span class="Constant">0.4</span>
|
43
|
+
win.rcprint <span class="Constant">:top</span>, <span class="Constant">:center</span>, <span class="Special">"</span><span class="Constant">4</span><span class="Special">"</span>
|
44
|
+
sleep <span class="Constant">0.4</span>
|
45
|
+
|
46
|
+
others = [[<span class="Constant">:top</span>, <span class="Constant">:right</span>, <span class="Special">"</span><span class="Constant">5</span><span class="Special">"</span>], [<span class="Constant">:center</span>, <span class="Constant">:right</span>, <span class="Special">"</span><span class="Constant">6</span><span class="Special">"</span>],
|
47
|
+
[<span class="Constant">:bottom</span>, <span class="Constant">:right</span>, <span class="Special">"</span><span class="Constant">7</span><span class="Special">"</span>], [<span class="Constant">:bottom</span>, <span class="Constant">:center</span>, <span class="Special">"</span><span class="Constant">8</span><span class="Special">"</span>],
|
48
|
+
[<span class="Constant">:center</span>, <span class="Constant">:center</span>, <span class="Special">"</span><span class="Constant">9</span><span class="Special">"</span>]]
|
49
|
+
|
50
|
+
others.each <span class="Statement">do</span> |<span class="Identifier">args</span>|
|
51
|
+
r, c, ch = *args
|
52
|
+
win.go r,c
|
53
|
+
win.putch(ch)
|
54
|
+
sleep <span class="Constant">0.4</span>
|
55
|
+
<span class="Statement">end</span>
|
56
|
+
|
57
|
+
getch
|
58
|
+
</pre>
|
59
|
+
</body>
|
60
|
+
</html>
|
61
|
+
<!-- vim: set foldmethod=manual : -->
|
data/tutorial/tutorial.html
CHANGED
@@ -21,7 +21,7 @@ Let's start at the beginning with the overused "hello world" example.
|
|
21
21
|
|
22
22
|
<!-- high = 215 hcode = 165 -->
|
23
23
|
<iframe frameborder=0
|
24
|
-
width=
|
24
|
+
width=100% height=215
|
25
25
|
src='wrap-hw.html'>
|
26
26
|
</iframe>
|
27
27
|
<p>
|
@@ -39,7 +39,7 @@ Here's another example.
|
|
39
39
|
|
40
40
|
<!-- high = 277 hcode = 465 -->
|
41
41
|
<iframe frameborder=0
|
42
|
-
width=
|
42
|
+
width=100% height=465
|
43
43
|
src='wrap-stdscr.html'>
|
44
44
|
</iframe>
|
45
45
|
<p>
|
@@ -110,9 +110,9 @@ that will display all 64 possibilities of foreground/background. (Note that curs
|
|
110
110
|
to "cheat" when these two are the same, presumably to preserve legibility.)
|
111
111
|
<p>
|
112
112
|
|
113
|
-
<!-- high = 248 hcode =
|
113
|
+
<!-- high = 248 hcode = 490 -->
|
114
114
|
<iframe frameborder=0
|
115
|
-
width=
|
115
|
+
width=100% height=490
|
116
116
|
src='wrap-colortest.html'>
|
117
117
|
</iframe>
|
118
118
|
<p>
|
@@ -123,13 +123,20 @@ two-dimensional array. Similarly, <tt></tt>= will set characters.
|
|
123
123
|
|
124
124
|
<!-- high = 252 hcode = 509 -->
|
125
125
|
<iframe frameborder=0
|
126
|
-
width=
|
126
|
+
width=100% height=509
|
127
127
|
src='wrap-brackets.html'>
|
128
128
|
</iframe>
|
129
129
|
<p>
|
130
130
|
|
131
|
+
Methods that specify coordinates for points can replace one or more of those coordinates
|
132
|
+
with symbols such as <tt>:top</tt>, <tt>:left</tt>, and <tt>:center</tt>.
|
131
133
|
<p>
|
132
134
|
|
135
|
+
<!-- high = 276 hcode = 619 -->
|
136
|
+
<iframe frameborder=0
|
137
|
+
width=100% height=619
|
138
|
+
src='wrap-sym_nav.html'>
|
139
|
+
</iframe>
|
133
140
|
<p>
|
134
141
|
|
135
142
|
<h3>More later...</h3>
|
data/tutorial/tutorial.lt3
CHANGED
@@ -25,15 +25,15 @@ but it _can be.)
|
|
25
25
|
# hw.png PNG 283x190 283x190+0+0 8-bit sRGB 5443B 0.000u 0:00.000
|
26
26
|
img_data = `identify #{sshot}` # depends on imagemagick
|
27
27
|
wimg, himg = img_data.split[2].split("x")
|
28
|
-
wide = (wimg.to_i * 2).to_i
|
28
|
+
wide = "100%" # (wimg.to_i * 2.4).to_i
|
29
29
|
high = himg.to_i + 25
|
30
30
|
hcode = nlines*ppl.to_i + 25
|
31
31
|
hmax = [high, hcode].max # Code may be longer than screenshot height
|
32
32
|
_puts "<!-- high = #{high} hcode = #{hcode} -->"
|
33
33
|
File.open("wrap-#{arg}.html", "w") do |f|
|
34
|
-
f.puts "<table width=100% cellpadding=2><tr><td width=
|
34
|
+
f.puts "<table width=100% cellpadding=2><tr><td width=65% valign=top>"
|
35
35
|
f.puts code
|
36
|
-
f.puts "</td><td width=
|
36
|
+
f.puts "</td><td width=35% valign=top><img src=#{sshot} valign=top></td></tr></table>"
|
37
37
|
end
|
38
38
|
_puts <<-HTML
|
39
39
|
<iframe frameborder=0
|
@@ -121,14 +121,17 @@ My own environment is iterm on Mac OSX with fairly standard settings. Here is so
|
|
121
121
|
that will display all 64 possibilities of foreground/background. (Note that curses seems
|
122
122
|
to "cheat" when these two are the same, presumably to preserve legibility.)
|
123
123
|
|
124
|
-
.example colortest
|
124
|
+
.example colortest 15
|
125
125
|
|
126
126
|
You can use `[] to retrieve characters from the screen as though it were a
|
127
127
|
two-dimensional array. Similarly, `[]= will set characters.
|
128
128
|
|
129
129
|
.example brackets 22
|
130
130
|
|
131
|
+
Methods that specify coordinates for points can replace one or more of those coordinates
|
132
|
+
with symbols such as ``:top, ``:left, and ``:center.
|
131
133
|
|
134
|
+
.example sym_nav 18
|
132
135
|
|
133
136
|
<h3>More later...</h3>
|
134
137
|
|
data/tutorial/wrap-brackets.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=65% valign=top>
|
2
2
|
<style type="text/css">
|
3
3
|
<!--
|
4
4
|
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
@@ -47,4 +47,4 @@ getch
|
|
47
47
|
</body>
|
48
48
|
</html>
|
49
49
|
<!-- vim: set foldmethod=manual : -->
|
50
|
-
</td><td width=
|
50
|
+
</td><td width=35% valign=top><img src=brackets.png valign=top></td></tr></table>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=65% valign=top>
|
2
2
|
<style type="text/css">
|
3
3
|
<!--
|
4
4
|
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
@@ -56,4 +56,4 @@ getch
|
|
56
56
|
</body>
|
57
57
|
</html>
|
58
58
|
<!-- vim: set foldmethod=manual : -->
|
59
|
-
</td><td width=
|
59
|
+
</td><td width=35% valign=top><img src=colortest.png valign=top></td></tr></table>
|
data/tutorial/wrap-hw.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=65% valign=top>
|
2
2
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
@@ -40,4 +40,4 @@ getch
|
|
40
40
|
</body>
|
41
41
|
</html>
|
42
42
|
<!-- vim: set foldmethod=manual : -->
|
43
|
-
</td><td width=
|
43
|
+
</td><td width=35% valign=top><img src=hw.png valign=top></td></tr></table>
|
data/tutorial/wrap-stdscr.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=65% valign=top>
|
2
2
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
@@ -56,4 +56,4 @@ getch
|
|
56
56
|
</body>
|
57
57
|
</html>
|
58
58
|
<!-- vim: set foldmethod=manual : -->
|
59
|
-
</td><td width=
|
59
|
+
</td><td width=35% valign=top><img src=stdscr.png valign=top></td></tr></table>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<table width=100% cellpadding=2><tr><td width=65% valign=top>
|
2
|
+
<style type="text/css">
|
3
|
+
<!--
|
4
|
+
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
5
|
+
body { font-family: monospace; color: #ffffff; background-color: #000000; }
|
6
|
+
pre { font-size: 15 }
|
7
|
+
tt { font-size: 15 }
|
8
|
+
* { font-size: 1em; }
|
9
|
+
.Constant { color: #ff40ff; }
|
10
|
+
.Special { color: #ffff00; }
|
11
|
+
.Identifier { color: #00ffff; }
|
12
|
+
.Statement { color: #ffff00; }
|
13
|
+
.PreProc { color: #ff40ff; }
|
14
|
+
.Type { color: #00ff00; }
|
15
|
+
-->
|
16
|
+
</style>
|
17
|
+
|
18
|
+
<script type='text/javascript'>
|
19
|
+
<!--
|
20
|
+
|
21
|
+
-->
|
22
|
+
</script>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<pre id='vimCodeElement'>
|
26
|
+
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">rubytext</span><span class="Special">'</span>
|
27
|
+
|
28
|
+
<span class="Type">RubyText</span>.start
|
29
|
+
|
30
|
+
puts <span class="Special">"</span><span class="Special">\n</span><span class="Constant"> Methods such as go, rcprint, and putch</span><span class="Special">"</span>
|
31
|
+
puts <span class="Special">"</span><span class="Constant"> can accept symbols such as</span><span class="Special">"</span>
|
32
|
+
puts <span class="Special">"</span><span class="Constant"> :top :bottom :left :right :center</span><span class="Special">"</span>
|
33
|
+
|
34
|
+
win = <span class="Type">RubyText</span>.window(<span class="Constant">7</span>, <span class="Constant">25</span>, <span class="Constant">r</span>: <span class="Constant">5</span>, <span class="Constant">c</span>: <span class="Constant">10</span>, <span class="Constant">fg</span>: <span class="Type">Red</span>, <span class="Constant">bg</span>: <span class="Type">Black</span>)
|
35
|
+
|
36
|
+
win.putch <span class="Special">"</span><span class="Constant">1</span><span class="Special">"</span>, <span class="Constant">r</span>: <span class="Constant">:bottom</span>, <span class="Constant">c</span>: <span class="Constant">:left</span>
|
37
|
+
sleep <span class="Constant">0.4</span>
|
38
|
+
win.go <span class="Constant">:center</span>, <span class="Constant">:left</span>
|
39
|
+
win.puts <span class="Special">"</span><span class="Constant">abc</span><span class="Special">"</span>
|
40
|
+
sleep <span class="Constant">0.4</span>
|
41
|
+
win.go <span class="Constant">:top</span>, <span class="Constant">:left</span>
|
42
|
+
win.puts <span class="Special">"</span><span class="Constant">def</span><span class="Special">"</span>
|
43
|
+
sleep <span class="Constant">0.4</span>
|
44
|
+
win.rcprint <span class="Constant">:top</span>, <span class="Constant">:center</span>, <span class="Special">"</span><span class="Constant">4</span><span class="Special">"</span>
|
45
|
+
sleep <span class="Constant">0.4</span>
|
46
|
+
|
47
|
+
others = [[<span class="Constant">:top</span>, <span class="Constant">:right</span>, <span class="Special">"</span><span class="Constant">5</span><span class="Special">"</span>], [<span class="Constant">:center</span>, <span class="Constant">:right</span>, <span class="Special">"</span><span class="Constant">6</span><span class="Special">"</span>],
|
48
|
+
[<span class="Constant">:bottom</span>, <span class="Constant">:right</span>, <span class="Special">"</span><span class="Constant">7</span><span class="Special">"</span>], [<span class="Constant">:bottom</span>, <span class="Constant">:center</span>, <span class="Special">"</span><span class="Constant">8</span><span class="Special">"</span>],
|
49
|
+
[<span class="Constant">:center</span>, <span class="Constant">:center</span>, <span class="Special">"</span><span class="Constant">9</span><span class="Special">"</span>]]
|
50
|
+
|
51
|
+
others.each <span class="Statement">do</span> |<span class="Identifier">args</span>|
|
52
|
+
r, c, ch = *args
|
53
|
+
win.go r,c
|
54
|
+
win.putch(ch)
|
55
|
+
sleep <span class="Constant">0.4</span>
|
56
|
+
<span class="Statement">end</span>
|
57
|
+
|
58
|
+
getch
|
59
|
+
</pre>
|
60
|
+
</body>
|
61
|
+
</html>
|
62
|
+
<!-- vim: set foldmethod=manual : -->
|
63
|
+
</td><td width=35% valign=top><img src=sym_nav.png valign=top></td></tr></table>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubytext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.93
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
@@ -105,12 +105,16 @@ files:
|
|
105
105
|
- tutorial/stdscr.png
|
106
106
|
- tutorial/stdscr.rb
|
107
107
|
- tutorial/stdscr.rb.html
|
108
|
+
- tutorial/sym_nav.png
|
109
|
+
- tutorial/sym_nav.rb
|
110
|
+
- tutorial/sym_nav.rb.html
|
108
111
|
- tutorial/tutorial.html
|
109
112
|
- tutorial/tutorial.lt3
|
110
113
|
- tutorial/wrap-brackets.html
|
111
114
|
- tutorial/wrap-colortest.html
|
112
115
|
- tutorial/wrap-hw.html
|
113
116
|
- tutorial/wrap-stdscr.html
|
117
|
+
- tutorial/wrap-sym_nav.html
|
114
118
|
homepage: https://github.com/Hal9000/rubytext
|
115
119
|
licenses:
|
116
120
|
- Ruby
|