runeblog 0.2.88 → 0.2.89

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: 971964911d35242af990fce1bf3ac1e3227dd15726753f1224364781dd8d14ee
4
- data.tar.gz: 1168fac5a9db55738abfcd02d2a05b6da4e35a7aca6739b982ad9f45ff1aa143
3
+ metadata.gz: 69a5bfa546e814106599e4bd829ddf169bc07053b592db267bce813675f57119
4
+ data.tar.gz: 05dfce46838cf7002e57dc1f279e8da776463a06734f3a445ca2d710d82b4e2a
5
5
  SHA512:
6
- metadata.gz: 8d4d68cdfc991e83c6c1d4ed351b410803a276ccf296da6780f671851d9ec05b667adbb3ca23558e2a7e0cf896715391d07bc11e8c47fe2de3486e8f223513af
7
- data.tar.gz: b60f9c6f1cd642499992d72a7727276c0e0daa2b0de3c987e98a607570e62c01c926310761c7db2a715e4c22c8820ac0d3362c822d851a7329e71ff622b2efd7
6
+ metadata.gz: 170e5b90aff508ad77410a0b774bf30b79282e0928f863147d6da681879448e78a8e0d8053bf3c50a97a465b22a88d36409aaca16efe1c1fb20b59f1a365260b
7
+ data.tar.gz: 37135518327009fd0300cc082914b29992934ecead7a62fe3c3f3bcbb72c6f290f0e7911a6ee94ed26f2b554d77cfd4da84f56cbfa6f95f5b15cac576639aa2a
@@ -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.
@@ -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
 
data/lib/default.rb CHANGED
@@ -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}
data/lib/liveblog.rb CHANGED
@@ -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
  ##################
@@ -90,7 +92,6 @@ end
90
92
 
91
93
  def banner
92
94
  count = 0
93
- span = 1
94
95
  bg = "white" # outside loop
95
96
  wide = nil
96
97
  high = 250
@@ -111,23 +112,23 @@ def banner
111
112
  image = "banner"/image
112
113
  wide = data[0]
113
114
  width = wide ? "width=#{wide}" : ""
114
- str2 << " <td colspan=#{span}><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
115
+ str2 << " <td><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
115
116
  when "svg_title"
116
117
  stuff, hash = _svg_title(*data)
117
118
  wide = hash["width"]
118
- str2 << " <td colspan=#{span} width=#{wide}>#{stuff}</td>" + "\n"
119
+ str2 << " <td width=#{wide}>#{stuff}</td>" + "\n"
119
120
  when "text"
120
121
  data[0] ||= "top.html"
121
122
  file = "banner"/data[0]
122
123
  if ! File.exist?(file)
123
124
  src = file.sub(/html$/, "lt3")
124
125
  if File.exist?(src)
125
- preprocess src: src, dst: file, vars: Livetext::Vars
126
+ preprocess src: src, dst: file, call: ".nopara" # , vars: @blog.view.globals
126
127
  else
127
128
  raise "Neither #{file} nor #{src} found"
128
129
  end
129
130
  end
130
- str2 << "<td colspan=#{span}>" + File.read(file) + "</td>" + "\n"
131
+ str2 << "<td>" + File.read(file) + "</td>" + "\n"
131
132
  when "navbar"
132
133
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/" + "\n"
133
134
  _make_navbar # horiz is default
@@ -139,7 +140,6 @@ def banner
139
140
  file = "banner/vnavbar.html"
140
141
  navbar = File.read(file)
141
142
  when "break"
142
- # span = count - 1
143
143
  str2 << " </tr>\n <tr>" + "\n"
144
144
  else
145
145
  str2 << " '#{tag}' isn't known" + "\n"
@@ -552,11 +552,10 @@ def sidebar
552
552
  num = rand(1..4)
553
553
  img = "widgets/ad/ad#{num}.png"
554
554
  src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
555
- system!("cp #{src} #{dst}") # , show: true)
556
- File.open(wtag/"vars.lt3", "w") do |f|
557
- f.puts ".set ad.image = #{img}"
558
- end
559
- preprocess cwd: wtag, src: tag, dst: tcard, force: true # , debug: true # , deps: depend
555
+ system!("cp #{src} #{dst}")
556
+ File.open(wtag/"vars.lt3", "w") {|f| f.puts ".set ad.image = #{img}" }
557
+ preprocess cwd: wtag, src: tag, dst: tcard, call: ".nopara",
558
+ force: true # , debug: true # , deps: depend
560
559
  end
561
560
 
562
561
  _include_file wtag/tcard
@@ -700,7 +699,8 @@ def _make_navbar(orient = :horiz)
700
699
  output.puts %[#{li1} <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> #{li2}]
701
700
  else
702
701
  dir = @blog.root/:views/@blog.view/"themes/standard/banner"
703
- preprocess cwd: dir, src: basename, dst: vdir/"remote/banner"/basename+".html" # , debug: true
702
+ dest = vdir/"remote/banner"/basename+".html"
703
+ preprocess cwd: dir, src: basename, dst: dest, call: ".nopara" # , debug: true
704
704
  output.puts %[#{li1} <a class="nav-link" #{href_main}>#{cdata}</a> #{li2}]
705
705
  end
706
706
  end
data/lib/post.rb CHANGED
@@ -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")
data/lib/processing.rb CHANGED
@@ -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
data/lib/publish.rb CHANGED
@@ -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")
data/lib/repl.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'runeblog'
2
- require 'global'
3
2
  require 'ostruct'
4
3
  require 'helpers-repl' # FIXME structure
5
4
 
@@ -187,7 +186,7 @@ module RuneBlog::REPL
187
186
  puts unless testing
188
187
  reset_output
189
188
  unless @blog.view.can_publish?
190
- msg = "Can't publish... see globals.lt3"
189
+ msg = "Can't publish... see global.lt3"
191
190
  puts msg unless testing
192
191
  output! msg
193
192
  return @out
data/lib/runeblog.rb CHANGED
@@ -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,11 @@ 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"
470
475
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
471
476
  copy_widget_html(view)
472
477
  rescue => err
@@ -574,7 +579,8 @@ class RuneBlog
574
579
  # Step 1...
575
580
  create_dirs(pdraft)
576
581
  # FIXME dependencies?
577
- preprocess cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
582
+ preprocess cwd: pdraft, src: draft, dst: "guts.html",
583
+ mix: "liveblog" # , debug: true
578
584
  _post_metadata(draft, pdraft)
579
585
  # Step 2...
580
586
  vposts = @root/:views/view_name/:posts
@@ -585,10 +591,12 @@ class RuneBlog
585
591
  # Step 4...
586
592
  # FIXME dependencies?
587
593
  preprocess cwd: @theme/:post, src: "generate.lt3", force: true,
588
- dst: remote/ahtml, copy: @theme/:post # , debug: true
594
+ dst: remote/ahtml, copy: @theme/:post,
595
+ call: ".nopara" # , debug: true
589
596
  # FIXME dependencies?
590
597
  preprocess cwd: @theme/:post, src: "permalink.lt3",
591
- dst: remote/:permalink/ahtml # , debug: true
598
+ dst: remote/:permalink/ahtml,
599
+ mix: "liveblog" # , debug: true
592
600
  copy_widget_html(view_name)
593
601
  rescue => err
594
602
  _tmp_error(err)
@@ -1,11 +1,65 @@
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.88"
6
+ VERSION = "0.2.89"
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
+ exit
54
+ return rc
55
+ end
56
+ rc
57
+ end
58
+
59
+ def prefix(num)
60
+ log!(enter: __method__, args: [num], level: 3)
61
+ "#{'%04d' % num.to_i}"
62
+ end
63
+
64
+
11
65
  end
data/lib/view.rb CHANGED
@@ -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
data/runeblog.gemspec CHANGED
@@ -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.98'
24
- s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.19'
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.88
4
+ version: 0.2.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.8'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.8.98
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.98
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.19
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.19
52
+ version: 0.1.20
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: minitest
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +184,6 @@ files:
184
184
  - lib/exper/gen_svg.rb
185
185
  - lib/exper/s2.html
186
186
  - lib/exper/varmint.rb
187
- - lib/global.rb
188
187
  - lib/helpers-blog.rb
189
188
  - lib/helpers-repl.rb
190
189
  - lib/liveblog.rb
data/lib/global.rb DELETED
@@ -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
-