livetext 0.8.44 → 0.8.45
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/livetext.rb +22 -19
- data/lib/standard.rb +1 -1
- data/plugin/liveblog.rb +11 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c1b90db53faea8df11c07499ca77bc7b077cfe2fc4867871c0b88d8f1672490
|
4
|
+
data.tar.gz: 05e540d23ed3b440310adfe6e435649750726d7b098d00ff32397953a98c7d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89f9ca4b5247b2baa3ac877e22f6512ba21fbd54f003624f243f0628399f590a30624c92fbb367516b2f087fe76b1e73e8dbbc5f0a38f4f8619d10b91a5faf9e
|
7
|
+
data.tar.gz: a8725687b4da2a9f5acd5c036aef107e62040923662d2eebf417075478eab8f5e2cb901a2b801df1b8a52ff5c6caa4f1c959f8a6d2c440ffd7e898357eaa9563
|
data/lib/livetext.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Livetext
|
2
|
-
VERSION = "0.8.
|
2
|
+
VERSION = "0.8.45"
|
3
3
|
end
|
4
4
|
|
5
5
|
$Livetext = Livetext
|
@@ -24,6 +24,10 @@ class Livetext
|
|
24
24
|
|
25
25
|
attr_reader :main, :context
|
26
26
|
|
27
|
+
class << self
|
28
|
+
attr_accessor :parameters # from outside world (process_text)
|
29
|
+
end
|
30
|
+
|
27
31
|
class Processor
|
28
32
|
include Livetext::Standard
|
29
33
|
include Livetext::UserAPI
|
@@ -41,10 +45,6 @@ class Livetext
|
|
41
45
|
:enum_for, :pretty_inspect, :==, :equal?, :!, :!=, :instance_eval,
|
42
46
|
:instance_exec, :__send__, :__id__, :__binding__]
|
43
47
|
|
44
|
-
class << self
|
45
|
-
attr_accessor :parameters # from outside world (process_text)
|
46
|
-
end
|
47
|
-
|
48
48
|
def initialize(parent, output = nil)
|
49
49
|
@parent = parent
|
50
50
|
@_nopass = false
|
@@ -60,7 +60,8 @@ class Livetext
|
|
60
60
|
def _error!(err, abort=true, trace=false)
|
61
61
|
where = @sources.last || @save_location
|
62
62
|
STDERR.puts "Error: #{err} (at #{where[1]} line #{where[2]})"
|
63
|
-
|
63
|
+
# STDERR.puts err.backtrace if @backtrace && err.respond_to?(:backtrace)
|
64
|
+
STDERR.puts err.backtrace if err.respond_to?(:backtrace)
|
64
65
|
exit if abort
|
65
66
|
end
|
66
67
|
|
@@ -123,12 +124,21 @@ class Livetext
|
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|
126
|
-
def
|
127
|
+
def process(text)
|
128
|
+
enum = text.each_line
|
129
|
+
@main.source(enum, "STDIN", 0)
|
130
|
+
loop do
|
131
|
+
line = @main.nextline
|
132
|
+
break if line.nil?
|
133
|
+
process_line(line)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def process_text(text)
|
127
138
|
text = text.split("\n") if text.is_a? String
|
128
139
|
enum = text.each
|
129
140
|
@backtrace = false
|
130
|
-
@main.source(enum,
|
131
|
-
Livetext.parameters = args # e.g., for liveblog
|
141
|
+
@main.source(enum, "(text)", 0)
|
132
142
|
loop do
|
133
143
|
line = @main.nextline
|
134
144
|
break if line.nil?
|
@@ -136,6 +146,9 @@ class Livetext
|
|
136
146
|
end
|
137
147
|
val = @main.finalize if @main.respond_to? :finalize
|
138
148
|
val
|
149
|
+
rescue => err
|
150
|
+
puts "process_text: err = #{err}"
|
151
|
+
puts err.backtrace.join("\n")
|
139
152
|
end
|
140
153
|
|
141
154
|
def process_file(fname, context=nil)
|
@@ -168,16 +181,6 @@ class Livetext
|
|
168
181
|
@main.finalize if @main.respond_to? :finalize
|
169
182
|
end
|
170
183
|
|
171
|
-
def process(text)
|
172
|
-
enum = text.each_line
|
173
|
-
@main.source(enum, "STDIN", 0)
|
174
|
-
loop do
|
175
|
-
line = @main.nextline
|
176
|
-
break if line.nil?
|
177
|
-
process_line(line)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
184
|
def rx(str, space=nil)
|
182
185
|
Regexp.compile("^" + Regexp.escape(str) + "#{space}")
|
183
186
|
end
|
data/lib/standard.rb
CHANGED
data/plugin/liveblog.rb
CHANGED
@@ -13,6 +13,7 @@ end
|
|
13
13
|
class ::Livetext::Functions # do this differently??
|
14
14
|
|
15
15
|
def asset # FIXME this is baloney...
|
16
|
+
raise "meh"
|
16
17
|
param = ::Livetext::Functions.param
|
17
18
|
context = ::Livetext::Functions.context
|
18
19
|
main = context.eval("@main") rescue "NO MAIN?"
|
@@ -33,6 +34,7 @@ end
|
|
33
34
|
### find_asset
|
34
35
|
|
35
36
|
def find_asset(asset)
|
37
|
+
raise "meh2"
|
36
38
|
views = @config.views
|
37
39
|
views.each do |view|
|
38
40
|
vdir = @config.viewdir(view)
|
@@ -59,14 +61,15 @@ end
|
|
59
61
|
|
60
62
|
def init_liveblog # FIXME - a lot of this logic sucks
|
61
63
|
@blog, @meta = Livetext.parameters
|
62
|
-
|
63
|
-
@root = @
|
64
|
+
puts "init: #{[@blog, @meta].inspect}"
|
65
|
+
@root = @blog.root
|
64
66
|
@view = @blog.view.name
|
65
67
|
@vdir = @blog.view.dir
|
66
|
-
@title, @teaser = meta.title, meta.teaser
|
68
|
+
@title, @teaser = @meta.title, @meta.teaser
|
67
69
|
@body = ""
|
68
|
-
@slug = @blog.make_slug(meta)
|
70
|
+
@slug = @blog.make_slug(@meta)
|
69
71
|
@postdir = @blog.view.dir + "/#@slug"
|
72
|
+
puts "postdir = #{@postdir.inspect}"
|
70
73
|
|
71
74
|
# @publish ||= {}
|
72
75
|
# @config.views.each do |view|
|
@@ -89,8 +92,7 @@ def _passthru(line, context = nil)
|
|
89
92
|
end
|
90
93
|
|
91
94
|
def title
|
92
|
-
title = @_data
|
93
|
-
raise "Title discrepancy? Found #{title.inspect} != #{@title.inspect}"
|
95
|
+
title = @_data.chomp
|
94
96
|
@body << "<h1>#@title</h1>"
|
95
97
|
end
|
96
98
|
|
@@ -165,11 +167,12 @@ def assets
|
|
165
167
|
end
|
166
168
|
|
167
169
|
def write_post(meta)
|
170
|
+
puts "\npostdir = #{@postdir.inspect}\n "
|
168
171
|
save = Dir.pwd
|
169
172
|
Dir.chdir(@postdir)
|
170
173
|
meta.views = meta.views.join(" ")
|
171
174
|
meta.tags = meta.tags.join(" ")
|
172
|
-
File.write("
|
175
|
+
File.write("body.txt", @body) # Actually HTML...
|
173
176
|
File.write("teaser.txt", meta.teaser)
|
174
177
|
|
175
178
|
fields = [:num, :title, :date, :pubdate, :views, :tags]
|
@@ -189,5 +192,6 @@ end
|
|
189
192
|
|
190
193
|
def finalize
|
191
194
|
write_post(@meta) # FIXME
|
195
|
+
@meta
|
192
196
|
end
|
193
197
|
|
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.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A smart text processor extensible in Ruby
|
14
14
|
email: rubyhacker@gmail.com
|