runeblog 0.2.83 → 0.2.84

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: bc20c73da7ee238b37adbc948c5e883f1e5f0b9b8c7f7add232c31dfbc2e3bd3
4
- data.tar.gz: 294b35d978b4ff2859f1073d460a3f61947284b659a041037f43f319cb38c4c8
3
+ metadata.gz: f0a0162c325b884d416802f6502ca34273cc388d7af3e58347e886c1b1e4c4d1
4
+ data.tar.gz: 450abb053bea34e25e392e6421fbd38cd6ded80d9bc93379b3a0f288f9dd60e3
5
5
  SHA512:
6
- metadata.gz: 2b8b9925f49e63203942d6c325960c7774c0ad96671e065e279b880cee8d80ff60c215488e9e403c3657ec9b4e2d89efc8f4e5052d0bffe9ff887dcd67556bd3
7
- data.tar.gz: 5b44950c664496a2032010c1e50da51a6091cf1d689ed1f49536ecb54c1586f4046de94bc9a5d1ae12fca675c3ba0969208f6c42cc93cd0dc0750c5687bdc205
6
+ metadata.gz: 886ae461d1898a79c2b674b728418975b3d28bd48a43c7d1cd2706133495c4497fbda6d1af3d365015929e7e53d6fab76047f4b7b17697cfed88f4dbacda153d
7
+ data.tar.gz: 100ef7fd298aff83c714070fc7beda5cedf03d063bf1b8dc5a9a150a16e56bada728842e23acbcb61b827eacea22404e5f743a74de905daf614629265b8e1f10
data/bin/blog CHANGED
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  def get_started
28
28
  if yesno("Do you want to qo a quick setup?")
29
- puts "\n First choose your editor."
29
+ puts " First choose your editor."
30
30
  @blog.editor = pick_editor
31
31
  File.write("#{@blog.root}/data/EDITOR", @blog.editor)
32
32
 
@@ -37,19 +37,15 @@ def get_started
37
37
  end
38
38
  # Now create a custom global.lt3
39
39
  @blog._generate_global
40
- sleep 1
41
40
  noview = true
42
41
  puts fx("\n Quick setup complete!", :bold)
43
42
  if yesno("Create your first view now?")
44
43
  cmd_new_view(nil)
45
44
  noview = false
46
- sleep 1
47
45
  puts "\n View #{@blog.view} created!\n "
48
46
  end
49
- system("cp #@root/data/global.lt3 #@root/views/#{@blog.view}/themes/standard/")
50
47
  end
51
48
 
52
- sleep 0.5
53
49
 
54
50
  puts
55
51
  print fx(" For help", :bold)
@@ -0,0 +1,19 @@
1
+ .nopara
2
+ <svg width="98%" height="100"
3
+ viewBox="0 0 98% 100">
4
+ <defs>
5
+ <linearGradient id="grad1" x1="100%" y1="100%" x2="0%" y2="100%">
6
+ <stop offset="0%" style="stop-color:rgb(198,198,228);stop-opacity:1" />
7
+ <stop offset="100%" style="stop-color:rgb(30,30,50);stop-opacity:1" />
8
+ </linearGradient>
9
+ </defs>
10
+ <style>
11
+ .small { font: 20px sans-serif; fill: #98baff }
12
+ .heavy { font: bold 55px sans-serif; fill: #76a9ff }
13
+ </style>
14
+
15
+ <rect x="20" y="20" rx="15" ry="15" width="98%" height="100" fill="url(#grad1)"/>
16
+
17
+ <text x="25" y="60" class=heavy>$blog</text>
18
+ <text x="25" y="90" class=small>$blog.desc</text>
19
+ </svg>
@@ -1,6 +1,4 @@
1
1
  .banner
2
- height 100
3
- bgcolor 101035
4
2
  text top.html
5
3
  break
6
4
  navbar
@@ -91,7 +91,7 @@ end
91
91
  def banner
92
92
  count = 0
93
93
  span = 1
94
- @bg = "white" # outside loop
94
+ bg = "white" # outside loop
95
95
  wide = nil
96
96
  high = 250
97
97
  str2 = ""
@@ -103,12 +103,9 @@ def banner
103
103
  tag, *data = line.split
104
104
  data ||= []
105
105
  case tag
106
- when "width"
107
- wide = data[0]
108
- when "height"
109
- high = data[0]
110
- when "bgcolor"
111
- @bg = data[0] || "white"
106
+ when "width"; wide = data[0]
107
+ when "height"; high = data[0]
108
+ when "bgcolor"; bg = data[0] || "white"
112
109
  when "image"
113
110
  image = data[0] || "banner.jpg"
114
111
  image = "banner"/image
@@ -122,31 +119,39 @@ def banner
122
119
  when "text"
123
120
  data[0] ||= "top.html"
124
121
  file = "banner"/data[0]
122
+ if ! File.exist?(file)
123
+ src = file.sub(/html$/, "lt3")
124
+ if File.exist?(src)
125
+ preprocess src: src, dst: file, vars: Livetext::Vars
126
+ else
127
+ raise "Neither #{file} nor #{src} found"
128
+ end
129
+ end
125
130
  str2 << "<td colspan=#{span}>" + File.read(file) + "</td>" + "\n"
126
131
  when "navbar"
127
132
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/" + "\n"
128
133
  _make_navbar # horiz is default
129
134
  file = "banner/navbar.html"
130
135
  navbar = File.read(file)
131
- # str2 << "<td colspan=#{span}><div style='text-align: center'>#{stuff}</div></td>" + "\n"
132
136
  when "vnavbar"
133
137
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
134
138
  _make_navbar(:vert)
135
139
  file = "banner/vnavbar.html"
136
140
  navbar = File.read(file)
137
- # str2 << "<td colspan=#{span}>" + File.read(file) + "</td>" + "\n"
138
141
  when "break"
139
- span = count - 1
142
+ # span = count - 1
140
143
  str2 << " </tr>\n <tr>" + "\n"
141
144
  else
142
145
  str2 << " '#{tag}' isn't known" + "\n"
143
146
  end
144
147
  end
145
- _out "<table width=100% height=#{high} bgcolor=##{@bg}>"
146
- _out " <tr>"
147
- _out str2
148
- _out " </tr>"
149
- _out "</table>"
148
+ _out <<~HTML
149
+ <table width=100% bgcolor=#{bg}>
150
+ <tr>
151
+ #{str2}
152
+ </tr>
153
+ </table>
154
+ HTML
150
155
  _out navbar if navbar
151
156
  rescue => err
152
157
  STDERR.puts "err = #{err}"
@@ -177,9 +182,9 @@ def _get_arg(name, args) # really belongs in livetext
177
182
  end
178
183
 
179
184
  def _svg_title(*args)
180
- width = 330
181
- height = 100
182
- bgcolor = "blue"
185
+ width = "95%"
186
+ height = 90
187
+ bgcolor = "black"
183
188
  style = nil
184
189
  size = ""
185
190
  font = "sans-serif"
@@ -194,103 +199,43 @@ def _svg_title(*args)
194
199
  align2 = "center"
195
200
 
196
201
  e = args.each
197
- hash = {}
202
+ hash = {} # TODO get rid of hash??
203
+
204
+ valid = %w[width height bgcolor style size font color xy
205
+ align style2 size2 font2 color2 xy2 align2]
206
+ os = OpenStruct.new
198
207
  loop do
199
208
  arg = e.next
200
209
  arg = arg.chop
201
- case arg # can give runtime error if arg missing
202
- when "width"; width = e.next
203
- when "height"; height = e.next
204
- when "bgcolor"; bgcolor = e.next
205
- when "style"; style = e.next
206
- when "size"; size = e.next
207
- when "font"; font = e.next
208
- when "color"; color = e.next
209
- when "xy"; xy = e.next
210
- when "align"; align = e.next
211
- when "style2"; style2 = e.next
212
- when "size2"; size2 = e.next
213
- when "font2"; font2 = e.next
214
- when "color2"; color2 = e.next
215
- when "xy2"; xy2 = e.next
216
- when "align2"; align2 = e.next
217
- end
210
+ raise "Don't know '#{arg}'" unless valid.include?(arg)
211
+ os.send(arg+"=", e.next)
218
212
  end
219
213
  x, y = xy.split(",")
220
214
  x2, y2 = xy2.split(",")
221
- hash["x"] = x
222
- hash["y"] = y
223
- hash["x2"] = x2
224
- hash["y2"] = y2
225
- hash["width"] = width
226
- hash["height"] = height
227
- hash["bgcolor"] = bgcolor
228
- hash["style"] = style
229
- hash["size"] = size
230
- hash["font"] = font
231
- hash["color"] = color
232
- hash["xy"] = xy
233
- hash["align"] = align
234
- hash["style2"] = style2
235
- hash["size2"] = size2
236
- hash["font2"] = font2
237
- hash["color2"] = color2
238
- hash["align2"] = align2
215
+ names = %w[x y x2 y2] + valid
216
+ names.each {|name| hash[name] = os.send(name) }
239
217
  result = <<~HTML
240
218
  <svg width="#{width}" height="#{height}"
241
219
  viewBox="0 0 #{width} #{height}">
220
+ <defs>
221
+ <linearGradient id="grad1" x1="100%" y1="100%" x2="0%" y2="100%">
222
+ <stop offset="0%" style="stop-color:rgb(198,198,228);stop-opacity:1" />
223
+ <stop offset="100%" style="stop-color:rgb(30,30,50);stop-opacity:1" />
224
+ </linearGradient>
225
+ </defs>
242
226
  <style>
243
227
  .title { font: #{style} #{size} #{font}; fill: #{color} }
244
228
  .subtitle { font: #{style2} #{size2} #{font2}; fill: #{color2} }
245
229
  </style>
246
- <rect x="10" y="10" rx="10" ry="10" width="#{width-20}" height="#{height-20}" fill="#{bgcolor}"/>
230
+ <rect x="10" y="10" rx="10" ry="10" width="#{width}" height="#{height}" fill="url(#grad1)"/>
247
231
  <text text-anchor="#{align}" x="#{x}" y="#{y}" class="title">#{Livetext::Vars[:blog]} </text>
248
232
  <text text-anchor="#{align2}" x="#{x2}" y="#{y2}" class="subtitle">#{Livetext::Vars["blog.desc"]} </text>
249
- </svg>
233
+ </svg>
234
+ <!-- ^ how does syntax highlighting get messed up? </svg> -->
250
235
  HTML
251
236
  [result, hash]
252
237
  end
253
238
 
254
- def svg_title_SOON
255
- tstyle = tsize = tfont = tcolor = txy = talign = nil
256
- t2style = t2size = t2font = t2color = t2xy = t2align = nil
257
- wide, high, hue = 450, 150, "white"
258
- _body do |line|
259
- count += 1
260
- tag, *data = line.split
261
- data ||= []
262
- title_params = {style: nil, size: "", font: "sans-serif", color: "white",
263
- xy: "5,5", align: "left"}
264
- case tag
265
- when "title";
266
- hash = _parse_colon_args(data, title_params)
267
- tstyle, tsize, tfont, tcolor, txy, talign =
268
- hash.values_at(:tstyle, :tsize, :tfont, :tcolor, :txy, :talign)
269
- tx, ty = txy.split(",")
270
- when "title2";
271
- hash = _parse_colon_args(data, title_params)
272
- t2style, t2size, t2font, t2color, t2xy, t2align =
273
- hash.values_at(:t2style, :t2size, :t2font, :t2color, :t2xy, :t2align)
274
- t2x, t2y = t2xy.split(",")
275
- when "width"; wide = _get_arg(:width, data)
276
- when "height"; high = _get_arg(:height, data)
277
- when "bgcolor"; hue = _get_arg(:bgcolor, data)
278
- end
279
- end
280
- <<~HTML
281
- <svg width="#{wide}" height="#{high}"
282
- viewBox="0 0 #{wide} #{high}">
283
- <style>
284
- .title { font: #{tstyle} #{tsize} #{tfont}; fill: #{tcolor} }
285
- .subtitle { font: #{t2style} #{t2size} #{t2font}; fill: #{t2color} }
286
- </style>
287
- <rect x="0" y="0" rx="10" ry="10" width="#{wide}" height="#{height}" fill="#{bgcolor}"/>
288
- <text text-anchor="#{talign}" x="#{tx}" y="#{tx}" class="title">$blog </text>
289
- <text text-anchor="#{t2align}" x="#{t2x}" y="#{t2y}" class="subtitle">$blog.desc </text>
290
- </svg>
291
- HTML
292
- end
293
-
294
239
  def quote
295
240
  _passthru "<blockquote>"
296
241
  _passthru _body.join(" ")
@@ -753,7 +698,6 @@ def _make_navbar(orient = :horiz)
753
698
  list1, list2 = '<l class="navbar-nav mr-auto">', "</ul>"
754
699
  end
755
700
 
756
- # <!-- FIXME weird bug here!!! -->
757
701
  start = <<-HTML
758
702
  <table><tr><td>
759
703
  <nav class="navbar #{extra} navbar-light bg-light">
@@ -22,7 +22,7 @@ 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)
25
+ deps: [], copy: nil, debug: false, force: false, vars: nil)
26
26
  src += LEXT unless src.end_with?(LEXT)
27
27
  dst += ".html" unless (dst.end_with?(".html") || strip)
28
28
  sp = " "*12
@@ -38,7 +38,7 @@ def preprocess(cwd: Dir.pwd, src:,
38
38
  stale = stale?(src, dst, deps, force)
39
39
  if stale
40
40
  live = Livetext.new
41
- out = live.xform_file(src)
41
+ out = live.xform_file(src, vars: vars)
42
42
  File.write(dst, out)
43
43
  system!("cp #{dst} #{copy}") if copy
44
44
  end
@@ -276,6 +276,9 @@ module RuneBlog::REPL
276
276
  puts
277
277
  end
278
278
  @blog.create_view(arg)
279
+ text = File.read("#{@blog.root}/data/global.lt3")
280
+ File.write("#{@blog.root}/views/#{@blog.view}/themes/standard/global.lt3",
281
+ text.gsub(/VIEW_NAME/, @blog.view.to_s))
279
282
  vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
280
283
  edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
281
284
  @blog.change_view(arg)
@@ -376,15 +376,28 @@ class RuneBlog
376
376
  <body>
377
377
  HTML
378
378
  posts = _sorted_posts
379
- wanted = [8, posts.size].min # estimate how many we want?
380
- enum = posts.each
381
- entries = []
382
- wanted.times do
383
- postid = File.basename(enum.next)
384
- postid = postid.to_i
385
- entry = index_entry(postid)
386
- entries << entry
387
- text << entry
379
+ if posts.size > 0
380
+ wanted = [8, posts.size].min # estimate how many we want?
381
+ enum = posts.each
382
+ entries = []
383
+ wanted.times do
384
+ postid = File.basename(enum.next)
385
+ postid = postid.to_i
386
+ entry = index_entry(postid)
387
+ entries << entry
388
+ text << entry
389
+ end
390
+ else
391
+ text << <<-HTML
392
+ <svg width="95%" height="95%" viewBox="0 0 95% 95%">
393
+ <style> .huge { font: italic 100px sans-serif; fill: white } </style>
394
+ <rect x="0" y="0" rx="50" ry="50" width="95%" height="95%" fill="lightblue"/>
395
+ <text x="250" y="120" class=huge>No</text>
396
+ <text x="250" y="230" class=huge>posts</text>
397
+ <text x="250" y="340" class=huge>here</text>
398
+ <text x="250" y="450" class=huge>yet</text>
399
+ </svg>
400
+ HTML
388
401
  end
389
402
  text << "</body></html>"
390
403
  File.write(@vdir/:remote/file, text)
@@ -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.83"
5
+ VERSION = "0.2.84"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
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.83
4
+ version: 0.2.84
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-15 00:00:00.000000000 Z
11
+ date: 2019-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -91,7 +91,6 @@ files:
91
91
  - empty_view/assets/sky2.jpg
92
92
  - empty_view/remote/assets/GIT_IS_DUMB
93
93
  - empty_view/remote/banner/austin-pano.jpg
94
- - empty_view/remote/banner/top.html
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
@@ -104,7 +103,7 @@ files:
104
103
  - empty_view/themes/standard/banner/contact.lt3
105
104
  - empty_view/themes/standard/banner/faq.lt3
106
105
  - empty_view/themes/standard/banner/list.data
107
- - empty_view/themes/standard/banner/top.html
106
+ - empty_view/themes/standard/banner/top.lt3
108
107
  - 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
@@ -1,4 +0,0 @@
1
- <div style="text-align: center; color: white; background: #101035">
2
- <h1>Around Austin</h1><br>
3
- The view from downtown...
4
- </div>
@@ -1,18 +0,0 @@
1
- <svg width="95%" height="55"
2
- viewBox="0 0 95% 55">
3
- <defs>
4
- <linearGradient id="grad1" x1="100%" y1="100%" x2="0%" y2="100%">
5
- <stop offset="0%" style="stop-color:rgb(198,198,228);stop-opacity:1" />
6
- <stop offset="100%" style="stop-color:rgb(30,30,50);stop-opacity:1" />
7
- </linearGradient>
8
- </defs>
9
- <style>
10
- .small { font: 13px sans-serif; fill: #98baff }
11
- .heavy { font: bold 35px sans-serif; fill: #76a9ff }
12
- </style>
13
-
14
- <rect x="0" y="0" rx="3" ry="3" width="95%" height="55" fill="url(#grad1)"/>
15
-
16
- <text x="5" y="33" class=heavy>$blog</text>
17
- <text x="5" y="48" class=small>$blog.desc</text>
18
- </svg>