runeblog 0.2.42 → 0.2.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blog +4 -7
- data/empty_view/assets/austin-pano.jpg +0 -0
- data/empty_view/themes/standard/blog/generate.lt3 +5 -3
- data/empty_view/themes/standard/blog/post_entry.lt3 +11 -10
- data/empty_view/themes/standard/etc/blog.css.lt3 +18 -0
- data/empty_view/themes/standard/navbar/faq.lt3 +1 -0
- data/empty_view/themes/standard/navbar/navbar.lt3 +1 -0
- data/empty_view/themes/standard/post/generate.lt3 +5 -4
- data/empty_view/themes/standard/widgets/ad/ad.lt3 +8 -1
- data/empty_view/themes/standard/widgets/ad/ad1.png +0 -0
- data/empty_view/themes/standard/widgets/ad/ad2.png +0 -0
- data/empty_view/themes/standard/widgets/ad/ad3.png +0 -0
- data/empty_view/themes/standard/widgets/ad/ad4.png +0 -0
- data/empty_view/themes/standard/widgets/bydates/bydates.rb +7 -3
- data/empty_view/themes/standard/widgets/links/links.rb +28 -3
- data/empty_view/themes/standard/widgets/news/news.rb +7 -3
- data/empty_view/themes/standard/widgets/pages/pages.rb +10 -3
- data/empty_view/themes/standard/widgets/pinned/pinned.rb +7 -3
- data/empty_view/themes/standard/widgets/search/search.rb +7 -3
- data/empty_view/themes/standard/widgets/sitemap/sitemap.rb +7 -3
- data/empty_view/themes/standard/widgets/tag-cloud/tag-cloud.rb +7 -3
- data/lib/default.rb +1 -1
- data/lib/global.rb +15 -40
- data/lib/helpers-blog.rb +15 -44
- data/lib/liveblog.rb +92 -56
- data/lib/logging.rb +17 -8
- data/lib/post.rb +7 -10
- data/lib/publish.rb +4 -5
- data/lib/repl.rb +2 -6
- data/lib/runeblog.rb +58 -71
- data/lib/runeblog_version.rb +1 -1
- data/lib/view.rb +2 -9
- data/lib/xlate.rb +35 -35
- data/test/austin.rb +29 -20
- metadata +8 -5
- data/empty_view/remote/widgets/links/list.data +0 -3
- data/empty_view/remote/widgets/news/list.data +0 -4
- data/empty_view/remote/widgets/pages/list.data +0 -4
data/lib/publish.rb
CHANGED
@@ -21,29 +21,28 @@ class RuneBlog::Publishing
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def to_h
|
24
|
-
log!(enter: __method__)
|
24
|
+
log!(enter: __method__, level: 3)
|
25
25
|
{user: @user, server: @server, docroot: @docroot,
|
26
26
|
path: @path, proto: @proto}
|
27
27
|
end
|
28
28
|
|
29
29
|
def url
|
30
|
-
log!(enter: __method__)
|
30
|
+
log!(enter: __method__, level: 3)
|
31
31
|
vname = @blog.view.name # .gsub(/_/, "\\_")
|
32
32
|
url = "#@proto://#@server/#@path" # /#{vname}"
|
33
33
|
end
|
34
34
|
|
35
35
|
def system!(str)
|
36
|
-
log!(enter: __method__, args: [str])
|
36
|
+
log!(enter: __method__, args: [str], level: 1)
|
37
37
|
rc = system(str)
|
38
38
|
rc
|
39
39
|
end
|
40
40
|
|
41
41
|
def publish(files, assets=[])
|
42
|
-
log!(enter: __method__, args: [files, assets])
|
42
|
+
log!(enter: __method__, args: [files, assets], level: 1)
|
43
43
|
dir = @docroot/@path
|
44
44
|
view_name = @blog.view.name
|
45
45
|
viewpath = dir # /view_name
|
46
|
-
# result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}")
|
47
46
|
result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}/assets")
|
48
47
|
files.each do |file|
|
49
48
|
dest = "#@user@#@server:" + dir # /view_name
|
data/lib/repl.rb
CHANGED
@@ -7,7 +7,6 @@ make_exception(:PublishError, "Error during publishing")
|
|
7
7
|
make_exception(:EditorProblem, "Could not edit $1")
|
8
8
|
|
9
9
|
module RuneBlog::REPL
|
10
|
-
|
11
10
|
def edit_file(file)
|
12
11
|
result = system!("#{@blog.editor} #{file}")
|
13
12
|
raise EditorProblem(file) unless result
|
@@ -144,6 +143,7 @@ module RuneBlog::REPL
|
|
144
143
|
check_empty(arg)
|
145
144
|
puts unless testing
|
146
145
|
@blog.generate_view(@blog.view)
|
146
|
+
@blog.generate_index(@blog.view)
|
147
147
|
@out
|
148
148
|
end
|
149
149
|
|
@@ -199,7 +199,6 @@ module RuneBlog::REPL
|
|
199
199
|
end
|
200
200
|
|
201
201
|
def cmd_remove_post(arg, testing = false)
|
202
|
-
puts "arg = #{arg.inspect} is a #{arg.class}"
|
203
202
|
reset_output
|
204
203
|
args = arg.split
|
205
204
|
args.each do |x|
|
@@ -211,14 +210,12 @@ puts "arg = #{arg.inspect} is a #{arg.class}"
|
|
211
210
|
@out
|
212
211
|
end
|
213
212
|
|
214
|
-
#-- FIXME affects linking, building, publishing...
|
215
|
-
|
216
213
|
def cmd_edit_post(arg, testing = false)
|
217
214
|
reset_output
|
218
215
|
id = get_integer(arg)
|
219
216
|
# Simplify this
|
220
217
|
tag = "#{'%04d' % id}"
|
221
|
-
files = Find.find(@blog.root+"/drafts").to_a
|
218
|
+
files = ::Find.find(@blog.root+"/drafts").to_a
|
222
219
|
files = files.grep(/#{tag}-.*lt3/)
|
223
220
|
files = files.map {|f| File.basename(f) }
|
224
221
|
if files.size > 1
|
@@ -384,6 +381,5 @@ puts "arg = #{arg.inspect} is a #{arg.class}"
|
|
384
381
|
puts unless testing
|
385
382
|
@out
|
386
383
|
end
|
387
|
-
|
388
384
|
end
|
389
385
|
|
data/lib/runeblog.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'date'
|
2
|
+
require 'find'
|
2
3
|
|
3
4
|
require 'logging'
|
4
5
|
|
@@ -53,7 +54,7 @@ class RuneBlog
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def self.create(root = ".blogs")
|
56
|
-
log!(enter: __method__, args: [root])
|
57
|
+
log!(enter: __method__, args: [root], level: 1)
|
57
58
|
# Crude - FIXME later - # What views are there? Publishing, etc.
|
58
59
|
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
59
60
|
root = Dir.pwd/root
|
@@ -63,7 +64,6 @@ class RuneBlog
|
|
63
64
|
create_dirs(:drafts, :views, :posts)
|
64
65
|
new_sequence
|
65
66
|
end
|
66
|
-
# put_config(root: root)
|
67
67
|
x = OpenStruct.new
|
68
68
|
x.root, x.current_view, x.editor = root, "test_view", "/usr/bin/vim " # dumb - FIXME later
|
69
69
|
write_config(x, root/ConfigFile)
|
@@ -101,7 +101,7 @@ class RuneBlog
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def _deploy_local(dir)
|
104
|
-
log!(enter: __method__, args: [dir])
|
104
|
+
log!(enter: __method__, args: [dir], level: 1)
|
105
105
|
Dir.chdir(dir) do
|
106
106
|
views = _retrieve_metadata(:views)
|
107
107
|
views.each {|v| system!("cp *html #@root/views/#{v}/remote") }
|
@@ -132,7 +132,7 @@ class RuneBlog
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def process_post(sourcefile)
|
135
|
-
log!(enter: __method__, args: [dir])
|
135
|
+
log!(enter: __method__, args: [dir], level: 2)
|
136
136
|
nslug = sourcefile.sub(/.lt3/, "")
|
137
137
|
dir = @root/:posts/nslug
|
138
138
|
create_dir(dir)
|
@@ -141,7 +141,7 @@ class RuneBlog
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def inspect
|
144
|
-
log!(enter: __method__)
|
144
|
+
log!(enter: __method__, level: 3)
|
145
145
|
str = "blog: "
|
146
146
|
ivars = ["@root", "@sequence"] # self.instance_variables
|
147
147
|
ivars.each do |iv|
|
@@ -152,30 +152,30 @@ class RuneBlog
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def view?(name)
|
155
|
-
log!(enter: __method__, args: [name])
|
155
|
+
log!(enter: __method__, args: [name], level: 3)
|
156
156
|
raise ArgumentError unless name.is_a?(String) && ! name.empty?
|
157
157
|
views.any? {|x| x.name == name }
|
158
158
|
end
|
159
159
|
|
160
160
|
def view(name = nil)
|
161
|
-
log!(enter: __method__, args: [name])
|
161
|
+
log!(enter: __method__, args: [name], level: 3)
|
162
162
|
raise ArgumentError unless name.nil? || (name.is_a?(String) && ! name.empty?)
|
163
163
|
name.nil? ? @view : str2view(name)
|
164
164
|
end
|
165
165
|
|
166
166
|
def str2view(str)
|
167
|
-
log!(enter: __method__, args: [str])
|
167
|
+
log!(enter: __method__, args: [str], level: 3)
|
168
168
|
raise ArgumentError unless str.is_a?(String) && ! str.empty?
|
169
169
|
@views.find {|x| x.name == str }
|
170
170
|
end
|
171
171
|
|
172
172
|
def _set_publisher
|
173
|
-
log!(enter: __method__)
|
173
|
+
log!(enter: __method__, level: 3)
|
174
174
|
@view.publisher = RuneBlog::Publishing.new(@view.to_s) # FIXME refactor
|
175
175
|
end
|
176
176
|
|
177
177
|
def view=(arg)
|
178
|
-
log!(enter: __method__, args: [arg])
|
178
|
+
log!(enter: __method__, args: [arg], level: 2)
|
179
179
|
case arg
|
180
180
|
when RuneBlog::View
|
181
181
|
@view = arg
|
@@ -191,19 +191,19 @@ class RuneBlog
|
|
191
191
|
end
|
192
192
|
|
193
193
|
def get_sequence
|
194
|
-
log!(enter: __method__)
|
194
|
+
log!(enter: __method__, level: 3)
|
195
195
|
File.read(@root/:sequence).to_i
|
196
196
|
end
|
197
197
|
|
198
198
|
def next_sequence
|
199
|
-
log!(enter: __method__)
|
199
|
+
log!(enter: __method__, level: 3)
|
200
200
|
@sequence += 1
|
201
201
|
dump(@sequence, @root/:sequence)
|
202
202
|
@sequence
|
203
203
|
end
|
204
204
|
|
205
205
|
def viewdir(v = nil) # delete?
|
206
|
-
log!(enter: __method__, args: [v])
|
206
|
+
log!(enter: __method__, args: [v], level: 3)
|
207
207
|
v = str2view(v) if v.is_a?(String)
|
208
208
|
raise ArgumentError unless v.nil? || v.is_a?(RuneBlog::View)
|
209
209
|
v ||= @view
|
@@ -211,17 +211,17 @@ class RuneBlog
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def self.exist?
|
214
|
-
log!(enter: __method__)
|
214
|
+
log!(enter: __method__, level: 3)
|
215
215
|
Dir.exist?(DotDir) && File.exist?(DotDir/ConfigFile)
|
216
216
|
end
|
217
217
|
|
218
218
|
def mark_last_published(str)
|
219
|
-
log!(enter: __method__, args: [str])
|
219
|
+
log!(enter: __method__, args: [str], level: 2)
|
220
220
|
dump(str, "#{self.view.dir}/last_published")
|
221
221
|
end
|
222
222
|
|
223
223
|
def add_view(view_name)
|
224
|
-
log!(enter: __method__, args: [view_name])
|
224
|
+
log!(enter: __method__, args: [view_name], level: 2)
|
225
225
|
view = RuneBlog::View.new(view_name)
|
226
226
|
@view = view # current view
|
227
227
|
@views << view # all views
|
@@ -229,7 +229,7 @@ class RuneBlog
|
|
229
229
|
end
|
230
230
|
|
231
231
|
def make_empty_view_tree(view_name)
|
232
|
-
log!(enter: __method__, args: [view_name])
|
232
|
+
log!(enter: __method__, args: [view_name], level: 2)
|
233
233
|
Dir.chdir(@root) do
|
234
234
|
cmd = "cp -r #{RuneBlog::Path}/../empty_view views/#{view_name}"
|
235
235
|
system!(cmd)
|
@@ -237,7 +237,7 @@ class RuneBlog
|
|
237
237
|
end
|
238
238
|
|
239
239
|
def check_valid_new_view(view_name)
|
240
|
-
log!(enter: __method__, args: [view_name])
|
240
|
+
log!(enter: __method__, args: [view_name], level: 3)
|
241
241
|
raise ArgumentError unless view_name.is_a?(String)
|
242
242
|
raise ArgumentError if view_name.empty?
|
243
243
|
names = self.views.map(&:to_s)
|
@@ -249,7 +249,7 @@ class RuneBlog
|
|
249
249
|
end
|
250
250
|
|
251
251
|
def create_view(view_name)
|
252
|
-
log!(enter: __method__, args: [view_name])
|
252
|
+
log!(enter: __method__, args: [view_name], level: 2)
|
253
253
|
check_valid_new_view(view_name)
|
254
254
|
make_empty_view_tree(view_name)
|
255
255
|
add_view(view_name)
|
@@ -267,7 +267,7 @@ class RuneBlog
|
|
267
267
|
end
|
268
268
|
|
269
269
|
def view_files
|
270
|
-
log!(enter: __method__)
|
270
|
+
log!(enter: __method__, level: 2)
|
271
271
|
vdir = self.view.dir
|
272
272
|
files = [vdir/"index.html"]
|
273
273
|
files += posts.map {|x| vdir/x }
|
@@ -275,7 +275,7 @@ class RuneBlog
|
|
275
275
|
end
|
276
276
|
|
277
277
|
def post_lookup(postid) # side-effect?
|
278
|
-
log!(enter: __method__, args: [postid])
|
278
|
+
log!(enter: __method__, args: [postid], level: 2)
|
279
279
|
slug = title = date = teaser_text = nil
|
280
280
|
|
281
281
|
dir_posts = @vdir/:posts
|
@@ -290,7 +290,7 @@ class RuneBlog
|
|
290
290
|
end
|
291
291
|
|
292
292
|
def index_entry(slug)
|
293
|
-
log!(enter: __method__, args: [slug])
|
293
|
+
log!(enter: __method__, args: [slug], level: 2)
|
294
294
|
id = slug.to_i
|
295
295
|
text = nil
|
296
296
|
@theme = @view.dir/"themes/standard"
|
@@ -309,7 +309,7 @@ class RuneBlog
|
|
309
309
|
end
|
310
310
|
|
311
311
|
def collect_recent_posts(file)
|
312
|
-
log!(enter: __method__, args: [file])
|
312
|
+
log!(enter: __method__, args: [file], level: 3)
|
313
313
|
posts = nil
|
314
314
|
dir_posts = @vdir/:posts
|
315
315
|
entries = Dir.entries(dir_posts)
|
@@ -334,12 +334,13 @@ class RuneBlog
|
|
334
334
|
File.write(@vdir/:remote/file, text)
|
335
335
|
end
|
336
336
|
|
337
|
-
def create_new_post(title, testing = false, teaser: nil, body: nil,
|
338
|
-
|
337
|
+
def create_new_post(title, testing = false, teaser: nil, body: nil,
|
338
|
+
pubdate: Time.now.strftime("%Y-%m-%d"), views: [])
|
339
|
+
log!(enter: __method__, args: [title, testing, teaser, body, views], level: 1)
|
339
340
|
meta = nil
|
340
341
|
views = views + [self.view.to_s]
|
341
342
|
Dir.chdir(@root/:posts) do
|
342
|
-
post = Post.create(title: title, teaser: teaser, body: body, views: views)
|
343
|
+
post = Post.create(title: title, teaser: teaser, body: body, pubdate: pubdate, views: views)
|
343
344
|
post.edit unless testing
|
344
345
|
post.build
|
345
346
|
meta = post.meta
|
@@ -351,7 +352,7 @@ class RuneBlog
|
|
351
352
|
end
|
352
353
|
|
353
354
|
def edit_initial_post(file, testing = false)
|
354
|
-
log!(enter: __method__, args: [file, testing])
|
355
|
+
log!(enter: __method__, args: [file, testing], level: 3)
|
355
356
|
debug "=== edit_initial_post #{file.inspect} => #{sourcefile}"
|
356
357
|
sourcefile = @root/:drafts/file
|
357
358
|
result = system!("#@editor #{sourcefile} +8") unless testing
|
@@ -363,20 +364,20 @@ class RuneBlog
|
|
363
364
|
end
|
364
365
|
|
365
366
|
def posts
|
366
|
-
log!(enter: __method__)
|
367
|
+
log!(enter: __method__, level: 3)
|
367
368
|
dir = self.view.dir/:posts
|
368
369
|
posts = Dir.entries(dir).grep(/^\d{4}/)
|
369
370
|
posts
|
370
371
|
end
|
371
372
|
|
372
373
|
def drafts
|
373
|
-
log!(enter: __method__)
|
374
|
+
log!(enter: __method__, level: 3)
|
374
375
|
dir = @root/:drafts
|
375
376
|
drafts = Dir.entries(dir).grep(/^\d{4}.*/)
|
376
377
|
end
|
377
378
|
|
378
379
|
def change_view(view)
|
379
|
-
log!(enter: __method__, args: [view])
|
380
|
+
log!(enter: __method__, args: [view], level: 3)
|
380
381
|
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
381
382
|
x = OpenStruct.new
|
382
383
|
x.root, x.current_view, x.editor = @root, view.to_s, @editor # dumb - FIXME later
|
@@ -393,15 +394,12 @@ class RuneBlog
|
|
393
394
|
|
394
395
|
def generate_view(view) # huh?
|
395
396
|
log!(enter: __method__, args: [view])
|
396
|
-
# generate_index(view) # recent posts (recent.html)
|
397
397
|
vdir = @root/:views/view
|
398
398
|
@theme = @root/:views/view/:themes/:standard
|
399
399
|
xlate cwd: vdir/"themes/standard/etc",
|
400
400
|
src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
|
401
401
|
xlate cwd: vdir/"themes/standard",
|
402
402
|
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
|
403
|
-
generate_index(view) # recent posts (recent.html)
|
404
|
-
# ^ HERE
|
405
403
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
406
404
|
rescue => err
|
407
405
|
puts err
|
@@ -411,7 +409,7 @@ class RuneBlog
|
|
411
409
|
end
|
412
410
|
|
413
411
|
def _get_views(draft)
|
414
|
-
log!(enter: __method__, args: [draft])
|
412
|
+
log!(enter: __method__, args: [draft], level: 2)
|
415
413
|
# FIXME dumb code
|
416
414
|
view_line = File.readlines(draft).grep(/^.views /)
|
417
415
|
raise "More than one .views call!" if view_line.size > 1
|
@@ -422,7 +420,7 @@ class RuneBlog
|
|
422
420
|
end
|
423
421
|
|
424
422
|
def _copy_get_dirs(draft, view)
|
425
|
-
log!(enter: __method__, args: [draft, view])
|
423
|
+
log!(enter: __method__, args: [draft, view], level: 2)
|
426
424
|
fname = File.basename(draft)
|
427
425
|
noext = fname.sub(/.lt3$/, "")
|
428
426
|
vdir = @root/:views/view
|
@@ -435,16 +433,30 @@ class RuneBlog
|
|
435
433
|
end
|
436
434
|
|
437
435
|
def _post_metadata(draft, pdraft)
|
438
|
-
log!(enter: __method__, args: [draft, pdraft])
|
436
|
+
log!(enter: __method__, args: [draft, pdraft], level: 2)
|
437
|
+
# FIXME store this somewhere
|
438
|
+
fname = File.basename(draft) # 0001-this-is-a-post.lt3
|
439
|
+
nslug = fname.sub(/.lt3$/, "") # 0001-this-is-a-post
|
440
|
+
aslug = nslug.sub(/\d\d\d\d-/, "") # this-is-a-post
|
441
|
+
pnum = nslug[0..3] # 0001
|
439
442
|
Dir.chdir(pdraft) do
|
440
443
|
excerpt = File.read("teaser.txt")
|
441
444
|
date = _retrieve_metadata(:date)
|
442
445
|
longdate = ::Date.parse(date).strftime("%B %e, %Y")
|
443
446
|
title = _retrieve_metadata(:title)
|
447
|
+
tags = _retrieve_metadata(:tags)
|
448
|
+
# FIXME simplify
|
444
449
|
vars = <<~LIVE
|
450
|
+
.set post.num = #{pnum}
|
451
|
+
.heredoc post.aslug
|
452
|
+
#{aslug}
|
453
|
+
.end
|
445
454
|
.heredoc title
|
446
455
|
#{title.chomp}
|
447
456
|
.end
|
457
|
+
.heredoc post.tags
|
458
|
+
#{tags.join(" ")}
|
459
|
+
.end
|
448
460
|
.heredoc teaser
|
449
461
|
#{excerpt.chomp}
|
450
462
|
.end
|
@@ -457,7 +469,7 @@ class RuneBlog
|
|
457
469
|
end
|
458
470
|
|
459
471
|
def copy_widget_html(view)
|
460
|
-
log!(enter: __method__)
|
472
|
+
log!(enter: __method__, level: 2)
|
461
473
|
vdir = @root/:views/view
|
462
474
|
remote = vdir/:remote
|
463
475
|
wdir = vdir/:themes/:standard/:widgets
|
@@ -468,12 +480,13 @@ class RuneBlog
|
|
468
480
|
create_dirs(rem)
|
469
481
|
files = Dir[w/"*"]
|
470
482
|
files = files.select {|x| x =~ /(html|css)$/ }
|
471
|
-
|
483
|
+
tag = File.basename(w)
|
484
|
+
files.each {|file| system!("cp #{file} #{rem}", show: (tag == "zzz")) }
|
472
485
|
end
|
473
486
|
end
|
474
487
|
|
475
488
|
def _handle_post(draft, view)
|
476
|
-
log!(enter: __method__, args: [draft, view])
|
489
|
+
log!(enter: __method__, args: [draft, view], level: 2)
|
477
490
|
# break into separate methods?
|
478
491
|
|
479
492
|
fname = File.basename(draft) # 0001-this-is-a-post.lt3
|
@@ -502,34 +515,9 @@ class RuneBlog
|
|
502
515
|
end
|
503
516
|
|
504
517
|
def generate_post(draft)
|
505
|
-
log!(enter: __method__, args: [draft])
|
518
|
+
log!(enter: __method__, args: [draft], level: 1)
|
506
519
|
views = _get_views(draft)
|
507
|
-
views.each
|
508
|
-
_handle_post(draft, view)
|
509
|
-
# generate_view(view) # FIXME leads to inefficiency?
|
510
|
-
# ^ HERE
|
511
|
-
end
|
512
|
-
end
|
513
|
-
|
514
|
-
def OLD_index_entry(view, meta)
|
515
|
-
log!(enter: __method__, args: [view, meta])
|
516
|
-
debug "=== index_entry #{view.to_s.inspect} #{meta.num} #{meta.title.inspect}"
|
517
|
-
check_meta(meta, "index_entry1")
|
518
|
-
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
519
|
-
check_meta(meta, "index_entry2")
|
520
|
-
self.make_slug(meta)
|
521
|
-
check_meta(meta, "index_entry3")
|
522
|
-
# FIXME clean up and generalize
|
523
|
-
ref = view/meta.slug/"index.html"
|
524
|
-
<<-HTML
|
525
|
-
<font size=-1>#{meta.date} </font> <br>
|
526
|
-
<font size=+2 color=blue><a href=../#{ref} style="text-decoration: none">#{meta.title}</font></a>
|
527
|
-
<br>
|
528
|
-
<font size=+1>#{meta.teaser} </font>
|
529
|
-
<a href=../#{ref} style="text-decoration: none">Read more...</a>
|
530
|
-
<br>
|
531
|
-
<hr>
|
532
|
-
HTML
|
520
|
+
views.each {|view| _handle_post(draft, view) }
|
533
521
|
end
|
534
522
|
|
535
523
|
def rebuild_post(file)
|
@@ -548,7 +536,7 @@ class RuneBlog
|
|
548
536
|
end
|
549
537
|
|
550
538
|
def remove_post(num)
|
551
|
-
log!(enter: __method__, args: [num])
|
539
|
+
log!(enter: __method__, args: [num], level: 1)
|
552
540
|
raise ArgumentError unless num.is_a?(Integer)
|
553
541
|
# FIXME update original draft .views
|
554
542
|
tag = prefix(num)
|
@@ -565,7 +553,7 @@ class RuneBlog
|
|
565
553
|
end
|
566
554
|
|
567
555
|
def undelete_post(num)
|
568
|
-
log!(enter: __method__, args: [num])
|
556
|
+
log!(enter: __method__, args: [num], level: 1)
|
569
557
|
raise ArgumentError unless num.is_a?(Integer)
|
570
558
|
files = Find.find(@root/:views).to_a
|
571
559
|
tag = prefix(num)
|
@@ -581,14 +569,14 @@ class RuneBlog
|
|
581
569
|
end
|
582
570
|
|
583
571
|
def delete_draft(num)
|
584
|
-
log!(enter: __method__, args: [num])
|
572
|
+
log!(enter: __method__, args: [num], level: 1)
|
585
573
|
raise ArgumentError unless num.is_a?(Integer)
|
586
574
|
tag = prefix(num)
|
587
575
|
system!("rm -rf #@root/drafts/#{tag}-*")
|
588
576
|
end
|
589
577
|
|
590
578
|
def make_slug(meta)
|
591
|
-
log!(enter: __method__, args: [meta])
|
579
|
+
log!(enter: __method__, args: [meta], level: 3)
|
592
580
|
raise ArgumentError unless meta.title.is_a?(String)
|
593
581
|
label = '%04d' % meta.num # FIXME can do better
|
594
582
|
slug0 = meta.title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
@@ -596,6 +584,5 @@ class RuneBlog
|
|
596
584
|
meta.slug = str
|
597
585
|
str
|
598
586
|
end
|
599
|
-
|
600
587
|
end
|
601
588
|
|