runeblog 0.1.79 → 0.1.80
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/standard.tgz +0 -0
- data/lib/liveblog.rb +11 -88
- data/lib/runeblog.rb +22 -106
- data/lib/runeblog_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57d59b2120fa25efd7d1542b31200079497991ae27240e30c936701a3ac1e066
|
4
|
+
data.tar.gz: 3b5c8f7bde8e3ca0c7989406ecca1edb6cc35c6b8ad1b76ea55dd25cddf15f9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1dc62eedd0bca2d772c3363fc0a8565499d4b92911fc3f418cb0b5ab1e2d9eecd44b637040fdb52f424375a13ddf94a71118d1244b9410b61b0aaeff1e98c1c
|
7
|
+
data.tar.gz: 271ba003372c3562aa83f2e1bd84021a4ae333ab2d863fc2473df915d1b667f9303d0c3681ff3156da11fe6f22cf4c0e91f7e255a361b201c8e55e0d9d65c6af
|
data/data/standard.tgz
CHANGED
Binary file
|
data/lib/liveblog.rb
CHANGED
@@ -8,8 +8,6 @@ require 'runeblog'
|
|
8
8
|
errfile = File.new("liveblog.out", "w")
|
9
9
|
STDERR.reopen(errfile)
|
10
10
|
|
11
|
-
# ::Home = Dir.pwd unless defined?(::Home)
|
12
|
-
|
13
11
|
=begin
|
14
12
|
123:def title # side-effect
|
15
13
|
133:def pubdate # side-effect
|
@@ -21,11 +19,19 @@ STDERR.reopen(errfile)
|
|
21
19
|
491:def _post_lookup(postid) # side-effect
|
22
20
|
=end
|
23
21
|
|
22
|
+
def init_liveblog # FIXME - a lot of this logic sucks
|
23
|
+
@blog = $_blog = RuneBlog.new(false)
|
24
|
+
@root = @blog.root
|
25
|
+
@view = @blog.view
|
26
|
+
@view_name = @blog.view.name
|
27
|
+
@vdir = @blog.view.dir
|
28
|
+
@version = RuneBlog::VERSION
|
29
|
+
@theme = @vdir + "/themes/standard/"
|
30
|
+
end
|
31
|
+
|
24
32
|
def post
|
25
33
|
@meta = OpenStruct.new
|
26
34
|
@meta.num = _args[0]
|
27
|
-
# @live = ::Livetext.new
|
28
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
29
35
|
end
|
30
36
|
|
31
37
|
def _view_from_cwd
|
@@ -95,31 +101,6 @@ def inset
|
|
95
101
|
_optional_blank_line
|
96
102
|
end
|
97
103
|
|
98
|
-
### copy_asset
|
99
|
-
|
100
|
-
# def copy_asset(asset)
|
101
|
-
# vdir = @blog.view.dir
|
102
|
-
# return if File.exist?(vdir + "/assets/" + asset)
|
103
|
-
# top = vdir + "/../../assets/"
|
104
|
-
# if File.exist?(top + asset)
|
105
|
-
# system("cp #{top}/#{asset} #{vdir}/assets/#{asset}")
|
106
|
-
# return
|
107
|
-
# end
|
108
|
-
# raise "Can't find #{asset.inspect}"
|
109
|
-
# end
|
110
|
-
|
111
|
-
#############
|
112
|
-
|
113
|
-
def init_liveblog # FIXME - a lot of this logic sucks
|
114
|
-
@blog = $_blog = RuneBlog.new(false)
|
115
|
-
@root = @blog.root
|
116
|
-
@view = @blog.view
|
117
|
-
@view_name = @blog.view.name
|
118
|
-
@vdir = @blog.view.dir
|
119
|
-
@version = RuneBlog::VERSION
|
120
|
-
@theme = @vdir + "/themes/standard/"
|
121
|
-
end
|
122
|
-
|
123
104
|
def _errout(*args)
|
124
105
|
::STDERR.puts *args
|
125
106
|
end
|
@@ -142,8 +123,6 @@ def title # side-effect
|
|
142
123
|
raise "'post' was not called" unless @meta
|
143
124
|
title = @_data.chomp
|
144
125
|
@meta.title = title
|
145
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
146
|
-
# @live.setvar :title, title
|
147
126
|
setvar :title, title
|
148
127
|
_out %[<h1 class="post-title">#{title}</h1><br>]
|
149
128
|
_optional_blank_line
|
@@ -158,7 +137,6 @@ def pubdate # side-effect
|
|
158
137
|
y, m, d = y.to_i, m.to_i, d.to_i
|
159
138
|
@meta.date = ::Date.new(y, m, d)
|
160
139
|
@meta.pubdate = "%04d-%02d-%02d" % [y, m, d]
|
161
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
162
140
|
_optional_blank_line
|
163
141
|
end
|
164
142
|
|
@@ -174,7 +152,6 @@ def tags # side-effect
|
|
174
152
|
raise "'post' was not called" unless @meta
|
175
153
|
_debug "args = #{_args}"
|
176
154
|
@meta.tags = _args.dup || []
|
177
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
178
155
|
_optional_blank_line
|
179
156
|
end
|
180
157
|
|
@@ -182,7 +159,6 @@ def views # side-effect
|
|
182
159
|
raise "'post' was not called" unless @meta
|
183
160
|
_debug "data = #{_args}"
|
184
161
|
@meta.views = _args.dup # + ["main"]
|
185
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
186
162
|
_optional_blank_line
|
187
163
|
end
|
188
164
|
|
@@ -191,13 +167,9 @@ def pin # side-effect
|
|
191
167
|
_debug "data = #{_args}"
|
192
168
|
# verify only already-specified views?
|
193
169
|
@meta.pinned = _args.dup
|
194
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
195
170
|
_optional_blank_line
|
196
171
|
end
|
197
172
|
|
198
|
-
# def liveblog_version
|
199
|
-
# end
|
200
|
-
|
201
173
|
def list
|
202
174
|
_out "<ul>"
|
203
175
|
_body {|line| _out "<li>#{line}</li>" }
|
@@ -221,38 +193,14 @@ def list!
|
|
221
193
|
_optional_blank_line
|
222
194
|
end
|
223
195
|
|
224
|
-
def asset
|
225
|
-
raise "'post' was not called" unless @meta
|
226
|
-
@meta.assets ||= {}
|
227
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
228
|
-
list = _args
|
229
|
-
# For now: copies, doesn't keep record
|
230
|
-
# Later: Add to file and uniq; use in publishing
|
231
|
-
list.each {|asset| copy_asset(asset) }
|
232
|
-
_optional_blank_line
|
233
|
-
end
|
234
|
-
|
235
|
-
def assets
|
236
|
-
raise "'post' was not called" unless @meta
|
237
|
-
@meta.assets ||= []
|
238
|
-
@meta.assets += _body
|
239
|
-
# STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
240
|
-
_optional_blank_line
|
241
|
-
end
|
242
|
-
|
243
196
|
def write_post # side-effect
|
244
197
|
raise "'post' was not called" unless @meta
|
245
|
-
# return
|
246
198
|
save = Dir.pwd
|
247
199
|
@postdir.gsub!(/\/\//, "/") # FIXME unneeded?
|
248
200
|
Dir.mkdir(@postdir) unless Dir.exist?(@postdir) # FIXME remember assets!
|
249
201
|
Dir.chdir(@postdir)
|
250
|
-
STDERR.puts "------ cd into #@postdir"
|
251
202
|
@meta.views = @meta.views.join(" ")
|
252
203
|
@meta.tags = @meta.tags.join(" ") rescue ""
|
253
|
-
# STDERR.puts ">>>> #{__method__}: writing #{@live.body.size} bytes to #{Dir.pwd}/body.txt"
|
254
|
-
# File.write("body.txt", @live.body) # Actually HTML...
|
255
|
-
# p Dir.pwd
|
256
204
|
File.write("teaser.txt", @meta.teaser)
|
257
205
|
|
258
206
|
fields = [:num, :title, :date, :pubdate, :views, :tags]
|
@@ -261,7 +209,6 @@ STDERR.puts "------ cd into #@postdir"
|
|
261
209
|
f2 = File.open(fname2, "w") do |f2|
|
262
210
|
fields.each {|fld| f2.puts "#{fld}: #{@meta.send(fld)}" }
|
263
211
|
end
|
264
|
-
STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
265
212
|
Dir.chdir(save)
|
266
213
|
rescue => err
|
267
214
|
puts "err = #{err}"
|
@@ -271,11 +218,8 @@ end
|
|
271
218
|
def teaser
|
272
219
|
raise "'post' was not called" unless @meta
|
273
220
|
@meta.teaser = _body_text
|
274
|
-
STDERR.puts ">>> #{__method__}: @meta = #{@meta.to_h.inspect}"
|
275
221
|
_out @meta.teaser + "\n"
|
276
222
|
STDERR.puts "TEASER cwd = #{Dir.pwd}"
|
277
|
-
# file = @vdir + "/teaser.txt"
|
278
|
-
# File.write(file, @meta.teaser)
|
279
223
|
# FIXME
|
280
224
|
end
|
281
225
|
|
@@ -291,7 +235,6 @@ def finalize
|
|
291
235
|
@slug = @blog.make_slug(@meta)
|
292
236
|
slug_dir = @slug
|
293
237
|
@postdir = @blog.view.dir + "/posts/#{slug_dir}"
|
294
|
-
STDERR.puts "Got here!"
|
295
238
|
write_post
|
296
239
|
@meta
|
297
240
|
end
|
@@ -342,13 +285,6 @@ class Livetext::Functions
|
|
342
285
|
|
343
286
|
end
|
344
287
|
|
345
|
-
###############
|
346
|
-
|
347
|
-
|
348
|
-
def _var(name) # FIXME later
|
349
|
-
::Livetext::Vars[name] || "[:#{name} is undefined]"
|
350
|
-
end
|
351
|
-
|
352
288
|
def head
|
353
289
|
# Depends on vars: title, desc, host
|
354
290
|
defaults = {}
|
@@ -423,11 +359,8 @@ STDERR.puts "--- inside #main: which = #{which.inspect}"
|
|
423
359
|
case which
|
424
360
|
when "recent_posts"
|
425
361
|
all_teasers
|
426
|
-
when "post" #
|
427
|
-
# _out "<iframe src='./0001-whats-at-stubbs/whats-at-stubbs.html'><iframe>"
|
362
|
+
when "post" # No longer needed??
|
428
363
|
_out %[<iframe style="width: 100vw;height: 100vh;position: relative;" src='whats-at-stubbs.html' width=100% frameborder="0" allowfullscreen></iframe>]
|
429
|
-
# self.data = "post-index.lt3"
|
430
|
-
# _include
|
431
364
|
end
|
432
365
|
_out %[</div>]
|
433
366
|
end
|
@@ -484,12 +417,10 @@ end
|
|
484
417
|
###
|
485
418
|
|
486
419
|
def _find_recent_posts
|
487
|
-
STDERR.puts "--- frp: $FileDir = #{_var(:FileDir)}"
|
488
420
|
@vdir = _var(:FileDir).match(%r[(^.*/views/.*?)/])[1]
|
489
421
|
posts = nil
|
490
422
|
dir_posts = @vdir + "/posts"
|
491
423
|
entries = Dir.entries(dir_posts)
|
492
|
-
STDERR.puts "--- frp: dir_posts = #{dir_posts} ent = #{entries.inspect}"
|
493
424
|
posts = entries.grep(/^\d\d\d\d/).map {|x| dir_posts + "/" + x }
|
494
425
|
posts.select! {|x| File.directory?(x) }
|
495
426
|
# directories that start with four digits
|
@@ -498,7 +429,6 @@ STDERR.puts "--- frp: dir_posts = #{dir_posts} ent = #{entries.inspect}"
|
|
498
429
|
end
|
499
430
|
|
500
431
|
def all_teasers
|
501
|
-
STDERR.puts "-- inside #all_teasers..."
|
502
432
|
open = <<-HTML
|
503
433
|
<section class="posts">
|
504
434
|
HTML
|
@@ -511,7 +441,6 @@ STDERR.puts "-- inside #all_teasers..."
|
|
511
441
|
<head><link rel="stylesheet" href="blog-application.css"></head>
|
512
442
|
<body>
|
513
443
|
HTML
|
514
|
-
# _out open
|
515
444
|
posts = _find_recent_posts
|
516
445
|
wanted = [5, posts.size].min # estimate how many we want?
|
517
446
|
enum = posts.each
|
@@ -522,8 +451,6 @@ STDERR.puts "-- inside #all_teasers..."
|
|
522
451
|
end
|
523
452
|
text << "</body></html>"
|
524
453
|
File.write("recent.html", text)
|
525
|
-
# _out close
|
526
|
-
# _out "<iframe src='./recent.html'><iframe>"
|
527
454
|
_out %[<iframe style="width: 100vw;height: 100vh;position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
|
528
455
|
end
|
529
456
|
|
@@ -556,14 +483,10 @@ def _teaser(slug)
|
|
556
483
|
nslug, aslug, title, date, teaser_text =
|
557
484
|
vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
|
558
485
|
path = vp.path
|
559
|
-
STDERR.puts [">>>>> vp = ", vp].inspect
|
560
486
|
url = "#{path}/#{aslug}.html" # Should be relative to .blogs!! FIXME
|
561
|
-
STDERR.puts [slug, url].inspect
|
562
487
|
date = Date.parse(date)
|
563
488
|
date = date.strftime("%B %e<br>%Y")
|
564
489
|
text = _interpolate(@_post_entry, binding)
|
565
|
-
# File.write("../../../generated/#{slug}.html", text)
|
566
|
-
# _out text
|
567
490
|
text
|
568
491
|
end
|
569
492
|
|
data/lib/runeblog.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#equire 'find'
|
2
1
|
require 'livetext'
|
3
2
|
|
4
3
|
require 'runeblog_version'
|
@@ -9,8 +8,6 @@ require 'view'
|
|
9
8
|
require 'publish'
|
10
9
|
require 'post'
|
11
10
|
|
12
|
-
# ::Home = Dir.pwd unless defined?(::Home)
|
13
|
-
|
14
11
|
###
|
15
12
|
|
16
13
|
class RuneBlog
|
@@ -19,8 +16,6 @@ class RuneBlog
|
|
19
16
|
ConfigFile = "config"
|
20
17
|
GemData = RuneBlog::Path + "/../data"
|
21
18
|
|
22
|
-
# ::Home = Dir.pwd
|
23
|
-
|
24
19
|
make_exception(:FileNotFound, "File $1 was not found")
|
25
20
|
make_exception(:BlogRepoAlreadyExists, "Blog repo $1 already exists")
|
26
21
|
make_exception(:CantAssignView, "$1 is not a view")
|
@@ -51,7 +46,6 @@ class RuneBlog
|
|
51
46
|
raise BlogRepoAlreadyExists if Dir.exist?(root_dir)
|
52
47
|
new_dotfile(root: root_dir, current_view: first_view)
|
53
48
|
create_dir(dir)
|
54
|
-
# New code goes here!
|
55
49
|
Dir.chdir(dir) do
|
56
50
|
create_dir("drafts")
|
57
51
|
create_dir("views")
|
@@ -66,8 +60,7 @@ class RuneBlog
|
|
66
60
|
end
|
67
61
|
|
68
62
|
def initialize(top = true) # at top? always assumes existing blog
|
69
|
-
# Crude - FIXME later -
|
70
|
-
# What views are there? Publishing, etc.
|
63
|
+
# Crude - FIXME later - # What views are there? Publishing, etc.
|
71
64
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
72
65
|
$_blog = self # Dumber still?
|
73
66
|
dir = ""
|
@@ -78,11 +71,11 @@ class RuneBlog
|
|
78
71
|
file = dir.empty? ? ConfigFile : dir + "/" + ConfigFile
|
79
72
|
errmsg = "No config file! file = #{file.inspect} dir = #{Dir.pwd}"
|
80
73
|
raise errmsg unless File.exist?(file)
|
81
|
-
# Hmm. current_view doesn't belong?
|
74
|
+
# Hmm. current_view doesn't belong?
|
82
75
|
@root, @view_name, @editor = read_config(file, :root, :current_view, :editor)
|
76
|
+
|
83
77
|
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
84
78
|
@view_name = md[1] if md
|
85
|
-
# STDERR.puts "---- vname = #@view_name"
|
86
79
|
@views = get_views
|
87
80
|
@view = str2view(@view_name)
|
88
81
|
@sequence = get_sequence
|
@@ -173,7 +166,6 @@ class RuneBlog
|
|
173
166
|
Dir.chdir(vdir)
|
174
167
|
x = RuneBlog::Default
|
175
168
|
create_dir('themes')
|
176
|
-
# create_dir("generated")
|
177
169
|
create_dir('assets')
|
178
170
|
create_dir('posts')
|
179
171
|
|
@@ -183,7 +175,7 @@ class RuneBlog
|
|
183
175
|
pub = "user: xxx\nserver: xxx\ndocroot: xxx\npath: xxx\nproto: xxx\n"
|
184
176
|
dump(pub, "publish")
|
185
177
|
|
186
|
-
# Add to global.lt3 here? FIXME
|
178
|
+
# Add to global.lt3 here? FIXME
|
187
179
|
|
188
180
|
view = RuneBlog::View.new(arg)
|
189
181
|
self.view = view
|
@@ -223,17 +215,12 @@ class RuneBlog
|
|
223
215
|
Dir.chdir(self.view.dir)
|
224
216
|
# change to create_draft ?
|
225
217
|
post = Post.create(title: title, teaser: teaser, body: body, other_views: other_views)
|
226
|
-
puts "cnp: num = #{post.meta.num}"
|
227
218
|
post.edit unless testing
|
228
219
|
post.build
|
229
220
|
meta = post.meta
|
230
221
|
Dir.chdir(save)
|
231
|
-
|
232
|
-
meta.num
|
233
|
-
return meta.num
|
234
|
-
Dir.chdir(save)
|
235
|
-
meta.num = 999
|
236
|
-
meta.num
|
222
|
+
meta.num ||= 999 # ??
|
223
|
+
return meta.num
|
237
224
|
rescue => err
|
238
225
|
puts err
|
239
226
|
puts err.backtrace.join("\n")
|
@@ -268,37 +255,18 @@ return meta.num
|
|
268
255
|
self.view = view # error checking?
|
269
256
|
end
|
270
257
|
|
271
|
-
def
|
272
|
-
raise ArgumentError unless file.is_a?(String)
|
273
|
-
path = @root + "/drafts/#{file}"
|
274
|
-
raise FileNotFound(path) unless File.exist?(path)
|
275
|
-
num = file.to_i # e.g. 0098-this-is-a-title
|
276
|
-
live = Livetext.new # (STDOUT) # (nil)
|
277
|
-
Livetext.parameters = [self, num, live]
|
278
|
-
text = File.read(path)
|
279
|
-
live.process_text(text)
|
280
|
-
rescue => err
|
281
|
-
error(err)
|
282
|
-
getch
|
283
|
-
end
|
284
|
-
|
285
|
-
def generate_index(view)
|
286
|
-
# FIXME
|
258
|
+
def generate_index(view) # FIXME delete?
|
287
259
|
debug "=== generate_index view = #{view.to_s}"
|
288
260
|
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
289
261
|
|
290
262
|
vdir = self.view.dir
|
291
263
|
dir0 = "#{vdir}/themes/standard/blog"
|
292
|
-
# dir1 = "#{vdir}/generated"
|
293
|
-
# system("livetext #{dir0}/generate.lt3 >#{dir1}/index.html 2>#{dir1}/errors.txt")
|
294
264
|
rescue => err
|
295
265
|
error(err)
|
296
266
|
exit
|
297
267
|
end
|
298
268
|
|
299
|
-
|
300
|
-
|
301
|
-
def generate_view(view)
|
269
|
+
def generate_view(view) # huh?
|
302
270
|
end
|
303
271
|
|
304
272
|
def _get_views(draft)
|
@@ -306,7 +274,6 @@ return meta.num
|
|
306
274
|
view_line = File.readlines(draft).grep(/^.views /)
|
307
275
|
raise "More than one .views call!" if view_line.size > 1
|
308
276
|
raise "No .views call!" if view_line.size < 1
|
309
|
-
# STDERR.puts view_line.inspect
|
310
277
|
view_line = view_line.first
|
311
278
|
views = view_line[7..-1].split
|
312
279
|
end
|
@@ -314,18 +281,18 @@ return meta.num
|
|
314
281
|
# Remember: A post in multiple views will trigger multiple
|
315
282
|
# views needing to be rebuilt (and published)
|
316
283
|
|
317
|
-
# generate a post:
|
318
|
-
# given draft 9999-title.lt3
|
319
|
-
# create VIEW/posts/9999-title/index.lt3
|
320
|
-
# LATER: metadata!! or is it in head?
|
321
|
-
# Generate VIEW/posts/9999-title/head.lt3?
|
322
|
-
# livetext draft_wrapper_plain.lt3 >generated/posts/plain-title.html # unframed
|
323
|
-
# livetext draft_generate.lt3 >generated/posts/real-title.html # framed
|
324
|
-
# livetext draft_wrapper_perma.lt3 >generated/posts/perma-title.html # permaframed
|
325
|
-
#
|
326
|
-
# Generate associated views:
|
327
|
-
# livetext ??/recent.lt3 >VIEW/working/recent.html
|
328
|
-
# livetext VIEW/blog/generate.lt3 ??
|
284
|
+
# generate a post:
|
285
|
+
# given draft 9999-title.lt3
|
286
|
+
# create VIEW/posts/9999-title/index.lt3
|
287
|
+
# LATER: metadata!! or is it in head?
|
288
|
+
# Generate VIEW/posts/9999-title/head.lt3?
|
289
|
+
# livetext draft_wrapper_plain.lt3 >generated/posts/plain-title.html # unframed
|
290
|
+
# livetext draft_generate.lt3 >generated/posts/real-title.html # framed
|
291
|
+
# livetext draft_wrapper_perma.lt3 >generated/posts/perma-title.html # permaframed
|
292
|
+
#
|
293
|
+
# Generate associated views:
|
294
|
+
# livetext ??/recent.lt3 >VIEW/working/recent.html
|
295
|
+
# livetext VIEW/blog/generate.lt3 ??
|
329
296
|
|
330
297
|
def _copy_get_dirs(draft, view)
|
331
298
|
fname = File.basename(draft)
|
@@ -345,13 +312,12 @@ return meta.num
|
|
345
312
|
noext, viewdir, slugdir, aslug, theme = _copy_get_dirs(draft, view)
|
346
313
|
Dir.chdir(slugdir) do
|
347
314
|
html = noext[5..-1] + ".html"
|
348
|
-
STDERR.puts "--- NEW gp into #{slugdir}: livetext #{draft} >#{html}"
|
349
315
|
system("livetext #{draft} >#{html}")
|
350
316
|
|
351
317
|
Dir.mkdir("sidebar") unless Dir.exist?("sidebar")
|
352
318
|
system("cp #{theme}/sidebar/*.lt3 ./sidebar/")
|
353
319
|
files = ["blog-generate.lt3", "blog-index.lt3", "global.lt3", "blog-head.lt3",
|
354
|
-
"meta.lt3", "navbar.lt3"]
|
320
|
+
"meta.lt3", "navbar.lt3", "blog-application.css"]
|
355
321
|
files2 = files.map {|x| theme + "/" + x }
|
356
322
|
files2.each do |f|
|
357
323
|
system("cp #{f} .")
|
@@ -365,53 +331,6 @@ STDERR.puts "--- NEW gp into #{slugdir}: livetext #{draft} >#{html}"
|
|
365
331
|
end
|
366
332
|
end
|
367
333
|
|
368
|
-
def old_generate_post(draft)
|
369
|
-
dir = File.dirname(draft)
|
370
|
-
fname = File.basename(draft)
|
371
|
-
# STDERR.puts "--- gp01 dir/fname = #{dir} #{fname}"
|
372
|
-
# FIXME dumb code
|
373
|
-
view_line = File.readlines(draft).grep(/^.views /)
|
374
|
-
raise "More than one .views call!" if view_line.size > 1
|
375
|
-
raise "No .views call!" if view_line.size < 1
|
376
|
-
view_line = view_line.first
|
377
|
-
|
378
|
-
views = view_line[7..-1].split
|
379
|
-
slug_dir = fname.sub(/.lt3$/, "")
|
380
|
-
views.each do |view|
|
381
|
-
vdir = "#@root/views/#{view}"
|
382
|
-
dir = "#{vdir}/posts/#{slug_dir}/"
|
383
|
-
Dir.mkdir(dir) unless Dir.exist?(dir)
|
384
|
-
system("cp #{draft} #{dir}")
|
385
|
-
Dir.chdir(dir) do
|
386
|
-
html = draft.sub(/.lt3$/, ".html")
|
387
|
-
STDERR.puts "--- gp05 into #{dir}: livetext #{draft} >#{html}"
|
388
|
-
system("livetext #{draft} >#{html}")
|
389
|
-
|
390
|
-
# copy from theme?
|
391
|
-
theme = vdir + "/themes/standard"
|
392
|
-
Dir.mkdir("sidebar") unless Dir.exist?("sidebar")
|
393
|
-
system("cp #{theme}/sidebar/*.lt3 ./sidebar/")
|
394
|
-
files = ["blog-generate.lt3", "blog-index.lt3", "global.lt3", "blog-head.lt3",
|
395
|
-
"meta.lt3", "navbar.lt3"]
|
396
|
-
files2 = files.map {|x| theme + "/" + x }
|
397
|
-
# STDERR.puts "---- gp06: In #{Dir.pwd}: files = #{files.inspect}"
|
398
|
-
files2.each do |f|
|
399
|
-
# STDERR.puts "---- gp07: cp #{f} ."
|
400
|
-
system("cp #{f} .")
|
401
|
-
end
|
402
|
-
# STDERR.puts "---- gp08: Files copied from theme"
|
403
|
-
|
404
|
-
system("livetext blog-generate.lt3 >bgen.html")
|
405
|
-
# STDERR.puts "---- gp09: Files went thru livetext"
|
406
|
-
# files.each {|fname| system("rm ./#{fname}") }
|
407
|
-
# system("rm -rf ./sidebar/")
|
408
|
-
end
|
409
|
-
# create framed pure slug (where?)
|
410
|
-
end
|
411
|
-
end
|
412
|
-
|
413
|
-
########
|
414
|
-
|
415
334
|
def relink
|
416
335
|
self.views.each {|view| generate_index(view) }
|
417
336
|
end
|
@@ -437,11 +356,10 @@ STDERR.puts "--- gp05 into #{dir}: livetext #{draft} >#{html}"
|
|
437
356
|
end
|
438
357
|
|
439
358
|
def rebuild_post(file)
|
359
|
+
raise "Doesn't currently work"
|
440
360
|
debug "Called rebuild_post(#{file.inspect})"
|
441
361
|
raise ArgumentError unless file.is_a?(String)
|
442
362
|
meta = process_post(file)
|
443
|
-
# p meta
|
444
|
-
# sleep 4
|
445
363
|
@views_dirty ||= []
|
446
364
|
@views_dirty << meta.views
|
447
365
|
@views_dirty.flatten!
|
@@ -494,8 +412,6 @@ STDERR.puts "--- gp05 into #{dir}: livetext #{draft} >#{html}"
|
|
494
412
|
end
|
495
413
|
|
496
414
|
def make_slug(meta)
|
497
|
-
# check_meta(meta, "makeslug")
|
498
|
-
# meta.num = 9999 # FIXME
|
499
415
|
raise ArgumentError unless meta.title.is_a?(String)
|
500
416
|
label = '%04d' % meta.num # FIXME can do better
|
501
417
|
slug0 = meta.title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
data/lib/runeblog_version.rb
CHANGED