runeblog 0.2.22 → 0.2.23

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: cd57361521e7c935c03e98dbdfdabea0d04a36ff4082c67017d2a5d90a889af8
4
- data.tar.gz: 10aab8f0bf2dda01cbd2f65d16bb5808a865360527c878262df9cf02b1247394
3
+ metadata.gz: 9cc566d6d2bab06cc0ebae132df00abdca260c85ec765b98e3ad3fe4ec113f1a
4
+ data.tar.gz: 1f42d27dae45ad5a49add0c85b075dfb22198b851a897549478d2ce76d7e7ca6
5
5
  SHA512:
6
- metadata.gz: '007719e1eb7df131e68b470f53e292ea82742bcccb2226979af578258645b21fc6d9904a6ebce028621709858363f364baa3b0d72957901f7c1cdff28c377ab7'
7
- data.tar.gz: 459286ef17981cfb9a322e2e8210a50e294eb282639993a352c1f611d83992b3986ce5009ace7762a26bff85fd0304b0d427a62424ffa656cd9306139c8be127
6
+ metadata.gz: e2133d99e869f9f75d0caaa4f607338dddb4e900dd6a098c3729eb989c9cb398b123cea14ec8aaa572424fdf42acd079b7b8ac845c3bfdad0575c8fe11247a78
7
+ data.tar.gz: 6bf7fab834a1b6104c8b36588316810a061c0425ffa6512414a8307bf0f09469f0b6a1c3efca27fc43906f597d3c14c15c3d5979e2f5381960089a01ae164b4c
data/empty_view.tgz CHANGED
Binary file
data/lib/liveblog.rb CHANGED
@@ -47,6 +47,10 @@ def post
47
47
  _out " <!-- Post number #{@meta.num} -->\n "
48
48
  end
49
49
 
50
+ def backlink
51
+ _out %[<br><a href="javascript:history.go(-1)">[Back]</a>]
52
+ end
53
+
50
54
  def quote
51
55
  _passthru "<blockquote>"
52
56
  _passthru _body
@@ -105,7 +109,7 @@ end
105
109
  def _write_card(cardfile, mainfile, pairs, card_title, tag, relative: true)
106
110
  log!(str: "Creating #{cardfile}.html", pwd: true)
107
111
  url = mainfile
108
- url = :widgets/tag/mainfile + ".html" # if tag == "pages" # FIXME
112
+ url = :widgets/tag/mainfile + ".html"
109
113
  File.open("#{cardfile}.html", "w") do |f|
110
114
  f.puts <<-EOS
111
115
  <div class="card mb-3">
@@ -117,20 +121,28 @@ def _write_card(cardfile, mainfile, pairs, card_title, tag, relative: true)
117
121
  </h5>
118
122
  EOS
119
123
  log!(str: "Writing data pairs to #{cardfile}.html", pwd: true)
124
+ local = _local_tag?(tag)
120
125
  pairs.each do |file, title|
121
126
  url = file
122
- if ["news", "links"].include? tag
123
- frameable, title = title.split(/, */, 2)
124
- frameable = (frameable.downcase == "yes")
125
- if frameable
126
- anchor = %[<a href="javascript: void(0)" onclick="javascript:open_main('#{url}')">#{title}</a>]
127
- else
128
- anchor = %[<a href='#{url}' target='_blank'>#{title}</a>]
129
- end
130
- else
131
- url = :widgets/tag/file
132
- anchor = %[<a href="javascript: void(0)" onclick="javascript:open_main('#{url}')">#{title}</a>]
127
+ yesno = "yes"
128
+ yesno, title = title.split(/, */) if title =~ /^[yes|no]/ # FIXME please!
129
+
130
+ case [yesno, local]
131
+ when ["yes", false] # can iframe, remote file
132
+ which = 1
133
+ url_ref = "href='#{file}'"
134
+ when ["yes", true] # can iframe, local file
135
+ which = 2
136
+ url_ref = _widget_card(file, tag)
137
+ when ["no", false] # CAN'T iframe, remote file
138
+ which = 3
139
+ url_ref = _blank(file)
140
+ when ["no", true] # CAN'T iframe, local file (possible?)
141
+ which = 4
142
+ url_ref = _blank(file)
133
143
  end
144
+
145
+ anchor = %[<a #{url_ref}>#{title}</a>]
134
146
  wrapper = %[<li class="list-group-item">#{anchor}</li>]
135
147
  f.puts wrapper
136
148
  end
@@ -141,23 +153,44 @@ def _write_card(cardfile, mainfile, pairs, card_title, tag, relative: true)
141
153
  end
142
154
  end
143
155
 
156
+ def _local_tag?(tag)
157
+ case tag.to_sym
158
+ when :pages
159
+ true
160
+ when :news, :links
161
+ false
162
+ else
163
+ true # Hmmm...
164
+ end
165
+ end
166
+
144
167
  def _write_main(mainfile, pairs, card_title, tag)
145
168
  log!(str: "Creating #{mainfile}.html", pwd: true)
146
- STDERR.puts "---- tag = #{tag.inspect}"
169
+ local = _local_tag?(tag)
147
170
  File.open("#{mainfile}.html", "w") do |f|
148
171
  _html_body(f) do
149
172
  f.puts "<h1>#{card_title}</h1>"
150
173
  pairs.each do |file, title|
151
- # FIXME please!
152
- STDERR.puts "---- title1 = #{title.inspect}"
153
- yesno, title = title.split(/, */) if title =~ /^[yes|no]/
154
- STDERR.puts "---- title2 = #{title.inspect}"
155
- url = (file.start_with?("http") ? _main(file) : :widgets/tag/file)
156
- f.puts %[<a style="text-decoration: none; font-size: 24px" href='#{url}'>#{title}</a> <br>]
174
+ yesno = "yes"
175
+ yesno, title = title.split(/, */) if title =~ /^[yes|no]/ # FIXME please!
176
+ case [yesno, local]
177
+ when ["yes", false] # can iframe, remote file
178
+ which = 1
179
+ url_ref = "href='#{file}'"
180
+ when ["yes", true] # can iframe, local file
181
+ which = 2
182
+ url_ref = _widget_main(file, tag)
183
+ when ["no", false] # CAN'T iframe, remote file
184
+ which = 3
185
+ url_ref = _blank(file)
186
+ when ["no", true] # CAN'T iframe, local file (possible?)
187
+ which = 4
188
+ url_ref = _blank(file)
189
+ end
190
+ f.puts %[<a style="text-decoration: none; font-size: 24px" #{url_ref}>#{title}</a> <br>]
157
191
  end
158
192
  end
159
193
  end
160
- STDERR.puts
161
194
  end
162
195
 
163
196
  def make_main_links
@@ -448,32 +481,25 @@ def recent_posts # side-effect
448
481
  end
449
482
 
450
483
  def sidebar
451
- STDERR.puts "---- SIDEBAR pwd = #{Dir.pwd}"
452
- _out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
453
- _body do |token|
454
- tag = token.chomp.strip.downcase
455
- wtag = :widgets/tag
456
- raise "Can't find #{wtag}" unless Dir.exist?(wtag)
457
- tcard = "#{tag}-card.html"
458
- xlate cwd: wtag, src: tag, dst: tcard
459
- _include_file wtag/tcard
460
- end
461
- _out %[</div>]
462
- end
463
-
464
- def sidebar!
465
484
  if _args.include? "off"
466
485
  _body { } # iterate, do nothing
467
486
  return
468
487
  end
469
488
 
470
489
  _out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
471
- _args do |token|
490
+ _body do |token|
472
491
  tag = token.chomp.strip.downcase
473
492
  wtag = :widgets/tag
474
493
  raise "Can't find #{wtag}" unless Dir.exist?(wtag)
475
494
  tcard = "#{tag}-card.html"
476
- xlate cwd: wtag, src: tag, dst: tcard
495
+ if File.exist?(wtag/"SUBFILES")
496
+ children = Dir[wtag/"*.lt3"] - [wtag/tag+".lt3"]
497
+ children.each do |child|
498
+ dest = child.sub(/.lt3$/, ".html")
499
+ xlate src: child, dst: dest, debug: true
500
+ end
501
+ end
502
+ xlate cwd: wtag, src: tag, dst: tcard, debug: true
477
503
  _include_file wtag/tcard
478
504
  end
479
505
  _out %[</div>]
@@ -546,7 +572,20 @@ def card_iframe
546
572
  end
547
573
 
548
574
  def _main(url)
549
- %["javascript: void(0)" onclick="javascript:open_main('#{url}')"]
575
+ %[href="javascript: void(0)" onclick="javascript:open_main('#{url}')"]
576
+ end
577
+
578
+ def _blank(url)
579
+ %[href='#{url}' target='blank']
580
+ end
581
+
582
+ def _widget_main(url, tag)
583
+ %[href="#{url}"]
584
+ end
585
+
586
+ def _widget_card(url, tag)
587
+ url2 = :widgets/tag/url
588
+ %[href="#{url2}"]
550
589
  end
551
590
 
552
591
  def card1
@@ -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.22"
5
+ VERSION = "0.2.23"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
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.22
4
+ version: 0.2.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton