runeblog 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/liveblog.rb +53 -68
- data/lib/runeblog.rb +0 -48
- data/lib/runeblog_version.rb +1 -1
- data/test/make_blog.rb +1 -0
- 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: 88eb977188fc29149692d23a5a8b08bdad83da5c9c105c39f1f0fc4bbf4a7483
|
4
|
+
data.tar.gz: 4f3423490452d300b229c775632e5f10c09781e5e0bbb7dbcbd2183467e7ae54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e446863886eed1c348fe9bbf5bdfa473d8154ccdec09fb6eca03f07d6cd4a453f8aad9f797dd2c453904c5e1edec8f8a37bbe6c4daca731faed29a7150efe32d
|
7
|
+
data.tar.gz: 50c8b29750e8844771ff218f7ce063c2cc282dff65e555e9e850cdee8de1c8bd85e4d5e46787a67822e9b5a3156a06a08362cf63aa27b121e90941c03358658a
|
data/lib/liveblog.rb
CHANGED
@@ -423,6 +423,7 @@ def sidebar
|
|
423
423
|
_out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
|
424
424
|
_args do |token|
|
425
425
|
tag = token.chomp.strip.downcase
|
426
|
+
# Doesn't handle "split personality" widgets yet
|
426
427
|
Dir.chdir("widgets/#{tag}") do
|
427
428
|
livetext tag, "card-#{tag}.html"
|
428
429
|
_include_file "card-#{tag}.html"
|
@@ -447,59 +448,43 @@ def script
|
|
447
448
|
_out %[<script src="#{url}" integrity="#{integ}" crossorigin="#{cross}"></script>]
|
448
449
|
end
|
449
450
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
<html>
|
488
|
-
<head><link rel="stylesheet" href="etc/blog.css"></head>
|
489
|
-
<body>
|
490
|
-
HTML
|
491
|
-
posts = _find_recent_posts
|
492
|
-
wanted = [5, posts.size].min # estimate how many we want?
|
493
|
-
enum = posts.each
|
494
|
-
wanted.times do
|
495
|
-
postid = File.basename(enum.next)
|
496
|
-
postid = postid.to_i
|
497
|
-
text << _teaser(postid) # side effect! calls _out
|
498
|
-
end
|
499
|
-
text << "</body></html>"
|
500
|
-
File.write("recent.html", text)
|
501
|
-
_out %[<iframe id="main" style="width: 100vw; height: 100vh; position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
|
502
|
-
end
|
451
|
+
# def _find_recent_posts
|
452
|
+
# @vdir = _var(:FileDir).match(%r[(^.*/views/.*?)/])[1]
|
453
|
+
# posts = nil
|
454
|
+
# dir_posts = @vdir + "/posts"
|
455
|
+
# entries = Dir.entries(dir_posts)
|
456
|
+
# posts = entries.grep(/^\d\d\d\d/).map {|x| dir_posts + "/" + x }
|
457
|
+
# posts.select! {|x| File.directory?(x) }
|
458
|
+
# # directories that start with four digits
|
459
|
+
# posts = posts.sort {|a, b| b.to_i <=> a.to_i } # sort descending
|
460
|
+
# posts[0..19] # return 20 at most
|
461
|
+
# end
|
462
|
+
#
|
463
|
+
# def all_teasers
|
464
|
+
# open = <<-HTML
|
465
|
+
# <section class="posts">
|
466
|
+
# HTML
|
467
|
+
# close = <<-HTML
|
468
|
+
# </section>
|
469
|
+
# HTML
|
470
|
+
#
|
471
|
+
# text = <<-HTML
|
472
|
+
# <html>
|
473
|
+
# <head><link rel="stylesheet" href="etc/blog.css"></head>
|
474
|
+
# <body>
|
475
|
+
# HTML
|
476
|
+
# posts = _find_recent_posts
|
477
|
+
# wanted = [5, posts.size].min # estimate how many we want?
|
478
|
+
# enum = posts.each
|
479
|
+
# wanted.times do
|
480
|
+
# postid = File.basename(enum.next)
|
481
|
+
# postid = postid.to_i
|
482
|
+
# text << _teaser(postid) # side effect! calls _out
|
483
|
+
# end
|
484
|
+
# text << "</body></html>"
|
485
|
+
# File.write("recent.html", text)
|
486
|
+
# _out %[<iframe id="main" style="width: 100vw; height: 100vh; position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
|
487
|
+
# end
|
503
488
|
|
504
489
|
def _post_lookup(postid) # side-effect
|
505
490
|
# .. = templates, ../.. = views/thisview
|
@@ -521,21 +506,21 @@ def _interpolate(str, context) # FIXME move this later
|
|
521
506
|
eval(wrapped, context)
|
522
507
|
end
|
523
508
|
|
524
|
-
def _teaser(slug)
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
end
|
509
|
+
# def _teaser(slug)
|
510
|
+
# id = slug.to_i
|
511
|
+
# text = nil
|
512
|
+
# post_entry_name = @theme + "blog/post_entry.lt3"
|
513
|
+
# @_post_entry ||= File.read(post_entry_name)
|
514
|
+
# vp = _post_lookup(id)
|
515
|
+
# nslug, aslug, title, date, teaser_text =
|
516
|
+
# vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
|
517
|
+
# path = vp.path
|
518
|
+
# url = "#{path}/#{aslug}.html" # Should be relative to .blogs!! FIXME
|
519
|
+
# date = Date.parse(date)
|
520
|
+
# date = date.strftime("%B %e<br>%Y")
|
521
|
+
# text = _interpolate(@_post_entry, binding)
|
522
|
+
# text
|
523
|
+
# end
|
539
524
|
|
540
525
|
def _card_generic(card_title:, middle:, extra: "")
|
541
526
|
front = <<-HTML
|
data/lib/runeblog.rb
CHANGED
@@ -59,7 +59,6 @@ class RuneBlog
|
|
59
59
|
raise BlogRepoAlreadyExists if Dir.exist?(root)
|
60
60
|
create_dirs(root)
|
61
61
|
Dir.chdir(root) do
|
62
|
-
# puts " pwd = #{Dir.pwd} Trying: cp #{RuneBlog::Path}/../empty_view.tgz ."
|
63
62
|
system("cp #{RuneBlog::Path}/../empty_view.tgz .")
|
64
63
|
create_dirs(:drafts, :views)
|
65
64
|
new_sequence
|
@@ -108,7 +107,6 @@ class RuneBlog
|
|
108
107
|
val = self.instance_variable_get(iv)
|
109
108
|
str << "#{iv}: #{val} "
|
110
109
|
end
|
111
|
-
# str << "]]"
|
112
110
|
str
|
113
111
|
end
|
114
112
|
|
@@ -200,31 +198,14 @@ class RuneBlog
|
|
200
198
|
vdir = arg.dup
|
201
199
|
raise DirAlreadyExists(vdir) if Dir.exist?(vdir)
|
202
200
|
|
203
|
-
# puts "cv: pwd = #{Dir.pwd} file = #{`ls`}"
|
204
201
|
Dir.chdir(@root) do
|
205
|
-
# puts "---- (#{arg}) tar operation..."
|
206
|
-
|
207
|
-
# system("bash")
|
208
202
|
cmd1 = "tar zxvf empty_view.tgz >/dev/null 2>&1"
|
209
203
|
cmd2 = "cp -r empty_view views/#{arg}"
|
210
204
|
system(cmd1)
|
211
|
-
# puts " pwd = #{Dir.pwd}"
|
212
|
-
# puts " . => #{`echo *`}"
|
213
|
-
# puts " ./views => #{`ls views`}"
|
214
|
-
# puts " #{cmd1}\n #{cmd2}"
|
215
205
|
system(cmd2)
|
216
206
|
end
|
217
|
-
# create_dirs(vdir)
|
218
207
|
|
219
|
-
# puts "vdir = #{vdir} pwd = #{Dir.pwd}"
|
220
208
|
Dir.chdir("#@root/views/#{vdir}") do
|
221
|
-
# system("bash")
|
222
|
-
# x = RuneBlog::Default
|
223
|
-
# copy!("#{Themes}", "themes")
|
224
|
-
# create_dirs(:assets, :posts, :staging, "remote/permalink", "remote/navbar")
|
225
|
-
# livetext "themes/standard/etc/blog.css.lt3" # strip ext
|
226
|
-
# _copy_to_staging
|
227
|
-
# _copy_to_remote
|
228
209
|
livetext "themes/standard/blog/generate", "remote/index"
|
229
210
|
pub = "user: xxx\nserver: xxx\ndocroot: xxx\npath: xxx\nproto: xxx\n"
|
230
211
|
dump(pub, "publish")
|
@@ -257,7 +238,6 @@ class RuneBlog
|
|
257
238
|
|
258
239
|
def post_lookup(postid) # side-effect?
|
259
240
|
log!(enter: __method__, args: [postid])
|
260
|
-
# .. = templates, ../.. = views/thisview
|
261
241
|
slug = title = date = teaser_text = nil
|
262
242
|
|
263
243
|
dir_posts = @vdir + "/posts"
|
@@ -281,7 +261,6 @@ class RuneBlog
|
|
281
261
|
nslug, aslug, title, date, teaser_text =
|
282
262
|
vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
|
283
263
|
path = vp.path
|
284
|
-
# url = "#{path}/#{aslug}.html" # Should be relative to .blogs!! FIXME
|
285
264
|
url = "#{aslug}.html" # Should be relative to .blogs!! FIXME
|
286
265
|
date = ::Date.parse(date)
|
287
266
|
date = date.strftime("%B %e<br>%Y")
|
@@ -396,22 +375,6 @@ class RuneBlog
|
|
396
375
|
views
|
397
376
|
end
|
398
377
|
|
399
|
-
# Remember: A post in multiple views will trigger multiple
|
400
|
-
# views needing to be rebuilt (and published)
|
401
|
-
|
402
|
-
# generate a post:
|
403
|
-
# given draft 9999-title.lt3
|
404
|
-
# create VIEW/posts/9999-title/index.lt3
|
405
|
-
# LATER: metadata!! or is it in head?
|
406
|
-
# Generate VIEW/posts/9999-title/head.lt3?
|
407
|
-
# livetext draft_wrapper_plain.lt3 >generated/posts/plain-title.html # unframed
|
408
|
-
# livetext draft_generate.lt3 >generated/posts/real-title.html # framed
|
409
|
-
# livetext draft_wrapper_perma.lt3 >generated/posts/perma-title.html # permaframed
|
410
|
-
#
|
411
|
-
# Generate associated views:
|
412
|
-
# livetext ??/recent.lt3 >VIEW/working/recent.html
|
413
|
-
# livetext VIEW/blog/generate.lt3 ??
|
414
|
-
|
415
378
|
def _copy_get_dirs(draft, view)
|
416
379
|
log!(enter: __method__, args: [draft, view])
|
417
380
|
fname = File.basename(draft)
|
@@ -430,19 +393,14 @@ class RuneBlog
|
|
430
393
|
views = _get_views(draft)
|
431
394
|
views.each do |view|
|
432
395
|
noext, viewdir, slugdir, aslug, @theme = _copy_get_dirs(draft, view)
|
433
|
-
# staging = viewdir + "/staging"
|
434
396
|
remote = viewdir + "/remote"
|
435
397
|
Dir.chdir(slugdir) do
|
436
398
|
copy(draft, ".")
|
437
399
|
lt3 = draft.split("/")[-1]
|
438
400
|
# Remember: Some posts may be in more than one view -- careful with links back
|
439
|
-
# system("livetext #{draft} >staging/#{name}/index.html") # permalink?
|
440
|
-
# copy!("#{@theme}/*", "#{staging}")
|
441
|
-
# copy(lt3, staging)
|
442
401
|
copy(lt3, remote)
|
443
402
|
html = noext[5..-1]
|
444
403
|
livetext draft, html # livetext "foobar.lt3", "foobar.html"
|
445
|
-
# copy(html, "../../staging/post/index.html")
|
446
404
|
copy(html, "../../remote/post/index.html")
|
447
405
|
title_line = File.readlines(draft).grep(/^.title /).first
|
448
406
|
title = title_line.split(" ", 2)[1]
|
@@ -453,12 +411,6 @@ class RuneBlog
|
|
453
411
|
File.open("vars.lt3", "w") {|f| f.puts vars }
|
454
412
|
livetext "#{theme}/post/generate.lt3", "#{remote}/#{html}"
|
455
413
|
livetext "#{theme}/post/permalink.lt3", "#{remote}/permalink/#{html}"
|
456
|
-
# puts <<-TEXT
|
457
|
-
# File.open("vars.lt3", "w") {|f| f.puts vars }
|
458
|
-
# livetext "../post/generate.lt3", "#{remote}/#{html}"
|
459
|
-
# livetext "../post/permalink.lt3", "#{remote}/permalink/#{html}"
|
460
|
-
# TEXT
|
461
|
-
# system("bash")
|
462
414
|
log!(str: "About to enter remote/", pwd: true, dir: true)
|
463
415
|
Dir.chdir(remote) do
|
464
416
|
log!(str: "Now in remote/", pwd: true, dir: true)
|
data/lib/runeblog_version.rb
CHANGED
data/test/make_blog.rb
CHANGED