livetext 0.8.11 → 0.8.12
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 +4 -4
- data/lib/formatline.rb +3 -1
- data/lib/functions.rb +8 -5
- data/lib/livetext.rb +1 -1
- data/lib/standard.rb +1 -1
- data/lib/userapi.rb +3 -1
- data/test/data/error_missing_end/source.lt3 +1 -0
- data/test/data/functions/source.lt3 +0 -17
- data/test/sdtest +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b30201fdbfb90ab4042db07a2e2e13b8de01b4e
|
|
4
|
+
data.tar.gz: a7c1883fcd37443c7c2071cb3ca0f6ad96032d81
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9900907abf9f428f946177f7f5a74d396d6d507e00df40595c4edf9165c7ee0b03de1364321f95f4d324ab87265d600a60e5410adc68529b759248c757ae9997
|
|
7
|
+
data.tar.gz: 7fcaba27222d017d48304d77c1ee8f78fd38e11573f5f77be0d1e52d18a62c5db774e423e0d02dedd7792176e1fb9fbc4e6239ef0f2b6c1b5bcc953a51f421f0
|
data/lib/formatline.rb
CHANGED
|
@@ -46,7 +46,8 @@ class FormatLine
|
|
|
46
46
|
|
|
47
47
|
def funcall(name, param)
|
|
48
48
|
fobj = ::Livetext::Functions.new
|
|
49
|
-
|
|
49
|
+
::Livetext::Functions.param = param
|
|
50
|
+
# STDERR.puts "Calling '#{name}' with '#{param}'"
|
|
50
51
|
fobj.send(name)
|
|
51
52
|
end
|
|
52
53
|
|
|
@@ -56,6 +57,7 @@ class FormatLine
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
def fcall
|
|
60
|
+
# puts "Calling funcall: #@name(#@param)"
|
|
59
61
|
@buffer << funcall(@fname, @param)
|
|
60
62
|
@fname, @param = "", ""
|
|
61
63
|
end
|
data/lib/functions.rb
CHANGED
|
@@ -3,11 +3,13 @@ require 'standard' # FIXME
|
|
|
3
3
|
class Livetext::Functions # Functions will go here... user-def AND pre-def??
|
|
4
4
|
Formats = ::Livetext::Standard::SimpleFormats
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
@param = nil
|
|
7
|
+
|
|
8
|
+
def self.param
|
|
9
|
+
@param
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
def param=(str)
|
|
12
|
+
def self.param=(str)
|
|
11
13
|
@param = str
|
|
12
14
|
end
|
|
13
15
|
|
|
@@ -20,9 +22,10 @@ class Livetext::Functions # Functions will go here... user-def AND pre-def??
|
|
|
20
22
|
end
|
|
21
23
|
|
|
22
24
|
def simple_format(*args)
|
|
23
|
-
|
|
25
|
+
param = self.class.param
|
|
26
|
+
param ||= "NO PARAMETER"
|
|
24
27
|
pairs = Formats.values_at(*args)
|
|
25
|
-
str =
|
|
28
|
+
str = param.dup
|
|
26
29
|
pairs.reverse.each do |pair|
|
|
27
30
|
str = "#{pair.first}#{str}#{pair.last}"
|
|
28
31
|
end
|
data/lib/livetext.rb
CHANGED
data/lib/standard.rb
CHANGED
data/lib/userapi.rb
CHANGED
|
@@ -38,6 +38,7 @@ module Livetext::UserAPI
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def _end?(str, sigil=".")
|
|
41
|
+
return false if str.nil?
|
|
41
42
|
cmd = sigil + "end"
|
|
42
43
|
return false if str.index(cmd) != 0
|
|
43
44
|
return false unless _trailing?(str[5])
|
|
@@ -65,6 +66,7 @@ module Livetext::UserAPI
|
|
|
65
66
|
@save_location = @sources.last
|
|
66
67
|
loop do
|
|
67
68
|
@line = nextline
|
|
69
|
+
raise if @line.nil?
|
|
68
70
|
break if _end?(@line, sigil)
|
|
69
71
|
next if _comment?(@line, sigil) # FIXME?
|
|
70
72
|
@line = _formatting(@line) unless raw
|
|
@@ -77,7 +79,7 @@ module Livetext::UserAPI
|
|
|
77
79
|
lines
|
|
78
80
|
end
|
|
79
81
|
rescue => err
|
|
80
|
-
|
|
82
|
+
# FIXME
|
|
81
83
|
_error!("Expecting .end, found end of file")
|
|
82
84
|
end
|
|
83
85
|
|
|
@@ -6,23 +6,6 @@ here...
|
|
|
6
6
|
"Eureka!"
|
|
7
7
|
.end
|
|
8
8
|
|
|
9
|
-
.func sign
|
|
10
|
-
str = @_data
|
|
11
|
-
out = ""
|
|
12
|
-
wide = str.length + 2
|
|
13
|
-
out << " "*4 + "+"
|
|
14
|
-
wide.times { out << "-" }
|
|
15
|
-
out << "\n" + " "*4
|
|
16
|
-
out << "| #{str} |\n"
|
|
17
|
-
out << " "*4 + "+"
|
|
18
|
-
wide.times { out << "-" }
|
|
19
|
-
out << "\n\n "
|
|
20
|
-
STDERR.puts out
|
|
21
|
-
out
|
|
22
|
-
.end
|
|
23
|
-
|
|
24
9
|
I am calling $$myfunc here...
|
|
25
10
|
Let's see
|
|
26
11
|
what happens.
|
|
27
|
-
|
|
28
|
-
Now I'm trying to make $$sign[A SIGN HERE]...
|
data/test/sdtest
ADDED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: livetext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hal Fulton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-04-
|
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A smart text processor extensible in Ruby
|
|
14
14
|
email: rubyhacker@gmail.com
|
|
@@ -124,6 +124,7 @@ files:
|
|
|
124
124
|
- test/data/single_raw_line/expected-output.txt
|
|
125
125
|
- test/data/single_raw_line/source.lt3
|
|
126
126
|
- test/newtest
|
|
127
|
+
- test/sdtest
|
|
127
128
|
- test/test.rb
|
|
128
129
|
- test/try.lt
|
|
129
130
|
- test/try2.lt
|