runeblog 0.2.86 → 0.2.91

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: 9fbecc77f77bf8c80aaba35e60ba800c81576bdb17b2ea14e2e2f9a5e87e8f03
4
- data.tar.gz: 3dd8e585304e748d150fe95a735a187c890517a347df413ed3e860d5fb705400
3
+ metadata.gz: 27cc38e2e368d435cd84531411f2e929a0bb629d4fcc3d05714db84c5a55a777
4
+ data.tar.gz: e7508aa230cac2adfddb9e7f9bd9175da281b801924ae567fee8315deb10de3a
5
5
  SHA512:
6
- metadata.gz: c2b4a8e13d9c0e507a331125815f0d7321a2dd9dabcee8b9955e7fbdd45c70ad80854b134adbcce0acabc6e41bb91f6aff73b1d1250b18f55544f30a88eba646
7
- data.tar.gz: 45400556fb87ed962227d6d91aca474b016bb7680c9b48af7b97b697b47b369748efb85c3a5e974c70db8cc8fe0d376e4ab78a6036ffb28ee26152e86cb6b22f
6
+ metadata.gz: 27b4e7dcdc6d9a1b3bd82d6c1733267f21656d2efa8ad7f13667152bf09b9eab52ad4adc5aba330d4e0e3a2a8c7a79093d12a39b9dcdd0f6595ca0e0a419e364
7
+ data.tar.gz: 1034eb0b04e9c33a855be6fcdee7ee86408b9a65d4570db8416d4c4ae248137561261168c7cf941dfe86000be65da9375804b3b01f28d11889ce1fdfe76efaf8
data/bin/blog CHANGED
@@ -12,9 +12,7 @@ include RuneBlog::REPL
12
12
  def yesno(question, noskip=false)
13
13
  puts fx("\n #{question}", :bold)
14
14
  puts unless noskip
15
- r, c = STDSCR.rc
16
- num, str = STDSCR.menu(r: r, c: c+6, items: ["yes", "no"])
17
- num == 0
15
+ STDSCR.yesno
18
16
  end
19
17
 
20
18
  def pick_editor
@@ -24,29 +22,57 @@ def pick_editor
24
22
  file = `which #{name}`.chomp
25
23
  end
26
24
 
25
+ def get_universal
26
+ univ = "#{@blog.root}/data/universal.lt3"
27
+ if yesno("Faster initial setup? (no: edit universal.lt3)")
28
+ author = ask("Author name: ")
29
+ site = ask("Site/domain: ")
30
+ # Now stash it...
31
+ str = File.read(univ)
32
+ str = str.gsub(/AUTHOR/, author)
33
+ str = str.gsub(/SITE_DOMAIN/, site)
34
+ else
35
+ vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(AUTHOR.*\|SITE.*\)"'
36
+ edit_file(univ, vim: vim_params)
37
+ end
38
+ end
39
+
40
+ def get_global
41
+ if yesno("Faster view setup? (no: edit global.lt3)")
42
+ view_name = ask("\nFilename: ")
43
+ @blog.create_view(view_name) # call change_view??
44
+ title = ask("View title: ")
45
+ subtitle = ask("Subtitle : ")
46
+ gname = "#{@blog.root}/views/#{view_name}/themes/standard/global.lt3"
47
+ text = File.read(gname)
48
+ text = text.gsub(/VIEW_NAME/, view_name)
49
+ text = text.gsub(/VIEW_TITLE/, title)
50
+ text = text.gsub(/VIEW_SUBTITLE/, subtitle)
51
+ File.write(gname, text)
52
+ else
53
+ view_name = ask("\nFilename: ")
54
+ @blog.create_view(view_name) # call change_view??
55
+ vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
56
+ edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
57
+ end
58
+ end
59
+
27
60
  def get_started
28
61
  if yesno("Do you want to qo a quick setup?")
29
62
  puts " First choose your editor."
30
63
  @blog.editor = pick_editor
31
64
  File.write("#{@blog.root}/data/EDITOR", @blog.editor)
32
65
 
33
- if yesno("Edit settings now?")
34
- fname = "#{@blog.root}/data/universal.lt3"
35
- vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(AUTHOR.*\|SITE.*\)"'
36
- edit_file(fname, vim: vim_params)
37
- end
66
+ get_universal
38
67
  # Now create a custom global.lt3
39
68
  @blog._generate_global
40
- noview = true
41
69
  puts fx("\n Quick setup complete!", :bold)
42
70
  if yesno("Create your first view now?")
43
- cmd_new_view(nil)
44
- noview = false
71
+ get_global
45
72
  puts "\n View #{@blog.view} created!\n "
46
73
  end
47
74
  end
48
75
 
49
-
50
76
  puts
51
77
  print fx(" For help", :bold)
52
78
  puts " type h or help."
@@ -0,0 +1 @@
1
+ .include ../../widgets/pages/faq.lt3
@@ -1,4 +1,5 @@
1
- .nopara
1
+ .seek global.lt3 # FIXME this is a hack!
2
+
2
3
  <svg width="98%" height="120"
3
4
  viewBox="0 0 98% 100">
4
5
  <defs>
@@ -4,8 +4,6 @@
4
4
  . The user will more often edit blog/index.lt3 in
5
5
  . the process of blog setup.
6
6
  . --------------------------------------------------
7
- .nopara
8
- .mixin liveblog
9
7
 
10
8
  <html>
11
9
  <!-- Generated from $File on $$date.
@@ -13,7 +11,7 @@
13
11
  $.seek global.lt3
14
12
  $.include blog/head.lt3
15
13
  <body>
16
- $.include blog/banner.lt3
14
+ $.include banner/banner.lt3
17
15
  <div class="content container-fluid mt-4">
18
16
  <div class="row">
19
17
  $.include blog/index.lt3
@@ -2,7 +2,6 @@
2
2
  . This HTML fragment gives the format of a post's
3
3
  . "index" entry (recent posts on blog front page).
4
4
  . --------------------------------------------------
5
- .nopara
6
5
 
7
6
  <div class="post">
8
7
  <table width=100% cellpadding=7>
@@ -2,7 +2,6 @@
2
2
  . This file is processed to create blog.css
3
3
  . Most of the global CSS goes here
4
4
  . --------------------------------------------------
5
- .nopara
6
5
 
7
6
  .seek themes/standard/global.lt3
8
7
 
@@ -8,10 +8,11 @@ def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_vie
8
8
  log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home], level: 3)
9
9
  viewlist = (views + [view.to_s]).join(" ")
10
10
  taglist = ".tags " + tags.join(" ")
11
- <<-TEXT
12
- .mixin liveblog
13
- . ^ get rid of this later
14
11
 
12
+ # .mixin liveblog
13
+ # . ^ get rid of this later
14
+
15
+ <<-TEXT
15
16
  .post #{num}
16
17
 
17
18
  .title #{title}
@@ -54,6 +54,7 @@ module RuneBlog::Helpers
54
54
  puts "Can't read vars file '#{file}': #{err}"
55
55
  puts err.backtrace.join("\n")
56
56
  puts "dir = #{Dir.pwd}"
57
+ sleep 6; RubyText.stop
57
58
  exit
58
59
  end
59
60
 
@@ -80,6 +81,7 @@ module RuneBlog::Helpers
80
81
  puts "Can't read config file '#{file}': #{err}"
81
82
  puts err.backtrace.join("\n")
82
83
  puts "dir = #{Dir.pwd}"
84
+ sleep 6; RubyText.stop
83
85
  exit
84
86
  end
85
87
 
@@ -18,6 +18,8 @@ def init_liveblog # FIXME - a lot of this logic sucks
18
18
  @vdir = @blog.view.dir rescue "NONAME"
19
19
  @version = RuneBlog::VERSION
20
20
  @theme = @vdir/:themes/:standard
21
+ rescue
22
+ raise "Only works inside a blog repo"
21
23
  end
22
24
 
23
25
  ##################
@@ -83,19 +85,20 @@ def code
83
85
  end
84
86
 
85
87
  def _read_navbar_data
86
- dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
88
+ vdir = @blog.root/:views/@blog.view
89
+ dir = vdir/"themes/standard/banner/"
87
90
  datafile = dir/"list.data"
88
91
  File.readlines(datafile)
89
92
  end
90
93
 
91
94
  def banner
92
95
  count = 0
93
- span = 1
94
96
  bg = "white" # outside loop
95
97
  wide = nil
96
98
  high = 250
97
99
  str2 = ""
98
100
  navbar = nil
101
+ vdir = @blog.root/:views/@blog.view
99
102
  lines = _body.to_a
100
103
 
101
104
  lines.each do |line|
@@ -111,35 +114,28 @@ def banner
111
114
  image = "banner"/image
112
115
  wide = data[0]
113
116
  width = wide ? "width=#{wide}" : ""
114
- str2 << " <td colspan=#{span}><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
117
+ str2 << " <td><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
115
118
  when "svg_title"
116
119
  stuff, hash = _svg_title(*data)
117
120
  wide = hash["width"]
118
- str2 << " <td colspan=#{span} width=#{wide}>#{stuff}</td>" + "\n"
121
+ str2 << " <td width=#{wide}>#{stuff}</td>" + "\n"
119
122
  when "text"
120
123
  data[0] ||= "top.html"
121
124
  file = "banner"/data[0]
122
125
  if ! File.exist?(file)
123
126
  src = file.sub(/html$/, "lt3")
124
127
  if File.exist?(src)
125
- preprocess src: src, dst: file, vars: Livetext::Vars
128
+ preprocess src: src, dst: file, call: ".nopara" # , vars: @blog.view.globals
126
129
  else
127
130
  raise "Neither #{file} nor #{src} found"
128
131
  end
129
132
  end
130
- str2 << "<td colspan=#{span}>" + File.read(file) + "</td>" + "\n"
133
+ str2 << "<td>" + File.read(file) + "</td>" + "\n"
131
134
  when "navbar"
132
- dir = @blog.root/:views/@blog.view/"themes/standard/banner/" + "\n"
133
- _make_navbar # horiz is default
134
- file = "banner/navbar.html"
135
- navbar = File.read(file)
135
+ navbar = _make_navbar # horiz is default
136
136
  when "vnavbar"
137
- dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
138
- _make_navbar(:vert)
139
- file = "banner/vnavbar.html"
140
- navbar = File.read(file)
137
+ navbar = _make_navbar(:vert)
141
138
  when "break"
142
- # span = count - 1
143
139
  str2 << " </tr>\n <tr>" + "\n"
144
140
  else
145
141
  str2 << " '#{tag}' isn't known" + "\n"
@@ -159,28 +155,6 @@ rescue => err
159
155
  gets
160
156
  end
161
157
 
162
- def _parse_colon_args(args, hash) # really belongs in livetext
163
- h2 = hash.dup
164
- e = args.each
165
- loop do
166
- arg = e.next.chop.to_sym
167
- raise "_parse_args: #{arg} is unknown" unless hash.keys.include?(arg)
168
- h2[arg] = e.next
169
- end
170
- h2 = h2.reject {|k,v| v.nil? }
171
- h2.each_pair {|k, v| raise "#{k} has no value" if v.empty? }
172
- h2
173
- end
174
-
175
- def _get_arg(name, args) # really belongs in livetext
176
- raise "(#{name}) Expected an array" unless args.is_a? Array
177
- raise "(#{name}) Expected an arg" if args.empty?
178
- raise "(#{name}) Too many args: #{args.inspect}" if args.size > 1
179
- val = args[0]
180
- raise "Expected an argument '#{name}'" if val.nil?
181
- val
182
- end
183
-
184
158
  def _svg_title(*args)
185
159
  width = "95%"
186
160
  height = 90
@@ -520,6 +494,7 @@ def _load_local(widget)
520
494
  rescue => err
521
495
  STDERR.puts err.to_s
522
496
  STDERR.puts err.backtrace.join("\n")
497
+ sleep 6; RubyText.stop
523
498
  exit
524
499
  end
525
500
 
@@ -574,11 +549,10 @@ def sidebar
574
549
  num = rand(1..4)
575
550
  img = "widgets/ad/ad#{num}.png"
576
551
  src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
577
- system!("cp #{src} #{dst}") # , show: true)
578
- File.open(wtag/"vars.lt3", "w") do |f|
579
- f.puts ".set ad.image = #{img}"
580
- end
581
- preprocess cwd: wtag, src: tag, dst: tcard, force: true # , debug: true # , deps: depend
552
+ system!("cp #{src} #{dst}")
553
+ File.open(wtag/"vars.lt3", "w") {|f| f.puts ".set ad.image = #{img}" }
554
+ preprocess cwd: wtag, src: tag, dst: tcard, call: ".nopara",
555
+ force: true # , debug: true # , deps: depend
582
556
  end
583
557
 
584
558
  _include_file wtag/tcard
@@ -587,6 +561,7 @@ def sidebar
587
561
  rescue => err
588
562
  puts "err = #{err}"
589
563
  puts err.backtrace.join("\n")
564
+ sleep 6; RubyText.stop
590
565
  exit
591
566
  end
592
567
 
@@ -709,20 +684,21 @@ def _make_navbar(orient = :horiz)
709
684
  </td></tr></table>
710
685
  HTML
711
686
 
712
- html_file = @blog.root/:views/@blog.view/"themes/standard/banner"/name
687
+ html_file = @blog.root/:views/@blog.view/"themes/standard/banner/navbar"/name
713
688
  output = File.new(html_file, "w")
714
689
  output.puts start
715
690
  lines = _read_navbar_data
716
691
  lines = ["index Home"] + lines unless _args.include?("nohome")
717
692
  lines.each do |line|
718
693
  basename, cdata = line.chomp.strip.split(" ", 2)
719
- full = :banner/basename+".html"
694
+ full = :banner/:navbar/basename+".html"
720
695
  href_main = _main(full)
721
696
  if basename == "index" # special case
722
697
  output.puts %[#{li1} <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> #{li2}]
723
698
  else
724
- dir = @blog.root/:views/@blog.view/"themes/standard/banner"
725
- preprocess cwd: dir, src: basename, dst: vdir/"remote/banner"/basename+".html" # , debug: true
699
+ dir = @blog.root/:views/@blog.view/"themes/standard/banner/navbar"
700
+ dest = vdir/"remote/banner/navbar"/basename+".html"
701
+ preprocess cwd: dir, src: basename, dst: dest, call: ".nopara" # , debug: true
726
702
  output.puts %[#{li1} <a class="nav-link" #{href_main}>#{cdata}</a> #{li2}]
727
703
  end
728
704
  end
@@ -1,5 +1,4 @@
1
1
  require 'runeblog'
2
- require 'global'
3
2
  require 'pathmagic'
4
3
 
5
4
  class RuneBlog::Post
@@ -9,12 +8,6 @@ class RuneBlog::Post
9
8
 
10
9
  include RuneBlog::Helpers
11
10
 
12
- # def self.files(num, root)
13
- # log!(enter: __method__, args: [num, root], level: 3)
14
- # files = ::Find.find(root).to_a
15
- # result = files.grep(/#{prefix(num)}-/)
16
- # result
17
- # end
18
11
 
19
12
  def self.load(post)
20
13
  log!(enter: __method__, args: [post], level: 3)
@@ -22,7 +15,6 @@ class RuneBlog::Post
22
15
  raise NoBlogAccessor if RuneBlog.blog.nil?
23
16
  # "post" is a slug
24
17
  pdir = RuneBlog.blog.root/:drafts/post
25
- puts "-- load: opening #{pdir}"
26
18
  meta = nil
27
19
  Dir.chdir(pdir) do
28
20
  meta = read_config("metadata.txt")
@@ -22,7 +22,8 @@ end
22
22
 
23
23
  def preprocess(cwd: Dir.pwd, src:,
24
24
  dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
25
- deps: [], copy: nil, debug: false, force: false, vars: nil)
25
+ deps: [], copy: nil, debug: false, force: false,
26
+ mix: [], call: [], vars: {})
26
27
  src += LEXT unless src.end_with?(LEXT)
27
28
  dst += ".html" unless (dst.end_with?(".html") || strip)
28
29
  sp = " "*12
@@ -37,8 +38,8 @@ def preprocess(cwd: Dir.pwd, src:,
37
38
  end
38
39
  stale = stale?(src, dst, deps, force)
39
40
  if stale
40
- live = Livetext.new
41
- out = live.xform_file(src, vars: vars)
41
+ live = Livetext.customize(mix: "liveblog", call: call, vars: vars)
42
+ out = live.xform_file(src)
42
43
  File.write(dst, out)
43
44
  system!("cp #{dst} #{copy}") if copy
44
45
  end
@@ -2,7 +2,6 @@ if ! defined?(Already_publish)
2
2
 
3
3
  Already_publish = nil
4
4
 
5
- require 'global'
6
5
  require 'pathmagic'
7
6
 
8
7
  class RuneBlog::Publishing
@@ -17,6 +16,7 @@ class RuneBlog::Publishing
17
16
  @blog = RuneBlog.blog
18
17
  gfile = @blog.root/:views/view/"themes/standard/global.lt3"
19
18
  data = File.readlines(gfile)
19
+ # Please refactor the Hal out of this
20
20
  grab = ->(var) { data.grep(/^#{var} /).first.chomp.split(" ", 2)[1] }
21
21
  @user = grab.call("publish.user")
22
22
  @server = grab.call("publish.server")
@@ -1,5 +1,4 @@
1
1
  require 'runeblog'
2
- require 'global'
3
2
  require 'ostruct'
4
3
  require 'helpers-repl' # FIXME structure
5
4
 
@@ -39,27 +38,23 @@ module RuneBlog::REPL
39
38
  end
40
39
 
41
40
  def cmd_config(arg, testing = false)
42
- list = ["global.lt3 Global configuration",
43
- "blog/generate.lt3 Generator for view (usu not edited)",
44
- ".... head.lt3 HEAD info for view",
45
- ".... banner.lt3 banner description",
46
- ".... index.lt3 User-edited detail for view",
47
- ".... post_entry.lt3 Generator for post entry in recent-posts",
48
- "etc/blog.css.lt3 Global CSS",
49
- "... externals.lt3 External JS/CSS (Bootstrap, etc.)",
50
- "post/generate.lt3 Generator for a post",
51
- ".... head.lt3 HEAD info for post",
52
- ".... index.lt3 Content for post",
53
- ".... permalink.lt3 Generator for permalink"]
54
-
55
- name = ["global.lt3", "blog/generate.lt3", "blog/head.lt3", "blog/banner.lt3",
56
- "blog/index.lt3", "blog/post_entry.lt3", "etc/blog.css.lt3",
57
- "blog/externals.lt3", "post/generate.lt3", "post/head.lt3",
58
- "post/index.lt3", "post/permalink.lt3"]
41
+ hash = {"global.lt3 Global configuration" => "global.lt3",
42
+ "banner/top.lt3 Text portion of banner" => "banner/top.lt3",
43
+ "blog/generate.lt3 Generator for view (usu not edited)" => "blog/generate.lt3",
44
+ ".... head.lt3 HEAD info for view" => "blog/head.lt3",
45
+ ".... banner.lt3 banner description" => "blog/banner.lt3",
46
+ ".... index.lt3 User-edited detail for view" => "blog/index.lt3",
47
+ ".... post_entry.lt3 Generator for post entry in recent-posts" => "blog/post_entry.lt3",
48
+ "etc/blog.css.lt3 Global CSS" => "etc/blog.css.lt3",
49
+ "... externals.lt3 External JS/CSS (Bootstrap, etc.)" => "/etc/externals.lt3",
50
+ "post/generate.lt3 Generator for a post" => "post/generate.lt3",
51
+ ".... head.lt3 HEAD info for post" => "post/head.lt3",
52
+ ".... index.lt3 Content for post" => "post/index.lt3",
53
+ ".... permalink.lt3 Generator for permalink" => "post/permalink.lt3",
54
+ }
59
55
 
60
56
  dir = @blog.view.dir/"themes/standard/"
61
- num, str = STDSCR.menu(title: "Edit file:", items: list)
62
- target = name[num]
57
+ num, target = STDSCR.menu(title: "Edit file:", items: hash)
63
58
  edit_file(dir/target)
64
59
  end
65
60
 
@@ -81,10 +76,10 @@ module RuneBlog::REPL
81
76
  end
82
77
 
83
78
  def _manage_navbar(arg, testing = false) # cloned from manage_pages
84
- dir = @blog.view.dir/"themes/standard/navbar"
79
+ dir = @blog.view.dir/"themes/standard/banner/navbar"
85
80
  files = Dir.entries(dir) - %w[. .. navbar.lt3]
86
- new_item = " [New item] "
87
81
  main_file = "[ navbar.lt3 ]"
82
+ new_item = " [New item] "
88
83
  files = [main_file] + files + [new_item]
89
84
  num, fname = STDSCR.menu(title: "Edit navbar:", items: files)
90
85
  return if fname.nil?
@@ -192,7 +187,7 @@ module RuneBlog::REPL
192
187
  puts unless testing
193
188
  reset_output
194
189
  unless @blog.view.can_publish?
195
- msg = "Can't publish... see globals.lt3"
190
+ msg = "Can't publish... see global.lt3"
196
191
  puts msg unless testing
197
192
  output! msg
198
193
  return @out
@@ -253,6 +248,7 @@ module RuneBlog::REPL
253
248
  viewnames = @blog.views.map {|x| x.name }
254
249
  n = viewnames.find_index(@blog.view.name)
255
250
  name = @blog.view.name
251
+ # TODO: Add view description
256
252
  k, name = STDSCR.menu(title: "Views", items: viewnames, curr: n) unless testing
257
253
  return if name.nil?
258
254
  @blog.view = name
@@ -9,7 +9,6 @@ require 'ostruct'
9
9
  require 'logging'
10
10
 
11
11
  require 'runeblog_version'
12
- require 'global'
13
12
  require 'helpers-blog'
14
13
  require 'default'
15
14
  require 'view'
@@ -107,13 +106,14 @@ class RuneBlog
107
106
 
108
107
  def _generate_global
109
108
  vars = read_vars("#@root/data/universal.lt3")
110
- global = File.read("#@root/data/global.lt3")
109
+ gfile = "#@root/data/global.lt3"
110
+ global = File.read(gfile)
111
111
  global.gsub!(/AUTHOR/, vars["author"])
112
112
  global.gsub!(/SITE/, vars["site"])
113
113
  global.gsub!(/FONT/, vars["font.family"])
114
114
  global.gsub!(/CHARSET/, vars["charset"])
115
115
  global.gsub!(/LOCALE/, vars["locale"])
116
- File.write("#@root/data/global.lt3", global)
116
+ File.write(gfile, global)
117
117
  end
118
118
 
119
119
  def _deploy_local(dir)
@@ -163,7 +163,8 @@ class RuneBlog
163
163
  dir = @root/:posts/nslug
164
164
  create_dirs(dir)
165
165
  # FIXME dependencies?
166
- preprocess cwd: dir, src: @root/:drafts/sourcefile # , debug: true
166
+ preprocess cwd: dir, src: @root/:drafts/sourcefile,
167
+ mix: "liveblog" # , debug: true
167
168
  _deploy_local(dir)
168
169
  rescue => err
169
170
  _tmp_error(err)
@@ -336,8 +337,10 @@ class RuneBlog
336
337
  @theme = @view.dir/"themes/standard"
337
338
  post_entry_name = @theme/"blog/post_entry.lt3"
338
339
  depend = [post_entry_name]
339
- preprocess src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
340
- @_post_entry ||= File.read("/tmp/post_entry.html")
340
+ html = "/tmp/post_entry.html"
341
+ preprocess src: post_entry_name, dst: html,
342
+ call: ".nopara" # , deps: depend # , debug: true
343
+ @_post_entry ||= File.read(html)
341
344
  vp = post_lookup(id)
342
345
  nslug, aslug, title, date, teaser_text =
343
346
  vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
@@ -464,9 +467,12 @@ class RuneBlog
464
467
  # @theme/"navbar/navbar.lt3",
465
468
  @theme/"blog/index.lt3"] # FIXME what about assets?
466
469
  preprocess cwd: vdir/"themes/standard/etc", # deps: depend, debug: true,
467
- src: "blog.css.lt3", copy: vdir/"remote/etc/" # , dst: "blog.css"
470
+ src: "blog.css.lt3", copy: vdir/"remote/etc/",
471
+ call: ".nopara" # , dst: "blog.css"
468
472
  preprocess cwd: vdir/"themes/standard", deps: depend, force: true,
469
- src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
473
+ src: "blog/generate.lt3", dst: vdir/:remote/"index.html",
474
+ call: ".nopara"
475
+ copy!("#{vdir}/themes/standard/banner/*", "#{vdir}/remote/banner/") # includes navbar/
470
476
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
471
477
  copy_widget_html(view)
472
478
  rescue => err
@@ -574,7 +580,8 @@ class RuneBlog
574
580
  # Step 1...
575
581
  create_dirs(pdraft)
576
582
  # FIXME dependencies?
577
- preprocess cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
583
+ preprocess cwd: pdraft, src: draft, dst: "guts.html",
584
+ mix: "liveblog" # , debug: true
578
585
  _post_metadata(draft, pdraft)
579
586
  # Step 2...
580
587
  vposts = @root/:views/view_name/:posts
@@ -585,10 +592,12 @@ class RuneBlog
585
592
  # Step 4...
586
593
  # FIXME dependencies?
587
594
  preprocess cwd: @theme/:post, src: "generate.lt3", force: true,
588
- dst: remote/ahtml, copy: @theme/:post # , debug: true
595
+ dst: remote/ahtml, copy: @theme/:post,
596
+ call: ".nopara" # , debug: true
589
597
  # FIXME dependencies?
590
598
  preprocess cwd: @theme/:post, src: "permalink.lt3",
591
- dst: remote/:permalink/ahtml # , debug: true
599
+ dst: remote/:permalink/ahtml,
600
+ mix: "liveblog" # , debug: true
592
601
  copy_widget_html(view_name)
593
602
  rescue => err
594
603
  _tmp_error(err)
@@ -1,11 +1,66 @@
1
+ if !defined?(RuneBlog::Path)
1
2
 
2
- if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
+ # if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
4
 
4
5
  class RuneBlog
5
- VERSION = "0.2.86"
6
+ VERSION = "0.2.91"
6
7
 
7
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
9
  Path = File.dirname(path)
9
10
  end
10
11
 
12
+ # skeleton
13
+
14
+ class RuneBlog
15
+ module Helpers
16
+ end
17
+
18
+ class Default
19
+ end
20
+
21
+ class View
22
+ end
23
+
24
+ class Publishing
25
+ end
26
+
27
+ class Post
28
+ end
29
+ end
30
+
31
+ # Refactor, move stuff elsewhere?
32
+
33
+ def make_exception(sym, str)
34
+ log!(enter: __method__, args: [sym, str], level: 3)
35
+ return if Object.constants.include?(sym)
36
+ Object.const_set(sym, StandardError.dup)
37
+ define_method(sym) do |*args|
38
+ msg = str
39
+ args.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
40
+ Object.class_eval(sym.to_s).new(msg)
41
+ end
42
+ end
43
+
44
+ def system!(str, show: false)
45
+ log!(enter: __method__, args: [str], level: 2)
46
+ STDERR.puts str if show
47
+ rc = system(str)
48
+ if rc
49
+ return rc
50
+ else
51
+ STDERR.puts "FAILED: #{str.inspect}"
52
+ STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
53
+ sleep 6; RubyText.stop
54
+ exit
55
+ return rc
56
+ end
57
+ rc
58
+ end
59
+
60
+ def prefix(num)
61
+ log!(enter: __method__, args: [num], level: 3)
62
+ "#{'%04d' % num.to_i}"
63
+ end
64
+
65
+
11
66
  end
@@ -1,8 +1,7 @@
1
- require 'global'
2
1
  require 'logging'
3
2
 
4
3
  class RuneBlog::View
5
- attr_reader :name, :state
4
+ attr_reader :name, :state, :globals
6
5
  attr_accessor :publisher
7
6
 
8
7
  include RuneBlog::Helpers
@@ -15,6 +14,10 @@ class RuneBlog::View
15
14
  @publisher = RuneBlog::Publishing.new(name)
16
15
  @can_publish = true # FIXME
17
16
  @blog.view = self
17
+ gfile = @blog.root/"views/#{name}/themes/standard/global.lt3"
18
+ live = Livetext.customize(call: ".nopara")
19
+ live.xform_file(gfile)
20
+ @globals = live.vars
18
21
  end
19
22
 
20
23
  def dir
@@ -20,8 +20,8 @@ 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.96'
24
- s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.18'
23
+ s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.99'
24
+ s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.20'
25
25
 
26
26
  s.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.0'
27
27
 
@@ -8,7 +8,6 @@ abort "Need Ruby 2.4 or greater" unless ver >= 24
8
8
 
9
9
  require 'date'
10
10
 
11
- require 'global'
12
11
  require 'runeblog'
13
12
  require 'repl'
14
13
 
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.86
4
+ version: 0.2.91
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-12-17 00:00:00.000000000 Z
11
+ date: 2019-12-19 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.96
22
+ version: 0.8.99
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.96
32
+ version: 0.8.99
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rubytext
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '0.1'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.1.18
42
+ version: 0.1.20
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '0.1'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.1.18
52
+ version: 0.1.20
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: minitest
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +91,6 @@ files:
91
91
  - empty_view/assets/sky2.jpg
92
92
  - empty_view/posts/GIT_IS_DUMB
93
93
  - empty_view/remote/assets/GIT_IS_DUMB
94
- - empty_view/remote/banner/austin-pano.jpg
95
94
  - empty_view/remote/etc/GIT_IS_DUMB
96
95
  - empty_view/remote/permalink/GIT_IS_DUMB
97
96
  - empty_view/remote/widgets/ad/GIT_IS_DUMB
@@ -100,12 +99,12 @@ files:
100
99
  - empty_view/remote/widgets/pages/GIT_IS_DUMB
101
100
  - empty_view/remote/widgets/pinned/GIT_IS_DUMB
102
101
  - empty_view/themes/standard/README
103
- - empty_view/themes/standard/banner/about.lt3
104
- - empty_view/themes/standard/banner/contact.lt3
105
- - empty_view/themes/standard/banner/faq.lt3
106
- - empty_view/themes/standard/banner/list.data
102
+ - empty_view/themes/standard/banner/banner.lt3
103
+ - empty_view/themes/standard/banner/navbar/about.lt3
104
+ - empty_view/themes/standard/banner/navbar/contact.lt3
105
+ - empty_view/themes/standard/banner/navbar/faq.lt3
106
+ - empty_view/themes/standard/banner/navbar/list.data
107
107
  - empty_view/themes/standard/banner/top.lt3
108
- - empty_view/themes/standard/blog/banner.lt3
109
108
  - empty_view/themes/standard/blog/generate.lt3
110
109
  - empty_view/themes/standard/blog/head.lt3
111
110
  - empty_view/themes/standard/blog/index.lt3
@@ -184,7 +183,6 @@ files:
184
183
  - lib/exper/gen_svg.rb
185
184
  - lib/exper/s2.html
186
185
  - lib/exper/varmint.rb
187
- - lib/global.rb
188
186
  - lib/helpers-blog.rb
189
187
  - lib/helpers-repl.rb
190
188
  - lib/liveblog.rb
@@ -1 +0,0 @@
1
- .include ../widgets/pages/faq.lt3
@@ -1,52 +0,0 @@
1
- # skeleton
2
-
3
- class RuneBlog
4
- module Helpers
5
- end
6
-
7
- class Default
8
- end
9
-
10
- class View
11
- end
12
-
13
- class Publishing
14
- end
15
-
16
- class Post
17
- end
18
- end
19
-
20
- # Refactor, move stuff elsewhere?
21
-
22
- def make_exception(sym, str)
23
- log!(enter: __method__, args: [sym, str], level: 3)
24
- return if Object.constants.include?(sym)
25
- Object.const_set(sym, StandardError.dup)
26
- define_method(sym) do |*args|
27
- msg = str
28
- args.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
29
- Object.class_eval(sym.to_s).new(msg)
30
- end
31
- end
32
-
33
- def system!(str, show: false)
34
- log!(enter: __method__, args: [str], level: 2)
35
- STDERR.puts str if show
36
- rc = system(str)
37
- if rc
38
- return rc
39
- else
40
- STDERR.puts "FAILED: #{str.inspect}"
41
- STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
- exit
43
- return rc
44
- end
45
- rc
46
- end
47
-
48
- def prefix(num)
49
- log!(enter: __method__, args: [num], level: 3)
50
- "#{'%04d' % num.to_i}"
51
- end
52
-