runeblog 0.2.60 → 0.2.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.lt3 +48 -11
- data/README.md +50 -11
- data/bin/blog +4 -3
- data/bin/mkwidget +65 -110
- data/empty_view/remote/widgets/ad/GIT_IS_DUMB +2 -0
- data/empty_view/remote/widgets/links/GIT_IS_DUMB +2 -0
- data/empty_view/remote/widgets/news/GIT_IS_DUMB +2 -0
- data/empty_view/remote/widgets/pages/GIT_IS_DUMB +2 -0
- data/empty_view/remote/widgets/pinned/GIT_IS_DUMB +2 -0
- data/empty_view/themes/standard/blog/generate.lt3 +1 -1
- data/empty_view/themes/standard/widgets/pinned/pinned.rb +1 -4
- data/lib/liveblog.rb +38 -259
- data/lib/repl.rb +4 -0
- data/lib/runeblog.rb +6 -17
- data/lib/runeblog_version.rb +1 -1
- data/test/austin.rb +4 -5
- metadata +7 -49
- data/empty_view/themes/standard/widgets/bydates/bydates.lt3 +0 -2
- data/empty_view/themes/standard/widgets/bydates/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/bydates/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/bydates/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/bydates/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/bydates/pieces/main-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/links/links.lt3 +0 -2
- data/empty_view/themes/standard/widgets/links/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/links/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/links/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/links/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/links/pieces/main-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/news/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/news/news.lt3 +0 -2
- data/empty_view/themes/standard/widgets/news/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/news/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/news/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/news/pieces/main-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/pages/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/pages/pages.lt3 +0 -2
- data/empty_view/themes/standard/widgets/pages/pieces/card-head.lt3 +0 -1
- data/empty_view/themes/standard/widgets/pages/pieces/card-tail.lt3 +0 -1
- data/empty_view/themes/standard/widgets/pages/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/pages/pieces/main-tail.lt3 +0 -2
- data/empty_view/themes/standard/widgets/pinned/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/pinned/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/pinned/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/pinned/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/pinned/pieces/main-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/pinned/pinned.lt3 +0 -2
- data/empty_view/themes/standard/widgets/search/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/search/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/search/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/search/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/search/pieces/main-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/search/search.lt3 +0 -2
- data/empty_view/themes/standard/widgets/sitemap/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/sitemap/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/sitemap/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/sitemap/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/sitemap/pieces/main-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/sitemap/sitemap.lt3 +0 -2
- data/empty_view/themes/standard/widgets/tag-cloud/local-vars.lt3 +0 -12
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/card-head.lt3 +0 -8
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/card-tail.lt3 +0 -4
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/main-head.lt3 +0 -10
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/main-tail.lt3 +0 -4
@@ -14,7 +14,7 @@
|
|
14
14
|
.include blog/head.lt3
|
15
15
|
<body>
|
16
16
|
|
17
|
-
$.banner text: top.html image: austin-pano.jpg // navbar
|
17
|
+
$.banner bgcolor: 101035 text: top.html image: austin-pano.jpg // navbar
|
18
18
|
<div class="content container-fluid mt-4">
|
19
19
|
<div class="row">
|
20
20
|
$.include blog/index.lt3
|
@@ -7,10 +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
|
-
File.open("/tmp/mehhh", "w") {|f| f.puts "#{@lines.inspect} in #{Dir.pwd}" }
|
14
11
|
end
|
15
12
|
|
16
13
|
def _html_body(file, css = nil) # FIXME
|
@@ -50,7 +47,7 @@ class ::RuneBlog::Widget
|
|
50
47
|
mainfile = "#{tag}-main"
|
51
48
|
File.open("#{mainfile}.html", "w") do |f|
|
52
49
|
_html_body(f, css) do
|
53
|
-
f.puts "<!-- #{@lines.inspect} in #{Dir.pwd} -->"
|
50
|
+
f.puts "<!-- #{@lines.inspect} in #{Dir.pwd} -->"
|
54
51
|
f.puts "<h1>#{card_title}</h1><br><hr>"
|
55
52
|
@links.each do |title, file|
|
56
53
|
title = title.gsub(/\\/, "") # kludge
|
data/lib/liveblog.rb
CHANGED
@@ -7,8 +7,6 @@ require 'runeblog'
|
|
7
7
|
require 'pathmagic'
|
8
8
|
require 'xlate'
|
9
9
|
|
10
|
-
# errfile = File.new("/tmp/liveblog.out", "w")
|
11
|
-
# STDERR.reopen(errfile)
|
12
10
|
|
13
11
|
def init_liveblog # FIXME - a lot of this logic sucks
|
14
12
|
here = Dir.pwd
|
@@ -28,8 +26,6 @@ end
|
|
28
26
|
# "dot" commands
|
29
27
|
##################
|
30
28
|
|
31
|
-
|
32
|
-
|
33
29
|
def dropcap
|
34
30
|
# Bad form: adds another HEAD
|
35
31
|
text = _data
|
@@ -72,11 +68,8 @@ def faq
|
|
72
68
|
ques = _data.chomp
|
73
69
|
ans = _body_text
|
74
70
|
id = "faq#@faq_count"
|
75
|
-
# _out %[ <a class="btn btn-default btn-xs" data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample">+</a>]
|
76
71
|
_out %[ <a data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample"><font size=+3>⌄</font></a>]
|
77
72
|
_out %[ <b>#{ques}</b>]
|
78
|
-
# _out "<font size=-2><br></font>" if @faq_count == 1
|
79
|
-
# _out "<br>" unless @faq_count == 1
|
80
73
|
_out %[<div class="collapse" id="#{id}"><br><font size=+1> #{ans}</font></div>\n]
|
81
74
|
_out "<br>" unless @faq_count == 1
|
82
75
|
_optional_blank_line
|
@@ -93,11 +86,21 @@ def _read_navbar_data
|
|
93
86
|
end
|
94
87
|
|
95
88
|
def banner # still experimental
|
96
|
-
_out "<table width=100% bgcolor=#101035>"
|
97
|
-
_out " <tr>"
|
98
89
|
enum = _args.each
|
99
90
|
count = 0
|
100
91
|
span = 1
|
92
|
+
first = enum.peek
|
93
|
+
if first.start_with?("bgcolor:")
|
94
|
+
enum.next
|
95
|
+
bg = enum.next
|
96
|
+
else
|
97
|
+
bg = nil # bg = white - do nothing
|
98
|
+
end
|
99
|
+
str = "<table width=100%"
|
100
|
+
str << (bg ? " bgcolor=##{bg}>" : ">")
|
101
|
+
_out str
|
102
|
+
_out " <tr>"
|
103
|
+
|
101
104
|
loop do
|
102
105
|
count += 1
|
103
106
|
arg = enum.next
|
@@ -119,17 +122,14 @@ def banner # still experimental
|
|
119
122
|
_out "<td colspan=#{span}>" + File.read(file) + "</td>" +
|
120
123
|
" <!-- #{arg} -->"
|
121
124
|
when "navbar"
|
122
|
-
# STDERR.puts "-- navbar: pwd = #{Dir.pwd}: #{`ls`}"
|
123
125
|
dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
|
124
126
|
_make_navbar # horiz is default
|
125
|
-
# xlate cwd: dir, src: "navbar.lt3", dst: "navbar.html" # , debug: true
|
126
127
|
stuff = File.read("banner/navbar.html")
|
127
128
|
_out "<td colspan=#{span}><div style='text-align: center'>#{stuff}</div></td>" +
|
128
129
|
" <!-- #{arg} -->"
|
129
130
|
when "vnavbar"
|
130
131
|
dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
|
131
132
|
_make_navbar(:vert)
|
132
|
-
# xlate cwd: dir, src: "vnavbar.lt3", dst: "vnavbar.html" # , debug: true
|
133
133
|
file = "banner/vnavbar.html"
|
134
134
|
_out "<td colspan=#{span}>" + File.read(file) + "</td>" +
|
135
135
|
"<!-- #{arg} -->"
|
@@ -197,21 +197,6 @@ def list!
|
|
197
197
|
_optional_blank_line
|
198
198
|
end
|
199
199
|
|
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
200
|
### inset
|
216
201
|
|
217
202
|
def inset
|
@@ -232,7 +217,6 @@ def inset
|
|
232
217
|
else # Only into body
|
233
218
|
output << line
|
234
219
|
end
|
235
|
-
# _passthru(line)
|
236
220
|
end
|
237
221
|
lr = _args.first
|
238
222
|
wide = _args[1] || "25"
|
@@ -241,10 +225,6 @@ def inset
|
|
241
225
|
_out "</p>" # kludge!! nopara
|
242
226
|
0.upto(2) {|i| _passthru output[i] }
|
243
227
|
_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
228
|
3.upto(output.length-1) {|i| _passthru output[i] }
|
249
229
|
_out "<p>" # kludge!! para
|
250
230
|
_optional_blank_line
|
@@ -256,7 +236,6 @@ def title
|
|
256
236
|
@meta.title = title
|
257
237
|
setvar :title, title
|
258
238
|
# FIXME refactor -- just output variables for a template
|
259
|
-
# _out %[<h1 class="post-title">#{title}</h1><br>]
|
260
239
|
_optional_blank_line
|
261
240
|
end
|
262
241
|
|
@@ -346,15 +325,8 @@ def teaser
|
|
346
325
|
end
|
347
326
|
|
348
327
|
def finalize
|
349
|
-
|
350
|
-
|
351
|
-
STDERR.puts "META is nil: file = #{Livetext::Vars[:File]}"
|
352
|
-
# puts @live.body
|
353
|
-
return
|
354
|
-
end
|
355
|
-
if @blog.nil?
|
356
|
-
return @meta
|
357
|
-
end
|
328
|
+
return unless @meta
|
329
|
+
return @meta if @blog.nil?
|
358
330
|
|
359
331
|
@slug = @blog.make_slug(@meta)
|
360
332
|
slug_dir = @slug
|
@@ -480,7 +452,18 @@ def pinned_rebuild
|
|
480
452
|
widget = code.new(@blog)
|
481
453
|
widget.build
|
482
454
|
end
|
483
|
-
_include_file wtag/"pinned-card.html"
|
455
|
+
# _include_file wtag/"pinned-card.html"
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
def _handle_standard_widget(tag)
|
461
|
+
wtag = :widgets/tag
|
462
|
+
code = _load_local(tag)
|
463
|
+
if code
|
464
|
+
Dir.chdir(wtag) do
|
465
|
+
widget = code.new(@blog)
|
466
|
+
widget.build
|
484
467
|
end
|
485
468
|
end
|
486
469
|
end
|
@@ -494,7 +477,7 @@ def sidebar
|
|
494
477
|
|
495
478
|
_out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
|
496
479
|
|
497
|
-
standard = %w[pinned pages links]
|
480
|
+
standard = %w[pinned pages links news]
|
498
481
|
|
499
482
|
_body do |token|
|
500
483
|
tag = token.chomp.strip.downcase
|
@@ -502,34 +485,23 @@ def sidebar
|
|
502
485
|
raise "Can't find #{wtag}" unless Dir.exist?(wtag)
|
503
486
|
tcard = "#{tag}-card.html"
|
504
487
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
488
|
+
case
|
489
|
+
when standard.include?(tag)
|
490
|
+
_handle_standard_widget(tag)
|
491
|
+
when tag == "ad"
|
492
|
+
num = rand(1..4)
|
493
|
+
img = "widgets/ad/ad#{num}.png"
|
494
|
+
src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
|
495
|
+
system!("cp #{src} #{dst}") # , show: true)
|
496
|
+
File.open(wtag/"vars.lt3", "w") do |f|
|
497
|
+
f.puts ".set ad.image = #{img}"
|
511
498
|
end
|
512
|
-
|
513
|
-
_include_file wtag/tcard
|
514
|
-
next
|
515
|
-
end
|
516
|
-
|
517
|
-
if tag == "ad"
|
518
|
-
num = rand(1..4)
|
519
|
-
img = "widgets/ad/ad#{num}.png"
|
520
|
-
src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
|
521
|
-
system!("cp #{src} #{dst}") # , show: true)
|
522
|
-
File.open(wtag/"vars.lt3", "w") do |f|
|
523
|
-
f.puts ".set ad.image = #{img}"
|
524
|
-
end
|
525
|
-
xlate cwd: wtag, src: tag, dst: tcard, force: true # , deps: depend # , debug: true
|
499
|
+
xlate cwd: wtag, src: tag, dst: tcard, force: true # , deps: depend # , debug: true
|
526
500
|
end
|
527
501
|
|
528
502
|
_include_file wtag/tcard
|
529
503
|
# depend = %w[card.css main.css custom.rb local.rb]
|
530
504
|
# depend += ["#{wtag}.lt3", "#{wtag}.rb"]
|
531
|
-
# depend += %w[pieces/card-head.lt3 pieces/card-tail.lt3]
|
532
|
-
# depend += %w[pieces/main-head.lt3 pieces/main-tail.lt3]
|
533
505
|
# depend.map! {|x| @blog.view.dir/"themes/standard/widgets"/wtag/x }
|
534
506
|
# _debug "--- call xlate #{tag} src = #{tag} dst = #{tcard}\r"
|
535
507
|
end
|
@@ -556,21 +528,6 @@ def script
|
|
556
528
|
_out %[<script src="#{url}" integrity="#{integ}" crossorigin="#{cross}"></script>]
|
557
529
|
end
|
558
530
|
|
559
|
-
def card_iframe
|
560
|
-
title, lines = _data, _body
|
561
|
-
lines.map!(&:chomp)
|
562
|
-
url = lines[0].chomp
|
563
|
-
stuff = lines[1..-1].join(" ") # FIXME later
|
564
|
-
middle = <<-HTML
|
565
|
-
<iframe src="#{url}" #{stuff}
|
566
|
-
style="border: 0" #{stuff}
|
567
|
-
frameborder="0" scrolling="no">
|
568
|
-
</iframe>
|
569
|
-
HTML
|
570
|
-
|
571
|
-
_card_generic(card_title: title, middle: middle, extra: "bg-dark text-white")
|
572
|
-
end
|
573
|
-
|
574
531
|
$Dot = self # Clunky! for dot commands called from Functions class
|
575
532
|
|
576
533
|
# Find a better way to do this?
|
@@ -607,59 +564,10 @@ class Livetext::Functions
|
|
607
564
|
def _var(name)
|
608
565
|
::Livetext::Vars[name] || "[:#{name} is undefined]"
|
609
566
|
end
|
610
|
-
|
611
|
-
# def link(param = nil)
|
612
|
-
# puts "--- WTF?? param = #{param.inspect}"; gets
|
613
|
-
# file, cdata = param.split("||", 2)
|
614
|
-
# %[<a href="assets/#{file}">#{cdata}</a>]
|
615
|
-
# end
|
616
|
-
#
|
617
|
-
# def link(param = nil)
|
618
|
-
# file, cdata = param.split("||", 2)
|
619
|
-
# %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}#{file}" title="#{_var(:title)}">]
|
620
|
-
# end
|
621
567
|
end
|
622
568
|
|
623
569
|
###
|
624
570
|
|
625
|
-
def card1
|
626
|
-
title, lines = _data, _body
|
627
|
-
lines.map!(&:chomp)
|
628
|
-
|
629
|
-
card_text = lines[0]
|
630
|
-
url, classname, cdata = lines[1].split(",", 4)
|
631
|
-
main = _main(url)
|
632
|
-
|
633
|
-
middle = <<-HTML
|
634
|
-
<p class="card-text">#{card_text}</p>
|
635
|
-
<a #{main} class="#{classname}">#{cdata}</a>
|
636
|
-
HTML
|
637
|
-
|
638
|
-
_card_generic(card_title: title, middle: middle, extra: "bg-dark text-white")
|
639
|
-
end
|
640
|
-
|
641
|
-
def card2
|
642
|
-
str = _data
|
643
|
-
file, card_title = str.chomp.split(" ", 2)
|
644
|
-
card_title = %[<a #{_main(file)} style="text-decoration: none; color: black">#{card_title}</a>]
|
645
|
-
|
646
|
-
# FIXME is this wrong??
|
647
|
-
|
648
|
-
open = <<-HTML
|
649
|
-
<div class="card mb-3">
|
650
|
-
<div class="card-body">
|
651
|
-
<h5 class="card-title">#{card_title}</h5>
|
652
|
-
<ul class="list-group list-group-flush">
|
653
|
-
HTML
|
654
|
-
_out open
|
655
|
-
_body do |line|
|
656
|
-
url, cdata = line.chomp.split(",", 3)
|
657
|
-
main = _main(url)
|
658
|
-
_out %[<li class="list-group-item"><a #{main}}">#{cdata}</a> </li>]
|
659
|
-
end
|
660
|
-
close = %[ </ul>\n </div>\n </div>]
|
661
|
-
_out close
|
662
|
-
end
|
663
571
|
|
664
572
|
def tag_cloud
|
665
573
|
title = _data
|
@@ -686,17 +594,14 @@ end
|
|
686
594
|
|
687
595
|
def vnavbar
|
688
596
|
str = _make_navbar(:vert)
|
689
|
-
# _out str
|
690
597
|
end
|
691
598
|
|
692
599
|
def hnavbar
|
693
600
|
str = _make_navbar # horiz is default
|
694
|
-
# _out str
|
695
601
|
end
|
696
602
|
|
697
603
|
def navbar
|
698
604
|
str = _make_navbar # horiz is default
|
699
|
-
# _out str
|
700
605
|
end
|
701
606
|
|
702
607
|
def _make_navbar(orient = :horiz)
|
@@ -757,123 +662,6 @@ def _html_body(file, css = nil)
|
|
757
662
|
file.puts " </body>\n</html>"
|
758
663
|
end
|
759
664
|
|
760
|
-
def _write_card(cardfile, mainfile, pairs, card_title, tag)
|
761
|
-
log!(str: "Creating #{cardfile}.html", pwd: true, level: 2)
|
762
|
-
url = mainfile
|
763
|
-
url = :widgets/tag/mainfile + ".html"
|
764
|
-
File.open("#{cardfile}.html", "w") do |f|
|
765
|
-
f.puts <<-EOS
|
766
|
-
<div class="card mb-3">
|
767
|
-
<div class="card-body">
|
768
|
-
<h5 class="card-title">
|
769
|
-
<button type="button" class="btn btn-primary" data-toggle="collapse" data-target="##{tag}">+</button>
|
770
|
-
<a href="javascript: void(0)"
|
771
|
-
onclick="javascript:open_main('#{url}')"
|
772
|
-
style="text-decoration: none; color: black"> #{card_title}</a>
|
773
|
-
</h5>
|
774
|
-
<div class="collapse" id="#{tag}">
|
775
|
-
EOS
|
776
|
-
log!(str: "Writing data pairs to #{cardfile}.html", pwd: true, level: 2)
|
777
|
-
local = _local_tag?(tag)
|
778
|
-
pairs.each do |file, title|
|
779
|
-
url = file
|
780
|
-
type, title = page_type(tag, title)
|
781
|
-
case type
|
782
|
-
when :local; url_ref = _widget_card(file, tag) # local always frameable
|
783
|
-
when :frame; url_ref = _main(file) # remote, frameable
|
784
|
-
when :noframe; url_ref = _blank(file) # remote, not frameable
|
785
|
-
end
|
786
|
-
anchor = %[<a #{url_ref}>#{title}</a>]
|
787
|
-
wrapper = %[<li class="list-group-item">#{anchor}</li>]
|
788
|
-
f.puts wrapper
|
789
|
-
end
|
790
|
-
_include_file cardfile+".html"
|
791
|
-
f.puts <<-EOS
|
792
|
-
</div>
|
793
|
-
</div>
|
794
|
-
</div>
|
795
|
-
EOS
|
796
|
-
end
|
797
|
-
end
|
798
|
-
|
799
|
-
def _local_tag?(tag)
|
800
|
-
case tag.to_sym
|
801
|
-
when :pages
|
802
|
-
true
|
803
|
-
when :news, :links
|
804
|
-
false
|
805
|
-
else
|
806
|
-
true # Hmmm...
|
807
|
-
end
|
808
|
-
end
|
809
|
-
|
810
|
-
def page_type(tag, title)
|
811
|
-
yesno = "yes"
|
812
|
-
yesno, title = title.split(/, */) if title =~ /^[yes|no]/
|
813
|
-
local = _local_tag?(tag)
|
814
|
-
frameable = (yesno == "yes")
|
815
|
-
if local
|
816
|
-
return [:local, title]
|
817
|
-
elsif frameable
|
818
|
-
return [:frame, title]
|
819
|
-
else
|
820
|
-
return [:noframe, title]
|
821
|
-
end
|
822
|
-
end
|
823
|
-
|
824
|
-
def _write_main_pages(mainfile, pairs, card_title, tag)
|
825
|
-
local = _local_tag?(tag)
|
826
|
-
pieces = @blog.view.dir/"themes/standard/widgets"/tag/:pieces
|
827
|
-
main_head = xlate! cwd: pieces, src: "main-head.lt3"
|
828
|
-
main_tail = xlate! cwd: pieces, src: "main-tail.lt3"
|
829
|
-
# ^ make into methods in pages.rb or whatever?
|
830
|
-
|
831
|
-
File.open("#{mainfile}.html", "w") do |f|
|
832
|
-
f.puts main_head
|
833
|
-
pairs.each do |file, title|
|
834
|
-
type, title = page_type(tag, title)
|
835
|
-
title = title.gsub(/\\/, "") # kludge
|
836
|
-
case type
|
837
|
-
when :local; url_ref = _widget_main(file, tag) # local always frameable
|
838
|
-
when :frame; url_ref = "href = '#{file}'" # local always frameable
|
839
|
-
when :noframe; url_ref = _blank(file) # local always frameable
|
840
|
-
end
|
841
|
-
css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
|
842
|
-
f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
|
843
|
-
end
|
844
|
-
f.puts main_tail
|
845
|
-
end
|
846
|
-
end
|
847
|
-
|
848
|
-
def _write_main(mainfile, pairs, card_title, tag)
|
849
|
-
log!(str: "Creating #{mainfile}.html", pwd: true, level: 2)
|
850
|
-
|
851
|
-
if tag == "pages" # temporary experiment
|
852
|
-
_write_main_pages(mainfile, pairs, card_title, tag)
|
853
|
-
return
|
854
|
-
end
|
855
|
-
|
856
|
-
local = _local_tag?(tag)
|
857
|
-
setvar "card.title", card_title
|
858
|
-
css = "* { font-family: verdana }"
|
859
|
-
File.open("#{mainfile}.html", "w") do |f|
|
860
|
-
_html_body(f, css) do
|
861
|
-
f.puts "<h1>#{card_title}</h1><br><hr>"
|
862
|
-
pairs.each do |file, title|
|
863
|
-
type, title = page_type(tag, title)
|
864
|
-
title = title.gsub(/\\/, "") # kludge
|
865
|
-
case type
|
866
|
-
when :local; url_ref = _widget_main(file, tag) # local always frameable
|
867
|
-
when :frame; url_ref = "href = '#{file}'" # local always frameable
|
868
|
-
when :noframe; url_ref = _blank(file) # local always frameable
|
869
|
-
end
|
870
|
-
css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
|
871
|
-
f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
|
872
|
-
end
|
873
|
-
end
|
874
|
-
end
|
875
|
-
end
|
876
|
-
|
877
665
|
def _errout(*args)
|
878
666
|
::STDERR.puts *args
|
879
667
|
end
|
@@ -948,12 +736,3 @@ def _blank(url)
|
|
948
736
|
%[href='#{url}' target='blank']
|
949
737
|
end
|
950
738
|
|
951
|
-
def _widget_main(url, tag)
|
952
|
-
%[href="#{url}"]
|
953
|
-
end
|
954
|
-
|
955
|
-
def _widget_card(url, tag)
|
956
|
-
url2 = :widgets/tag/url
|
957
|
-
%[href="javascript: void(0)" onclick="javascript:open_main('#{url2}')"]
|
958
|
-
end
|
959
|
-
|