runeblog 0.2.59 → 0.2.64

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: 1ee0e8ea5eca8141bc128304f9f3025cff30bf7db3d6dc963ca9e826e7ec48fa
4
+ data.tar.gz: a46e8e6675cde4d9e43bdb5248eed70d732d86d28a0e80cf0c89d118c0ddbc3d
5
5
  SHA512:
6
- metadata.gz: d19541de995f0fbd20b3193166db86410226e2fc53018fa61cfda5b8c39789288e4ee7f30946cf5779422b3181d2c0c3dc5530d46af8ee95f8392ba1164972fb
7
- data.tar.gz: 855b0768c3c79e6026e5ddcc4d079c53f2f45162a520cbe1b38b1b4b297e81e44c0bfe734abdfda6a8993bfdeab0b50078aa1db1e94e0e2a121e5c1895f2171b
6
+ metadata.gz: 347dd447053e6d41532372c24c259716ae93c2ad9808ef63cc4ddf8d54d6e08c0e0cb2d06938f445115b1be79526b95e01672f6bd685ce00841bead8ada8c690
7
+ data.tar.gz: 719c98793354389ac974e1d45ee3e8d891380881938ec72676d6697cd49c233311d7bc9854624e235cfc87e3247632fb5a66794da5fb686f668ce9eaa130de22
data/README.lt3 CHANGED
@@ -1,6 +1,6 @@
1
1
  .mixin markdown
2
2
  <div style="float: left; align: left; vertical-align: bottom">
3
- <img src="raido4.png" width="210" height="295" align="left"></img>
3
+ <img src="readme/raido4.png" width="210" height="295" align="left"></img>
4
4
  </div>
5
5
  <h1>runeblog</h1><b>Runeblog</b> is a blogging tool written in Ruby. It has these basic characteristics:
6
6
  <ul>
@@ -80,11 +80,12 @@ a new blog repo. Enter `y for yes.
80
80
 
81
81
  You'll then enter the editor (vim for now) to add configuration info to the `global.lt3 file.
82
82
 
83
- <pre><b>FIXME add menu screenshot here</b></pre>
84
- <pre><b>FIXME add vim screenshot here</b></pre>
83
+ <!-- <pre><b>FIXME add menu screenshot here</b></pre> -->
84
+ <!-- <pre><b>FIXME add vim screenshot here</b></pre> -->
85
+ <img src="readme/vim-global.png" width="494" height="696" align="center"></img>
85
86
 
86
- The next thing you should do is to create at least one view of your own. Use the
87
- `[new view] command for this. Note that the current view is displayed as part of the prompt.
87
+ The next thing you should do is to create at least one view of your own. Use the `[new view]
88
+ command for this. Note that the current view is displayed as part of the prompt.
88
89
 
89
90
  <pre>
90
91
  <b>[no view]</b> new view mystuff<br>
@@ -95,13 +96,13 @@ To create a new post, use the `[new post] command (also abbreviated `post or sim
95
96
  prompted for a title:
96
97
 
97
98
  <pre>
98
- <b>[around_austin]</b> new post<br>
99
+ <b>[mystuff]</b> new post<br>
99
100
  <b>Title:</b> This is my first post
100
101
  </pre>
101
102
 
102
103
  Then you'll be sent into the editor (currently vim but can be others):
103
104
 
104
- <pre><b>FIXME add example here</b></pre>
105
+ <img src="readme/edit-first.png" width="506" height="383" align="center"></img>
105
106
 
106
107
  <pre>
107
108
  <b>FIXME wizard?</b>
@@ -118,7 +119,7 @@ browse...
118
119
 
119
120
  You can use the `config command to choose a file to edit.
120
121
 
121
- <pre><b>FIXME add screenshot here</b></pre>
122
+ <img src="readme/config-menu.png" width="700" height="547" align="center"></img>
122
123
 
123
124
  The meaning and interaction of these files will be explained later. *FIXME
124
125
 
@@ -127,6 +128,42 @@ are needed.
127
128
 
128
129
  .h2 The directory structure for a view
129
130
 
131
+ <b>Subject to change</b>
132
+ TBD: Add details
133
+
134
+ <pre>
135
+ .blogs/views/mystuff/
136
+ ├── assets
137
+ ├── posts
138
+ ├── remote
139
+ │   ├── assets
140
+ │   ├── banner
141
+ │   ├── etc
142
+ │   ├── permalink
143
+ │   └── widgets
144
+ │   ├── ad
145
+ │   ├── links
146
+ │   ├── news
147
+ │   ├── pages
148
+ │   └── pinned
149
+ └── themes
150
+ └── standard
151
+ ├── banner
152
+ ├── blog
153
+ ├── etc
154
+ ├── post
155
+ └── widgets
156
+ ├── ad
157
+ ├── bydates
158
+ ├── links
159
+ ├── news
160
+ ├── pages
161
+ ├── pinned
162
+ ├── search
163
+ ├── sitemap
164
+ └── tag-cloud
165
+ </pre>
166
+
130
167
  <pre><b>FIXME add details here</b></pre>
131
168
 
132
169
 
@@ -157,11 +194,11 @@ are needed.
157
194
  <b>Predefined functions and variables</b>
158
195
  <pre>
159
196
  \$File
160
- \$\$date
197
+ `[\$\$date]
161
198
  etc.
162
199
  </pre>
163
200
 
164
- .h2 Runeblog-specific features (Liveblog</b>
201
+ .h2 Runeblog-specific features (Liveblog)</b>
165
202
 
166
203
  <b>TBD</b>
167
204
 
@@ -224,7 +261,7 @@ are needed.
224
261
 
225
262
  <b>Creating your own widgets</b>
226
263
 
227
- <b>Special tags coming "soon"</b>
264
+ <b>Special tags/functions coming "soon"</b>
228
265
  <pre>
229
266
  github, gitlab, gist
230
267
  wikipedia
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div style="float: left; align: left; vertical-align: bottom">
2
- <img src="raido4.png" width="210" height="295" align="left"></img>
2
+ <img src="readme/raido4.png" width="210" height="295" align="left"></img>
3
3
  </div>
4
4
  <h1>runeblog</h1><b>Runeblog</b> is a blogging tool written in Ruby. It has these basic characteristics:
5
5
  <ul>
@@ -82,12 +82,13 @@ a new blog repo. Enter y for yes.
82
82
  You'll then enter the editor (vim for now) to add configuration info to the <font size=+1><tt>global.lt3</tt></font> file.
83
83
  <p>
84
84
 
85
- <pre><b>FIXME add menu screenshot here</b></pre>
86
- <pre><b>FIXME add vim screenshot here</b></pre>
85
+ <!-- <pre><b>FIXME add menu screenshot here</b></pre> -->
86
+ <!-- <pre><b>FIXME add vim screenshot here</b></pre> -->
87
+ <img src="readme/vim-global.png" width="494" height="696" align="center"></img>
87
88
  <p>
88
89
 
89
- The next thing you should do is to create at least one view of your own. Use the
90
- `[new view] command for this. Note that the current view is displayed as part of the prompt.
90
+ The next thing you should do is to create at least one view of your own. Use the <font size=+1><tt>new view</tt></font>
91
+ command for this. Note that the current view is displayed as part of the prompt.
91
92
  <p>
92
93
 
93
94
  <pre>
@@ -101,7 +102,7 @@ prompted for a title:
101
102
  <p>
102
103
 
103
104
  <pre>
104
- <b>[around_austin]</b> new post<br>
105
+ <b>[mystuff]</b> new post<br>
105
106
  <b>Title:</b> This is my first post
106
107
  </pre>
107
108
  <p>
@@ -109,7 +110,7 @@ prompted for a title:
109
110
  Then you'll be sent into the editor (currently vim but can be others):
110
111
  <p>
111
112
 
112
- <pre><b>FIXME add example here</b></pre>
113
+ <img src="readme/edit-first.png" width="506" height="383" align="center"></img>
113
114
  <p>
114
115
 
115
116
  <pre>
@@ -129,7 +130,7 @@ browse...
129
130
  You can use the <font size=+1><tt>config</tt></font> command to choose a file to edit.
130
131
  <p>
131
132
 
132
- <pre><b>FIXME add screenshot here</b></pre>
133
+ <img src="readme/config-menu.png" width="700" height="547" align="center"></img>
133
134
  <p>
134
135
 
135
136
  The meaning and interaction of these files will be explained later. <b>FIXME</b>
@@ -140,6 +141,44 @@ are needed.
140
141
  <p>
141
142
 
142
143
  ## The directory structure for a view
144
+ <b>Subject to change</b>
145
+ TBD: Add details
146
+ <p>
147
+
148
+ <pre>
149
+ .blogs/views/mystuff/
150
+ ├── assets
151
+ ├── posts
152
+ ├── remote
153
+ │   ├── assets
154
+ │   ├── banner
155
+ │   ├── etc
156
+ │   ├── permalink
157
+ │   └── widgets
158
+ │   ├── ad
159
+ │   ├── links
160
+ │   ├── news
161
+ │   ├── pages
162
+ │   └── pinned
163
+ └── themes
164
+ └── standard
165
+ ├── banner
166
+ ├── blog
167
+ ├── etc
168
+ ├── post
169
+ └── widgets
170
+ ├── ad
171
+ ├── bydates
172
+ ├── links
173
+ ├── news
174
+ ├── pages
175
+ ├── pinned
176
+ ├── search
177
+ ├── sitemap
178
+ └── tag-cloud
179
+ </pre>
180
+ <p>
181
+
143
182
  <pre><b>FIXME add details here</b></pre>
144
183
  <p>
145
184
 
@@ -175,12 +214,12 @@ are needed.
175
214
  <b>Predefined functions and variables</b>
176
215
  <pre>
177
216
  $File
178
- $\[date is undefined]
217
+ <font size=+1><tt></tt></font>
179
218
  etc.
180
219
  </pre>
181
220
  <p>
182
221
 
183
- ## Runeblog-specific features (Liveblog</b>
222
+ ## Runeblog-specific features (Liveblog)</b>
184
223
  <b>TBD</b>
185
224
  <p>
186
225
 
@@ -252,7 +291,7 @@ are needed.
252
291
  <b>Creating your own widgets</b>
253
292
  <p>
254
293
 
255
- <b>Special tags coming "soon"</b>
294
+ <b>Special tags/functions coming "soon"</b>
256
295
  <pre>
257
296
  github, gitlab, gist
258
297
  wikipedia
data/bin/blog CHANGED
@@ -56,10 +56,11 @@ end
56
56
 
57
57
  def cmdline_rebuild
58
58
  _need_view
59
- puts "Generating view..."
59
+ print "Generating view... "
60
60
  @blog.generate_view(@view)
61
- puts "Generating index..."
62
- @blog.generate_index(@view)
61
+ print "Generating index... "
62
+ num = @blog.generate_index(@view)
63
+ puts "#{num} posts\n "
63
64
  end
64
65
 
65
66
  def handle_cmdline
@@ -14,9 +14,7 @@
14
14
  .include blog/head.lt3
15
15
  <body>
16
16
 
17
- .say Hello
18
- $.banner text: top.html image: austin-pano.jpg // navbar
19
- .say Hello again
17
+ $.banner bgcolor: 101035 text: top.html image: austin-pano.jpg // navbar
20
18
  <div class="content container-fluid mt-4">
21
19
  <div class="row">
22
20
  $.include blog/index.lt3
@@ -7,9 +7,7 @@ class ::RuneBlog::Widget
7
7
  def initialize(repo)
8
8
  @blog = repo
9
9
  @datafile = "list.data"
10
- # f = File.new("/tmp/mehhh", "w")
11
10
  @lines = File.exist?(@datafile) ? File.readlines(@datafile) : []
12
- # f.puts #{@lines.inspect} in #{Dir.pwd}"
13
11
  File.open("/tmp/mehhh", "w") {|f| f.puts "#{@lines.inspect} in #{Dir.pwd}" }
14
12
  end
15
13
 
@@ -50,7 +48,7 @@ class ::RuneBlog::Widget
50
48
  mainfile = "#{tag}-main"
51
49
  File.open("#{mainfile}.html", "w") do |f|
52
50
  _html_body(f, css) do
53
- f.puts "<!-- #{@lines.inspect} in #{Dir.pwd} -->"
51
+ f.puts "<!-- #{@lines.inspect} in #{Dir.pwd} -->"
54
52
  f.puts "<h1>#{card_title}</h1><br><hr>"
55
53
  @links.each do |title, file|
56
54
  title = title.gsub(/\\/, "") # kludge
@@ -28,8 +28,6 @@ end
28
28
  # "dot" commands
29
29
  ##################
30
30
 
31
-
32
-
33
31
  def dropcap
34
32
  # Bad form: adds another HEAD
35
33
  text = _data
@@ -72,11 +70,8 @@ def faq
72
70
  ques = _data.chomp
73
71
  ans = _body_text
74
72
  id = "faq#@faq_count"
75
- # _out %[&nbsp;<a class="btn btn-default btn-xs" data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample">+</a>]
76
73
  _out %[&nbsp;<a data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample"><font size=+3>&#8964;</font></a>]
77
74
  _out %[&nbsp;<b>#{ques}</b>]
78
- # _out "<font size=-2><br></font>" if @faq_count == 1
79
- # _out "<br>" unless @faq_count == 1
80
75
  _out %[<div class="collapse" id="#{id}"><br><font size=+1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#{ans}</font></div>\n]
81
76
  _out "<br>" unless @faq_count == 1
82
77
  _optional_blank_line
@@ -93,11 +88,21 @@ def _read_navbar_data
93
88
  end
94
89
 
95
90
  def banner # still experimental
96
- _out "<table width=100% bgcolor=#101035>"
97
- _out " <tr>"
98
91
  enum = _args.each
99
92
  count = 0
100
93
  span = 1
94
+ first = enum.peek
95
+ if first.start_with?("bgcolor:")
96
+ enum.next
97
+ bg = enum.next
98
+ else
99
+ bg = nil # bg = white - do nothing
100
+ end
101
+ str = "<table width=100%"
102
+ str << (bg ? " bgcolor=##{bg}>" : ">")
103
+ _out str
104
+ _out " <tr>"
105
+
101
106
  loop do
102
107
  count += 1
103
108
  arg = enum.next
@@ -119,17 +124,14 @@ def banner # still experimental
119
124
  _out "<td colspan=#{span}>" + File.read(file) + "</td>" +
120
125
  " <!-- #{arg} -->"
121
126
  when "navbar"
122
- # STDERR.puts "-- navbar: pwd = #{Dir.pwd}: #{`ls`}"
123
127
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
124
- hnavbar
125
- # xlate cwd: dir, src: "navbar.lt3", dst: "navbar.html" # , debug: true
128
+ _make_navbar # horiz is default
126
129
  stuff = File.read("banner/navbar.html")
127
130
  _out "<td colspan=#{span}><div style='text-align: center'>#{stuff}</div></td>" +
128
131
  " <!-- #{arg} -->"
129
132
  when "vnavbar"
130
133
  dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
131
- vnavbar
132
- # xlate cwd: dir, src: "vnavbar.lt3", dst: "vnavbar.html" # , debug: true
134
+ _make_navbar(:vert)
133
135
  file = "banner/vnavbar.html"
134
136
  _out "<td colspan=#{span}>" + File.read(file) + "</td>" +
135
137
  "<!-- #{arg} -->"
@@ -197,21 +199,6 @@ def list!
197
199
  _optional_blank_line
198
200
  end
199
201
 
200
-
201
- def make_main_links
202
- log!(enter: __method__, level: 1)
203
- # FIXME remember strings may not be safe
204
- line = _data.chomp
205
- tag, card_title = *line.split(" ", 2)
206
- cardfile, mainfile = "#{tag}-card", "#{tag}-main"
207
- input = "list.data"
208
- log!(str: "Reading #{input}", pwd: true, level: 3)
209
- pairs = File.readlines(input).map {|line| line.chomp.split(/, */, 2) }
210
- _write_main(mainfile, pairs, card_title, tag)
211
- _write_card(cardfile, mainfile, pairs, card_title, tag)
212
- log!(str: "...returning from method", pwd: true, level: 3)
213
- end
214
-
215
202
  ### inset
216
203
 
217
204
  def inset
@@ -232,7 +219,6 @@ def inset
232
219
  else # Only into body
233
220
  output << line
234
221
  end
235
- # _passthru(line)
236
222
  end
237
223
  lr = _args.first
238
224
  wide = _args[1] || "25"
@@ -241,10 +227,6 @@ def inset
241
227
  _out "</p>" # kludge!! nopara
242
228
  0.upto(2) {|i| _passthru output[i] }
243
229
  _passthru stuff
244
- # _passthru "<div style='float:#{lr}; width: #{wide}%; padding:8px; padding-right:12px'>" # ; font-family:verdana'>"
245
- # _passthru '<b><i>'
246
- # _passthru box
247
- # _passthru_noline '</i></b></div>'
248
230
  3.upto(output.length-1) {|i| _passthru output[i] }
249
231
  _out "<p>" # kludge!! para
250
232
  _optional_blank_line
@@ -256,7 +238,6 @@ def title
256
238
  @meta.title = title
257
239
  setvar :title, title
258
240
  # FIXME refactor -- just output variables for a template
259
- # _out %[<h1 class="post-title">#{title}</h1><br>]
260
241
  _optional_blank_line
261
242
  end
262
243
 
@@ -346,14 +327,8 @@ def teaser
346
327
  end
347
328
 
348
329
  def finalize
349
- # FIXME simplify this!
350
- unless @meta
351
- puts @live.body
352
- return
353
- end
354
- if @blog.nil?
355
- return @meta
356
- end
330
+ return unless @meta
331
+ return @meta if @blog.nil?
357
332
 
358
333
  @slug = @blog.make_slug(@meta)
359
334
  slug_dir = @slug
@@ -456,7 +431,6 @@ def _make_class_name(app)
456
431
  end
457
432
 
458
433
  def _load_local(widget)
459
- STDERR.puts "widget = #{widget} pwd = #{Dir.pwd}"
460
434
  Dir.chdir("widgets/#{widget}") do
461
435
  rclass = _make_class_name(widget)
462
436
  found = (require("./#{widget}") if File.exist?("#{widget}.rb"))
@@ -470,7 +444,9 @@ rescue => err
470
444
  end
471
445
 
472
446
  def pinned_rebuild
473
- Dir.chdir(@blog.root/:views/@blog.view/"themes/standard/") do
447
+ view = @blog.view
448
+ view = _args[0] unless _args.empty?
449
+ Dir.chdir(@blog.root/:views/view/"themes/standard/") do
474
450
  wtag = "widgets/pinned"
475
451
  code = _load_local("pinned")
476
452
  if code
@@ -478,7 +454,18 @@ def pinned_rebuild
478
454
  widget = code.new(@blog)
479
455
  widget.build
480
456
  end
481
- _include_file wtag/"pinned-card.html"
457
+ # _include_file wtag/"pinned-card.html"
458
+ end
459
+ end
460
+ end
461
+
462
+ def _handle_standard_widget(tag)
463
+ wtag = :widgets/tag
464
+ code = _load_local(tag)
465
+ if code
466
+ Dir.chdir(wtag) do
467
+ widget = code.new(@blog)
468
+ widget.build
482
469
  end
483
470
  end
484
471
  end
@@ -492,7 +479,7 @@ def sidebar
492
479
 
493
480
  _out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
494
481
 
495
- standard = %w[pinned pages links]
482
+ standard = %w[pinned pages links news]
496
483
 
497
484
  _body do |token|
498
485
  tag = token.chomp.strip.downcase
@@ -500,27 +487,18 @@ def sidebar
500
487
  raise "Can't find #{wtag}" unless Dir.exist?(wtag)
501
488
  tcard = "#{tag}-card.html"
502
489
 
503
- code = _load_local(tag)
504
- if code
505
- if ["news", "pages", "links", "pinned"].include? tag
506
- Dir.chdir(wtag) do
507
- widget = code.new(@blog)
508
- widget.build
490
+ case
491
+ when standard.include?(tag)
492
+ _handle_standard_widget(tag)
493
+ when tag == "ad"
494
+ num = rand(1..4)
495
+ img = "widgets/ad/ad#{num}.png"
496
+ src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
497
+ system!("cp #{src} #{dst}") # , show: true)
498
+ File.open(wtag/"vars.lt3", "w") do |f|
499
+ f.puts ".set ad.image = #{img}"
509
500
  end
510
- end
511
- _include_file wtag/tcard
512
- next
513
- end
514
-
515
- if tag == "ad"
516
- num = rand(1..4)
517
- img = "widgets/ad/ad#{num}.png"
518
- src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
519
- system!("cp #{src} #{dst}") # , show: true)
520
- File.open(wtag/"vars.lt3", "w") do |f|
521
- f.puts ".set ad.image = #{img}"
522
- end
523
- xlate cwd: wtag, src: tag, dst: tcard, force: true # , deps: depend # , debug: true
501
+ xlate cwd: wtag, src: tag, dst: tcard, force: true # , deps: depend # , debug: true
524
502
  end
525
503
 
526
504
  _include_file wtag/tcard
@@ -605,17 +583,6 @@ class Livetext::Functions
605
583
  def _var(name)
606
584
  ::Livetext::Vars[name] || "[:#{name} is undefined]"
607
585
  end
608
-
609
- # def link(param = nil)
610
- # puts "--- WTF?? param = #{param.inspect}"; gets
611
- # file, cdata = param.split("||", 2)
612
- # %[<a href="assets/#{file}">#{cdata}</a>]
613
- # end
614
- #
615
- # def link(param = nil)
616
- # file, cdata = param.split("||", 2)
617
- # %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}#{file}" title="#{_var(:title)}">]
618
- # end
619
586
  end
620
587
 
621
588
  ###
@@ -684,18 +651,14 @@ end
684
651
 
685
652
  def vnavbar
686
653
  str = _make_navbar(:vert)
687
- _out str
688
654
  end
689
655
 
690
656
  def hnavbar
691
657
  str = _make_navbar # horiz is default
692
- STDERR.puts "STR = #{str.inspect}"
693
- _out str
694
658
  end
695
659
 
696
660
  def navbar
697
661
  str = _make_navbar # horiz is default
698
- _out str
699
662
  end
700
663
 
701
664
  def _make_navbar(orient = :horiz)
@@ -718,14 +681,11 @@ def _make_navbar(orient = :horiz)
718
681
  name = (orient == :horiz) ? "navbar.html" : "vnavbar.html"
719
682
 
720
683
  html_file = @blog.root/:views/@blog.view/"themes/standard/banner"/name
721
- # STDERR.puts "html = #{html_file.inspect} pwd = #{Dir.pwd}"
722
684
  output = File.new(html_file, "w")
723
685
  output.puts start
724
686
  lines = _read_navbar_data
725
687
  lines = ["index Home"] + lines unless _args.include?("nohome")
726
- STDERR.puts " #{lines.size} lines"
727
688
  lines.each do |line|
728
- STDERR.puts " handling: #{line.inspect}"
729
689
  basename, cdata = line.chomp.strip.split(" ", 2)
730
690
  full = :banner/basename+".html"
731
691
  href_main = _main(full)
@@ -739,7 +699,6 @@ STDERR.puts " handling: #{line.inspect}"
739
699
  end
740
700
  output.puts finish
741
701
  output.close
742
- STDERR.puts "-- html_file: #{`ls -l #{html_file}`}"
743
702
  return File.read(html_file)
744
703
  end
745
704
 
@@ -760,123 +719,6 @@ def _html_body(file, css = nil)
760
719
  file.puts " </body>\n</html>"
761
720
  end
762
721
 
763
- def _write_card(cardfile, mainfile, pairs, card_title, tag)
764
- log!(str: "Creating #{cardfile}.html", pwd: true, level: 2)
765
- url = mainfile
766
- url = :widgets/tag/mainfile + ".html"
767
- File.open("#{cardfile}.html", "w") do |f|
768
- f.puts <<-EOS
769
- <div class="card mb-3">
770
- <div class="card-body">
771
- <h5 class="card-title">
772
- <button type="button" class="btn btn-primary" data-toggle="collapse" data-target="##{tag}">+</button>
773
- <a href="javascript: void(0)"
774
- onclick="javascript:open_main('#{url}')"
775
- style="text-decoration: none; color: black"> #{card_title}</a>
776
- </h5>
777
- <div class="collapse" id="#{tag}">
778
- EOS
779
- log!(str: "Writing data pairs to #{cardfile}.html", pwd: true, level: 2)
780
- local = _local_tag?(tag)
781
- pairs.each do |file, title|
782
- url = file
783
- type, title = page_type(tag, title)
784
- case type
785
- when :local; url_ref = _widget_card(file, tag) # local always frameable
786
- when :frame; url_ref = _main(file) # remote, frameable
787
- when :noframe; url_ref = _blank(file) # remote, not frameable
788
- end
789
- anchor = %[<a #{url_ref}>#{title}</a>]
790
- wrapper = %[<li class="list-group-item">#{anchor}</li>]
791
- f.puts wrapper
792
- end
793
- _include_file cardfile+".html"
794
- f.puts <<-EOS
795
- </div>
796
- </div>
797
- </div>
798
- EOS
799
- end
800
- end
801
-
802
- def _local_tag?(tag)
803
- case tag.to_sym
804
- when :pages
805
- true
806
- when :news, :links
807
- false
808
- else
809
- true # Hmmm...
810
- end
811
- end
812
-
813
- def page_type(tag, title)
814
- yesno = "yes"
815
- yesno, title = title.split(/, */) if title =~ /^[yes|no]/
816
- local = _local_tag?(tag)
817
- frameable = (yesno == "yes")
818
- if local
819
- return [:local, title]
820
- elsif frameable
821
- return [:frame, title]
822
- else
823
- return [:noframe, title]
824
- end
825
- end
826
-
827
- def _write_main_pages(mainfile, pairs, card_title, tag)
828
- local = _local_tag?(tag)
829
- pieces = @blog.view.dir/"themes/standard/widgets"/tag/:pieces
830
- main_head = xlate! cwd: pieces, src: "main-head.lt3"
831
- main_tail = xlate! cwd: pieces, src: "main-tail.lt3"
832
- # ^ make into methods in pages.rb or whatever?
833
-
834
- File.open("#{mainfile}.html", "w") do |f|
835
- f.puts main_head
836
- pairs.each do |file, title|
837
- type, title = page_type(tag, title)
838
- title = title.gsub(/\\/, "") # kludge
839
- case type
840
- when :local; url_ref = _widget_main(file, tag) # local always frameable
841
- when :frame; url_ref = "href = '#{file}'" # local always frameable
842
- when :noframe; url_ref = _blank(file) # local always frameable
843
- end
844
- css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
845
- f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
846
- end
847
- f.puts main_tail
848
- end
849
- end
850
-
851
- def _write_main(mainfile, pairs, card_title, tag)
852
- log!(str: "Creating #{mainfile}.html", pwd: true, level: 2)
853
-
854
- if tag == "pages" # temporary experiment
855
- _write_main_pages(mainfile, pairs, card_title, tag)
856
- return
857
- end
858
-
859
- local = _local_tag?(tag)
860
- setvar "card.title", card_title
861
- css = "* { font-family: verdana }"
862
- File.open("#{mainfile}.html", "w") do |f|
863
- _html_body(f, css) do
864
- f.puts "<h1>#{card_title}</h1><br><hr>"
865
- pairs.each do |file, title|
866
- type, title = page_type(tag, title)
867
- title = title.gsub(/\\/, "") # kludge
868
- case type
869
- when :local; url_ref = _widget_main(file, tag) # local always frameable
870
- when :frame; url_ref = "href = '#{file}'" # local always frameable
871
- when :noframe; url_ref = _blank(file) # local always frameable
872
- end
873
- css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
874
- f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
875
- end
876
- end
877
- end
878
- end
879
-
880
722
  def _errout(*args)
881
723
  ::STDERR.puts *args
882
724
  end
@@ -951,12 +793,3 @@ def _blank(url)
951
793
  %[href='#{url}' target='blank']
952
794
  end
953
795
 
954
- def _widget_main(url, tag)
955
- %[href="#{url}"]
956
- end
957
-
958
- def _widget_card(url, tag)
959
- url2 = :widgets/tag/url
960
- %[href="javascript: void(0)" onclick="javascript:open_main('#{url2}')"]
961
- end
962
-
@@ -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,8 +156,11 @@ 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
160
+ unless File.exist?(local)
161
+ puts "\n No index. Rebuilding..."
162
+ cmd_rebuild(nil)
163
+ end
169
164
  result = system!("open #{local}")
170
165
  raise CantOpen(local) unless result
171
166
  @out
@@ -182,7 +177,6 @@ module RuneBlog::REPL
182
177
  # Future Hal says please refactor this
183
178
  puts unless testing
184
179
  reset_output
185
- check_empty(arg)
186
180
  unless @blog.view.can_publish?
187
181
  msg = "Can't publish... see globals.lt3"
188
182
  puts msg unless testing
@@ -225,7 +219,6 @@ module RuneBlog::REPL
225
219
  def cmd_rebuild(arg, testing = false)
226
220
  debug "Starting cmd_rebuild..."
227
221
  reset_output
228
- check_empty(arg)
229
222
  puts unless testing
230
223
  @blog.generate_view(@blog.view)
231
224
  @blog.generate_index(@blog.view)
@@ -285,7 +278,6 @@ module RuneBlog::REPL
285
278
 
286
279
  def cmd_new_post(arg, testing = false)
287
280
  reset_output
288
- check_empty(arg)
289
281
  if @blog.views.empty?
290
282
  puts "\n Create a view before creating the first post!\n "
291
283
  return
@@ -358,7 +350,6 @@ module RuneBlog::REPL
358
350
 
359
351
  def cmd_list_views(arg, testing = false)
360
352
  reset_output("\n")
361
- check_empty(arg)
362
353
  puts unless testing
363
354
  @blog.views.each do |v|
364
355
  v = v.to_s
@@ -372,7 +363,6 @@ module RuneBlog::REPL
372
363
 
373
364
  def cmd_list_posts(arg, testing = false)
374
365
  reset_output
375
- check_empty(arg)
376
366
  posts = @blog.posts # current view
377
367
  str = @blog.view.name + ":\n"
378
368
  output str
@@ -395,7 +385,6 @@ module RuneBlog::REPL
395
385
 
396
386
  def cmd_list_drafts(arg, testing = false)
397
387
  reset_output
398
- check_empty(arg)
399
388
  drafts = @blog.drafts # current view
400
389
  if drafts.empty?
401
390
  output! "No drafts"
@@ -416,7 +405,6 @@ module RuneBlog::REPL
416
405
 
417
406
  def cmd_list_assets(arg, testing = false)
418
407
  reset_output
419
- check_empty(arg)
420
408
  dir = @blog.view.dir + "/assets"
421
409
  assets = Dir[dir + "/*"]
422
410
  if assets.empty?
@@ -512,7 +500,6 @@ module RuneBlog::REPL
512
500
 
513
501
  def cmd_help(arg, testing = false)
514
502
  reset_output
515
- check_empty(arg)
516
503
  msg = Help
517
504
  output msg
518
505
  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,21 +364,30 @@ 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
+ entry = index_entry(postid)
385
+ entries << entry
386
+ text << entry
377
387
  end
378
388
  text << "</body></html>"
379
389
  File.write(@vdir/:remote/file, text)
390
+ return posts.size
380
391
  rescue => err
381
392
  _tmp_error(err)
382
393
  end
@@ -427,7 +438,8 @@ class RuneBlog
427
438
  log!(enter: __method__, args: [view], pwd: true, dir: true)
428
439
  raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
429
440
  @vdir = @root/:views/view
430
- collect_recent_posts("recent.html")
441
+ num = collect_recent_posts("recent.html")
442
+ return num
431
443
  rescue => err
432
444
  _tmp_error(err)
433
445
  end
@@ -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.64"
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...
@@ -50,7 +50,8 @@ end
50
50
 
51
51
  t0 = Time.now
52
52
 
53
- puts bold("\nGenerating test blog...")
53
+ puts
54
+ debug bold("Generating test blog...")
54
55
 
55
56
  system("rm -rf .blogs")
56
57
  RuneBlog.create_new_blog_repo(".blogs")
@@ -151,12 +152,10 @@ x.generate_index("around_austin")
151
152
 
152
153
  debug
153
154
  x.change_view("around_austin")
154
- debug
155
-
156
- puts bold("...finished.\n")
155
+ debug bold("...finished.\n")
157
156
 
158
157
  t1 = Time.now
159
158
 
160
159
  elapsed = t1 - t0
161
- puts "\nElapsed: #{'%3.2f' % elapsed} secs\n "
160
+ puts "Elapsed: #{'%3.2f' % elapsed} secs\n "
162
161
 
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.64
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-18 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
@@ -69,6 +69,11 @@ files:
69
69
  - empty_view/remote/banner/top.html
70
70
  - empty_view/remote/etc/GIT_IS_DUMB
71
71
  - empty_view/remote/permalink/GIT_IS_DUMB
72
+ - empty_view/remote/widgets/ad/GIT_IS_DUMB
73
+ - empty_view/remote/widgets/links/GIT_IS_DUMB
74
+ - empty_view/remote/widgets/news/GIT_IS_DUMB
75
+ - empty_view/remote/widgets/pages/GIT_IS_DUMB
76
+ - empty_view/remote/widgets/pinned/GIT_IS_DUMB
72
77
  - empty_view/themes/standard/README
73
78
  - empty_view/themes/standard/banner/about.lt3
74
79
  - empty_view/themes/standard/banner/austin-pano.jpg
@@ -97,7 +102,6 @@ files:
97
102
  - empty_view/themes/standard/widgets/ad/ad3.png
98
103
  - empty_view/themes/standard/widgets/ad/ad4.png
99
104
  - empty_view/themes/standard/widgets/bydates/README
100
- - empty_view/themes/standard/widgets/bydates/bydates.lt3
101
105
  - empty_view/themes/standard/widgets/bydates/bydates.rb
102
106
  - empty_view/themes/standard/widgets/bydates/card.css
103
107
  - empty_view/themes/standard/widgets/bydates/custom.rb
@@ -110,7 +114,6 @@ files:
110
114
  - empty_view/themes/standard/widgets/links/README
111
115
  - empty_view/themes/standard/widgets/links/card.css
112
116
  - empty_view/themes/standard/widgets/links/custom.rb
113
- - empty_view/themes/standard/widgets/links/links.lt3
114
117
  - empty_view/themes/standard/widgets/links/links.rb
115
118
  - empty_view/themes/standard/widgets/links/list.data
116
119
  - empty_view/themes/standard/widgets/links/local-vars.lt3
@@ -125,7 +128,6 @@ files:
125
128
  - empty_view/themes/standard/widgets/news/list.data
126
129
  - empty_view/themes/standard/widgets/news/local-vars.lt3
127
130
  - empty_view/themes/standard/widgets/news/main.css
128
- - empty_view/themes/standard/widgets/news/news.lt3
129
131
  - empty_view/themes/standard/widgets/news/news.rb
130
132
  - empty_view/themes/standard/widgets/news/pieces/card-head.lt3
131
133
  - empty_view/themes/standard/widgets/news/pieces/card-tail.lt3
@@ -142,7 +144,6 @@ files:
142
144
  - empty_view/themes/standard/widgets/pages/local.rb
143
145
  - empty_view/themes/standard/widgets/pages/main.css
144
146
  - empty_view/themes/standard/widgets/pages/other-stuff.lt3
145
- - empty_view/themes/standard/widgets/pages/pages.lt3
146
147
  - empty_view/themes/standard/widgets/pages/pages.rb
147
148
  - empty_view/themes/standard/widgets/pages/pieces/card-head.lt3
148
149
  - empty_view/themes/standard/widgets/pages/pieces/card-tail.lt3
@@ -157,7 +158,6 @@ files:
157
158
  - empty_view/themes/standard/widgets/pinned/pieces/card-tail.lt3
158
159
  - empty_view/themes/standard/widgets/pinned/pieces/main-head.lt3
159
160
  - empty_view/themes/standard/widgets/pinned/pieces/main-tail.lt3
160
- - empty_view/themes/standard/widgets/pinned/pinned.lt3
161
161
  - empty_view/themes/standard/widgets/pinned/pinned.rb
162
162
  - empty_view/themes/standard/widgets/search/README
163
163
  - empty_view/themes/standard/widgets/search/card.css
@@ -168,7 +168,6 @@ files:
168
168
  - empty_view/themes/standard/widgets/search/pieces/card-tail.lt3
169
169
  - empty_view/themes/standard/widgets/search/pieces/main-head.lt3
170
170
  - empty_view/themes/standard/widgets/search/pieces/main-tail.lt3
171
- - empty_view/themes/standard/widgets/search/search.lt3
172
171
  - empty_view/themes/standard/widgets/search/search.rb
173
172
  - empty_view/themes/standard/widgets/sitemap/README
174
173
  - empty_view/themes/standard/widgets/sitemap/card.css
@@ -179,7 +178,6 @@ files:
179
178
  - empty_view/themes/standard/widgets/sitemap/pieces/card-tail.lt3
180
179
  - empty_view/themes/standard/widgets/sitemap/pieces/main-head.lt3
181
180
  - empty_view/themes/standard/widgets/sitemap/pieces/main-tail.lt3
182
- - empty_view/themes/standard/widgets/sitemap/sitemap.lt3
183
181
  - empty_view/themes/standard/widgets/sitemap/sitemap.rb
184
182
  - empty_view/themes/standard/widgets/tag-cloud/OLD-example.lt3
185
183
  - empty_view/themes/standard/widgets/tag-cloud/README
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links bydates Posts by Date
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links links External Links
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links news Recent News
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links pages Pages
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links pinned Pinned Posts
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links search Search Posts
@@ -1,2 +0,0 @@
1
- .mixin liveblog
2
- .make_main_links sitemap Site Map