runeblog 0.2.59 → 0.2.60

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b2d47a65fa785c2f35b7f5609cc790eae415a33f7be148d2ffd7ac1dfa20cbe
4
- data.tar.gz: 425c8a969db5a7ad6b3716e6141715a7e44d31d4eea21a2faf11e0995d612ddc
3
+ metadata.gz: f2e2d6239b2bc6f88fb80687c6facad5415fac4427618a7b2e47e760d326dc9e
4
+ data.tar.gz: 0e051d0b4adcc856fdf39451dfc2e85bcf80c80e4fc96b98edd34f736ac44796
5
5
  SHA512:
6
- metadata.gz: d19541de995f0fbd20b3193166db86410226e2fc53018fa61cfda5b8c39789288e4ee7f30946cf5779422b3181d2c0c3dc5530d46af8ee95f8392ba1164972fb
7
- data.tar.gz: 855b0768c3c79e6026e5ddcc4d079c53f2f45162a520cbe1b38b1b4b297e81e44c0bfe734abdfda6a8993bfdeab0b50078aa1db1e94e0e2a121e5c1895f2171b
6
+ metadata.gz: 400005cd7790c4d6af7e098f28c28697ea1a5a7e4b97a80dfcd121143a904f9504493d48f98085bcc07876cabd40f5ecbffcc4a5b7d7d37efca46780fd6ffb1c
7
+ data.tar.gz: f0713c12bb117df71c84f0f41ae9fc2d11c0cc9479882b7fe2154b5567dc68d2295bd099b8597fcac209738c86f6c511f256d25443e8bf95e6e9dd2b00b34207
@@ -14,9 +14,7 @@
14
14
  .include blog/head.lt3
15
15
  <body>
16
16
 
17
- .say Hello
18
17
  $.banner text: top.html image: austin-pano.jpg // navbar
19
- .say Hello again
20
18
  <div class="content container-fluid mt-4">
21
19
  <div class="row">
22
20
  $.include blog/index.lt3
@@ -121,14 +121,14 @@ def banner # still experimental
121
121
  when "navbar"
122
122
  # STDERR.puts "-- navbar: pwd = #{Dir.pwd}: #{`ls`}"
123
123
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
124
- hnavbar
124
+ _make_navbar # horiz is default
125
125
  # xlate cwd: dir, src: "navbar.lt3", dst: "navbar.html" # , debug: true
126
126
  stuff = File.read("banner/navbar.html")
127
127
  _out "<td colspan=#{span}><div style='text-align: center'>#{stuff}</div></td>" +
128
128
  " <!-- #{arg} -->"
129
129
  when "vnavbar"
130
130
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
131
- vnavbar
131
+ _make_navbar(:vert)
132
132
  # xlate cwd: dir, src: "vnavbar.lt3", dst: "vnavbar.html" # , debug: true
133
133
  file = "banner/vnavbar.html"
134
134
  _out "<td colspan=#{span}>" + File.read(file) + "</td>" +
@@ -348,7 +348,8 @@ end
348
348
  def finalize
349
349
  # FIXME simplify this!
350
350
  unless @meta
351
- puts @live.body
351
+ STDERR.puts "META is nil: file = #{Livetext::Vars[:File]}"
352
+ # puts @live.body
352
353
  return
353
354
  end
354
355
  if @blog.nil?
@@ -456,7 +457,6 @@ def _make_class_name(app)
456
457
  end
457
458
 
458
459
  def _load_local(widget)
459
- STDERR.puts "widget = #{widget} pwd = #{Dir.pwd}"
460
460
  Dir.chdir("widgets/#{widget}") do
461
461
  rclass = _make_class_name(widget)
462
462
  found = (require("./#{widget}") if File.exist?("#{widget}.rb"))
@@ -470,7 +470,9 @@ rescue => err
470
470
  end
471
471
 
472
472
  def pinned_rebuild
473
- Dir.chdir(@blog.root/:views/@blog.view/"themes/standard/") do
473
+ view = @blog.view
474
+ view = _args[0] unless _args.empty?
475
+ Dir.chdir(@blog.root/:views/view/"themes/standard/") do
474
476
  wtag = "widgets/pinned"
475
477
  code = _load_local("pinned")
476
478
  if code
@@ -684,18 +686,17 @@ end
684
686
 
685
687
  def vnavbar
686
688
  str = _make_navbar(:vert)
687
- _out str
689
+ # _out str
688
690
  end
689
691
 
690
692
  def hnavbar
691
693
  str = _make_navbar # horiz is default
692
- STDERR.puts "STR = #{str.inspect}"
693
- _out str
694
+ # _out str
694
695
  end
695
696
 
696
697
  def navbar
697
698
  str = _make_navbar # horiz is default
698
- _out str
699
+ # _out str
699
700
  end
700
701
 
701
702
  def _make_navbar(orient = :horiz)
@@ -718,14 +719,11 @@ def _make_navbar(orient = :horiz)
718
719
  name = (orient == :horiz) ? "navbar.html" : "vnavbar.html"
719
720
 
720
721
  html_file = @blog.root/:views/@blog.view/"themes/standard/banner"/name
721
- # STDERR.puts "html = #{html_file.inspect} pwd = #{Dir.pwd}"
722
722
  output = File.new(html_file, "w")
723
723
  output.puts start
724
724
  lines = _read_navbar_data
725
725
  lines = ["index Home"] + lines unless _args.include?("nohome")
726
- STDERR.puts " #{lines.size} lines"
727
726
  lines.each do |line|
728
- STDERR.puts " handling: #{line.inspect}"
729
727
  basename, cdata = line.chomp.strip.split(" ", 2)
730
728
  full = :banner/basename+".html"
731
729
  href_main = _main(full)
@@ -739,7 +737,6 @@ STDERR.puts " handling: #{line.inspect}"
739
737
  end
740
738
  output.puts finish
741
739
  output.close
742
- STDERR.puts "-- html_file: #{`ls -l #{html_file}`}"
743
740
  return File.read(html_file)
744
741
  end
745
742
 
@@ -15,7 +15,6 @@ module RuneBlog::REPL
15
15
  end
16
16
 
17
17
  def cmd_quit(arg, testing = false)
18
- check_empty(arg)
19
18
  RubyText.stop
20
19
  sleep 0.1
21
20
  cmd_clear(nil)
@@ -24,14 +23,12 @@ module RuneBlog::REPL
24
23
  end
25
24
 
26
25
  def cmd_clear(arg, testing = false)
27
- check_empty(arg)
28
26
  STDSCR.cwin.clear
29
27
  STDSCR.cwin.refresh
30
28
  end
31
29
 
32
30
  def cmd_version(arg, testing = false)
33
31
  reset_output
34
- check_empty(arg)
35
32
  output RuneBlog::VERSION
36
33
  puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red) unless testing
37
34
  @out
@@ -64,14 +61,12 @@ module RuneBlog::REPL
64
61
  end
65
62
 
66
63
  def _manage_pinned(arg, testing = false) # cloned from manage_links
67
- check_empty(arg)
68
64
  dir = @blog.view.dir/"themes/standard/widgets/pinned"
69
65
  data = dir/"list.data"
70
66
  edit_file(data)
71
67
  end
72
68
 
73
69
  def _manage_navbar(arg, testing = false) # cloned from manage_pages
74
- check_empty(arg)
75
70
  dir = @blog.view.dir/"themes/standard/navbar"
76
71
  files = Dir.entries(dir) - %w[. .. navbar.lt3]
77
72
  new_item = " [New item] "
@@ -107,7 +102,6 @@ module RuneBlog::REPL
107
102
  end
108
103
 
109
104
  def _manage_pages(arg, testing = false)
110
- check_empty(arg)
111
105
  dir = @blog.view.dir/"themes/standard/widgets/pages"
112
106
  # Assume child files already generated (and list.data??)
113
107
  data = dir/"list.data"
@@ -143,14 +137,12 @@ module RuneBlog::REPL
143
137
  end
144
138
 
145
139
  def cmd_import(arg, testing = false)
146
- check_empty(arg)
147
140
  files = ask("\n File(s) = ")
148
141
  system!("cp #{files} #{@blog.root}/views/#{@blog.view.name}/assets/")
149
142
  end
150
143
 
151
144
  def cmd_browse(arg, testing = false)
152
145
  reset_output
153
- check_empty(arg)
154
146
  url = @blog.view.publisher.url
155
147
  if url.nil?
156
148
  output! "Publish first."
@@ -164,7 +156,6 @@ module RuneBlog::REPL
164
156
 
165
157
  def cmd_preview(arg, testing = false)
166
158
  reset_output
167
- check_empty(arg)
168
159
  local = @blog.view.local_index
169
160
  result = system!("open #{local}")
170
161
  raise CantOpen(local) unless result
@@ -182,7 +173,6 @@ module RuneBlog::REPL
182
173
  # Future Hal says please refactor this
183
174
  puts unless testing
184
175
  reset_output
185
- check_empty(arg)
186
176
  unless @blog.view.can_publish?
187
177
  msg = "Can't publish... see globals.lt3"
188
178
  puts msg unless testing
@@ -225,7 +215,6 @@ module RuneBlog::REPL
225
215
  def cmd_rebuild(arg, testing = false)
226
216
  debug "Starting cmd_rebuild..."
227
217
  reset_output
228
- check_empty(arg)
229
218
  puts unless testing
230
219
  @blog.generate_view(@blog.view)
231
220
  @blog.generate_index(@blog.view)
@@ -285,7 +274,6 @@ module RuneBlog::REPL
285
274
 
286
275
  def cmd_new_post(arg, testing = false)
287
276
  reset_output
288
- check_empty(arg)
289
277
  if @blog.views.empty?
290
278
  puts "\n Create a view before creating the first post!\n "
291
279
  return
@@ -358,7 +346,6 @@ module RuneBlog::REPL
358
346
 
359
347
  def cmd_list_views(arg, testing = false)
360
348
  reset_output("\n")
361
- check_empty(arg)
362
349
  puts unless testing
363
350
  @blog.views.each do |v|
364
351
  v = v.to_s
@@ -372,7 +359,6 @@ module RuneBlog::REPL
372
359
 
373
360
  def cmd_list_posts(arg, testing = false)
374
361
  reset_output
375
- check_empty(arg)
376
362
  posts = @blog.posts # current view
377
363
  str = @blog.view.name + ":\n"
378
364
  output str
@@ -395,7 +381,6 @@ module RuneBlog::REPL
395
381
 
396
382
  def cmd_list_drafts(arg, testing = false)
397
383
  reset_output
398
- check_empty(arg)
399
384
  drafts = @blog.drafts # current view
400
385
  if drafts.empty?
401
386
  output! "No drafts"
@@ -416,7 +401,6 @@ module RuneBlog::REPL
416
401
 
417
402
  def cmd_list_assets(arg, testing = false)
418
403
  reset_output
419
- check_empty(arg)
420
404
  dir = @blog.view.dir + "/assets"
421
405
  assets = Dir[dir + "/*"]
422
406
  if assets.empty?
@@ -512,7 +496,6 @@ module RuneBlog::REPL
512
496
 
513
497
  def cmd_help(arg, testing = false)
514
498
  reset_output
515
- check_empty(arg)
516
499
  msg = Help
517
500
  output msg
518
501
  msg.each_line do |line|
@@ -331,8 +331,11 @@ class RuneBlog
331
331
  text = nil
332
332
  @theme = @view.dir/"themes/standard"
333
333
  post_entry_name = @theme/"blog/post_entry.lt3"
334
+ STDERR.puts "-- @pename = #{post_entry_name}"
335
+ STDERR.puts "-- @pe = #{@_post_entry.inspect}"
334
336
  depend = [post_entry_name]
335
- xlate src: post_entry_name, dst: "/tmp/post_entry.html", deps: depend # , debug: true
337
+ xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
338
+ STDERR.puts "-- xlate result: #{`ls -l /tmp/post_entry.html`}"
336
339
  @_post_entry ||= File.read("/tmp/post_entry.html")
337
340
  vp = post_lookup(id)
338
341
  nslug, aslug, title, date, teaser_text =
@@ -347,8 +350,7 @@ class RuneBlog
347
350
  _tmp_error(err)
348
351
  end
349
352
 
350
- def collect_recent_posts(file)
351
- log!(enter: __method__, args: [file], level: 3)
353
+ def _sorted_posts
352
354
  posts = nil
353
355
  dir_posts = @vdir/:posts
354
356
  entries = Dir.entries(dir_posts)
@@ -362,18 +364,29 @@ class RuneBlog
362
364
  nb = b[bi..(bi+3)].to_i
363
365
  nb <=> na
364
366
  end # sort descending
365
- posts = posts[0..19] # return 20 at most
367
+ return posts[0..19] # return 20 at most
368
+ end
369
+
370
+ def collect_recent_posts(file)
371
+ log!(enter: __method__, args: [file], level: 3)
366
372
  text = <<-HTML
367
373
  <html>
368
374
  <head><link rel="stylesheet" href="etc/blog.css"></head>
369
375
  <body>
370
376
  HTML
377
+ posts = _sorted_posts
371
378
  wanted = [8, posts.size].min # estimate how many we want?
372
379
  enum = posts.each
380
+ entries = []
373
381
  wanted.times do
374
382
  postid = File.basename(enum.next)
375
383
  postid = postid.to_i
376
- text << index_entry(postid) # side effect! calls _out
384
+ STDERR.puts "-- postid = #{postid}"
385
+ # posts.each {|x| STDERR.puts " #{x}" }
386
+ entry = index_entry(postid)
387
+ STDERR.puts "-- entry = #{entry.inspect}"
388
+ entries << entry
389
+ text << entry
377
390
  end
378
391
  text << "</body></html>"
379
392
  File.write(@vdir/:remote/file, text)
@@ -432,6 +445,15 @@ class RuneBlog
432
445
  _tmp_error(err)
433
446
  end
434
447
 
448
+ def _hack_pinned_rebuild(view)
449
+ tmp = "/tmp/pinned.lt3"
450
+ File.open(tmp, "w") do |f|
451
+ f.puts ".mixin liveblog\n.pinned_rebuild #{view}"
452
+ end
453
+ xlate src: tmp, dst: "/tmp/junk.html"
454
+ system("rm -f #{tmp} /tmp/junk.html")
455
+ end
456
+
435
457
  def generate_view(view) # huh?
436
458
  log!(enter: __method__, args: [view])
437
459
  vdir = @root/:views/view
@@ -445,6 +467,7 @@ class RuneBlog
445
467
  xlate cwd: vdir/"themes/standard", deps: depend, force: true,
446
468
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
447
469
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
470
+ # _hack_pinned_rebuild(view) # FIXME experimental
448
471
  copy_widget_html(view)
449
472
  rescue => err
450
473
  _tmp_error(err)
@@ -2,7 +2,7 @@
2
2
  if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
3
 
4
4
  class RuneBlog
5
- VERSION = "0.2.59"
5
+ VERSION = "0.2.60"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
  s.authors = ["Hal Fulton"]
21
21
  s.email = 'rubyhacker@gmail.com'
22
22
  s.executables << "blog"
23
- s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.94'
23
+ s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.95'
24
24
  s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.16'
25
25
 
26
26
  # Files...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.59
4
+ version: 0.2.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-10 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.8'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.8.94
22
+ version: 0.8.95
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '0.8'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.8.94
32
+ version: 0.8.95
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rubytext
35
35
  requirement: !ruby/object:Gem::Requirement