livetext 0.8.52 → 0.8.53
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/livetext.rb +1 -4
- metadata +1 -2
- data/plugin/old_liveblog.rb +0 -185
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 452960657302e3bbabaeef8cfb43d25111f3658bce430f1ba72756be9043956e
|
4
|
+
data.tar.gz: 50875e429e260ac6e752136b0197d70bbb306f674145de68898f0f975bada12d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53892f72d41965c2c998194d9d58000c712ad3a535fd6449e9eae4ab11e84bec4e38865ff0504d5152425d8e4f99c7226320d60317cace69ade9b2a8fa4ae30d
|
7
|
+
data.tar.gz: 62dd440744dea4d263358486f65f76cb9e09d0dcc71bafed905417739bf0ade10689531154adcede2d5ce44eb670fa8ffebcb512d73aba531c184a7f3d60a3e3
|
data/lib/livetext.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Livetext
|
2
|
-
VERSION = "0.8.
|
2
|
+
VERSION = "0.8.53"
|
3
3
|
Path = File.expand_path(File.join(File.dirname(__FILE__)))
|
4
4
|
end
|
5
5
|
|
@@ -136,7 +136,6 @@ class Livetext
|
|
136
136
|
|
137
137
|
def process_text(text)
|
138
138
|
text = text.split("\n") if text.is_a? String
|
139
|
-
puts "lt-proc_text: text has #{text.size} lines"
|
140
139
|
enum = text.each
|
141
140
|
@backtrace = false
|
142
141
|
@main.source(enum, "(text)", 0)
|
@@ -145,9 +144,7 @@ puts "lt-proc_text: text has #{text.size} lines"
|
|
145
144
|
break if line.nil?
|
146
145
|
process_line(line, context)
|
147
146
|
end
|
148
|
-
puts "lt-proc_text: calling finalize... (pwd = #{Dir.pwd})"
|
149
147
|
val = @main.finalize if @main.respond_to? :finalize
|
150
|
-
puts "lt-proc_text: ...returned from finalize"
|
151
148
|
val
|
152
149
|
rescue => err
|
153
150
|
puts "process_text: err = #{err}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.53
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- plugin/liveblog.rb
|
32
32
|
- plugin/livemagick.rb
|
33
33
|
- plugin/markdown.rb
|
34
|
-
- plugin/old_liveblog.rb
|
35
34
|
- plugin/pyggish.rb
|
36
35
|
- plugin/tutorial.rb
|
37
36
|
- test/affirm/kbks.jpg
|
data/plugin/old_liveblog.rb
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
require 'pp'
|
3
|
-
require 'date'
|
4
|
-
|
5
|
-
require 'runeblog' # Now depends explicitly
|
6
|
-
|
7
|
-
def quote
|
8
|
-
_puts "<blockquote>"
|
9
|
-
_puts _body
|
10
|
-
_puts "</blockquote>"
|
11
|
-
end
|
12
|
-
|
13
|
-
class ::Livetext::Functions # do this differently??
|
14
|
-
|
15
|
-
def asset # FIXME this is baloney...
|
16
|
-
param = ::Livetext::Functions.param
|
17
|
-
context = ::Livetext::Functions.context
|
18
|
-
main = context.eval("@main") rescue "NO MAIN?"
|
19
|
-
@meta = main.instance_eval("@main.instance_eval { @meta }")
|
20
|
-
@config = main.instance_eval("@main.instance_eval { @config }")
|
21
|
-
@root = @config.root
|
22
|
-
|
23
|
-
text, name = param.split("|")
|
24
|
-
|
25
|
-
# FIXME how should this work?
|
26
|
-
view = @blog.view
|
27
|
-
url = find_asset(name)
|
28
|
-
"<a href='#{url}'>#{text}</a>"
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
begin
|
35
|
-
ThisBlog
|
36
|
-
rescue
|
37
|
-
ThisBlog = RuneBlog.new
|
38
|
-
# ThisConfig = ThisBlog.open_blog
|
39
|
-
end
|
40
|
-
|
41
|
-
### find_asset
|
42
|
-
|
43
|
-
def find_asset(asset)
|
44
|
-
views = @config.views
|
45
|
-
views.each do |view|
|
46
|
-
vdir = @config.viewdir(view)
|
47
|
-
post_dir = "#{vdir}#{@meta.slug}/assets/"
|
48
|
-
path = post_dir + asset
|
49
|
-
STDERR.puts " Seeking #{path}"
|
50
|
-
return path if File.exist?(path)
|
51
|
-
end
|
52
|
-
views.each do |view|
|
53
|
-
dir = @config.viewdir(view) + "/assets/"
|
54
|
-
path = dir + asset
|
55
|
-
STDERR.puts " Seeking #{path}"
|
56
|
-
return path if File.exist?(path)
|
57
|
-
end
|
58
|
-
top = @root + "/assets/"
|
59
|
-
path = top + asset
|
60
|
-
STDERR.puts " Seeking #{path}"
|
61
|
-
return path if File.exist?(path)
|
62
|
-
|
63
|
-
return nil
|
64
|
-
end
|
65
|
-
|
66
|
-
#############
|
67
|
-
|
68
|
-
def init_liveblog # FIXME - a lot of this logic sucks
|
69
|
-
@blog = ThisBlog
|
70
|
-
@config = ThisBlog
|
71
|
-
@root = @config.root
|
72
|
-
@title = ""
|
73
|
-
@teaser = ""
|
74
|
-
@body = ""
|
75
|
-
@body = ""
|
76
|
-
@meta = ::OpenStruct.new
|
77
|
-
|
78
|
-
@publish ||= {}
|
79
|
-
@config.views.each do |view|
|
80
|
-
publish = @config.viewdir(view) + "publish"
|
81
|
-
raise "File '#{publish}' not found" unless File.exist?(publish)
|
82
|
-
lines = File.readlines(publish).map {|x| x.chomp }
|
83
|
-
@publish[view] = lines
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def _errout(*args)
|
88
|
-
::STDERR.puts *args
|
89
|
-
end
|
90
|
-
|
91
|
-
def _passthru(line, context = nil)
|
92
|
-
return if line.nil?
|
93
|
-
@body << "<p>" if line == "\n" and ! @_nopara
|
94
|
-
line = _formatting(line, context)
|
95
|
-
@body << line + "\n"
|
96
|
-
end
|
97
|
-
|
98
|
-
def title
|
99
|
-
@meta.title = @_data
|
100
|
-
@body << "<h1>#{@meta.title}</h1>"
|
101
|
-
end
|
102
|
-
|
103
|
-
def pubdate
|
104
|
-
_debug "data = #@_data"
|
105
|
-
match = /(\d{4}).(\d{2}).(\d{2})/.match @_data
|
106
|
-
junk, y, m, d = match.to_a
|
107
|
-
y, m, d = y.to_i, m.to_i, d.to_i
|
108
|
-
@meta.date = ::Date.new(y, m, d)
|
109
|
-
@meta.pubdate = "%04d-%02d-%02d" % [y, m, d]
|
110
|
-
end
|
111
|
-
|
112
|
-
def image # primitive so far
|
113
|
-
_debug "img: huh? <img src=#{_args.first}></img>"
|
114
|
-
fname = _args.first
|
115
|
-
path = "assets/#{fname}"
|
116
|
-
@body << "<img src=#{path}></img>"
|
117
|
-
end
|
118
|
-
|
119
|
-
def tags
|
120
|
-
_debug "args = #{_args}"
|
121
|
-
@meta.tags = _args
|
122
|
-
end
|
123
|
-
|
124
|
-
def views
|
125
|
-
_debug "data = #{_args}"
|
126
|
-
@meta.views = _args.dup # + ["main"]
|
127
|
-
end
|
128
|
-
|
129
|
-
def pin
|
130
|
-
_debug "data = #{_args}"
|
131
|
-
# verify only already-specified views?
|
132
|
-
@meta.pinned = _args.dup
|
133
|
-
end
|
134
|
-
|
135
|
-
# def liveblog_version
|
136
|
-
# end
|
137
|
-
|
138
|
-
def list
|
139
|
-
@body << "<ul>"
|
140
|
-
_body {|line| @body << "<li>#{line}</li>" }
|
141
|
-
@body << "</ul>"
|
142
|
-
end
|
143
|
-
|
144
|
-
def list!
|
145
|
-
@body << "<ul>"
|
146
|
-
lines = _body.each # {|line| @body << "<li>#{line}</li>" }
|
147
|
-
loop do
|
148
|
-
line = lines.next
|
149
|
-
line = _formatting(line)
|
150
|
-
if line[0] == " "
|
151
|
-
@body << line
|
152
|
-
else
|
153
|
-
@body << "<li>#{line}</li>"
|
154
|
-
end
|
155
|
-
end
|
156
|
-
@body << "</ul>"
|
157
|
-
end
|
158
|
-
|
159
|
-
def asset
|
160
|
-
@meta.assets ||= {}
|
161
|
-
list = _args
|
162
|
-
list.each {|asset| @meta.assets[asset] = find_asset(asset) }
|
163
|
-
# STDERR.puts red("\n [DEBUG] ") + "Asset(s): #{@meta.assets}"
|
164
|
-
end
|
165
|
-
|
166
|
-
def assets
|
167
|
-
@meta.assets ||= []
|
168
|
-
@meta.assets += _body
|
169
|
-
# STDERR.puts red("\n [DEBUG] ") + "Assets: #{_body.inspect}"
|
170
|
-
end
|
171
|
-
|
172
|
-
def finalize
|
173
|
-
@meta.body = @body
|
174
|
-
File.open("/tmp/lblog.txt", "w") do |f|
|
175
|
-
f.puts
|
176
|
-
f.puts @meta.inspect
|
177
|
-
end
|
178
|
-
@meta
|
179
|
-
end
|
180
|
-
|
181
|
-
def teaser
|
182
|
-
@meta.teaser = _body_text
|
183
|
-
@body << @meta.teaser + "\n"
|
184
|
-
# FIXME
|
185
|
-
end
|