runeblog 0.2.39 → 0.2.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mkwidget +209 -0
- data/empty_view/themes/standard/blog/index.lt3 +0 -1
- data/empty_view/themes/standard/etc/blog.css.lt3 +6 -1
- data/empty_view/themes/standard/navbar/faq.lt3 +1 -0
- data/empty_view/themes/standard/navbar/navbar.lt3 +1 -0
- data/empty_view/themes/standard/post/generate.lt3 +9 -4
- data/empty_view/themes/standard/widgets/ad/ad.lt3 +8 -1
- data/empty_view/themes/standard/widgets/ad/ad1.png +0 -0
- data/empty_view/themes/standard/widgets/ad/ad2.png +0 -0
- data/empty_view/themes/standard/widgets/ad/ad3.png +0 -0
- data/empty_view/themes/standard/widgets/ad/ad4.png +0 -0
- data/empty_view/themes/standard/widgets/bydates/README +2 -0
- data/empty_view/themes/standard/widgets/bydates/bydates.lt3 +2 -0
- data/empty_view/themes/standard/widgets/bydates/bydates.rb +14 -0
- data/empty_view/themes/standard/widgets/bydates/card.css +1 -0
- data/empty_view/themes/standard/widgets/bydates/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/bydates/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/bydates/main.css +2 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/links/README +2 -0
- data/empty_view/themes/standard/widgets/links/card.css +1 -0
- data/empty_view/themes/standard/widgets/links/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/links/links.lt3 +1 -1
- data/empty_view/themes/standard/widgets/links/links.rb +14 -0
- data/empty_view/themes/standard/widgets/links/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/links/main.css +2 -0
- data/empty_view/themes/standard/widgets/links/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/links/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/links/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/links/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/news/README +2 -0
- data/empty_view/themes/standard/widgets/news/card.css +1 -0
- data/empty_view/themes/standard/widgets/news/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/news/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/news/main.css +2 -0
- data/empty_view/themes/standard/widgets/news/news.rb +14 -0
- data/empty_view/themes/standard/widgets/news/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/news/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/news/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/news/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/pages/{pieces/card.css → card.css} +0 -0
- data/empty_view/themes/standard/widgets/pages/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/pages/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/pages/main.css +2 -0
- data/empty_view/themes/standard/widgets/pages/pages.rb +4 -1
- data/empty_view/themes/standard/widgets/pages/pieces/main-head.lt3 +3 -1
- data/empty_view/themes/standard/widgets/pinned/README +2 -0
- data/empty_view/themes/standard/widgets/pinned/card.css +1 -0
- data/empty_view/themes/standard/widgets/pinned/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/pinned/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/pinned/main.css +2 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/pinned/pinned.lt3 +2 -0
- data/empty_view/themes/standard/widgets/pinned/pinned.rb +14 -0
- data/empty_view/themes/standard/widgets/search/README +2 -0
- data/empty_view/themes/standard/widgets/search/card.css +1 -0
- data/empty_view/themes/standard/widgets/search/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/search/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/search/main.css +2 -0
- data/empty_view/themes/standard/widgets/search/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/search/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/search/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/search/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/search/search.lt3 +2 -0
- data/empty_view/themes/standard/widgets/search/search.rb +14 -0
- data/empty_view/themes/standard/widgets/sitemap/README +2 -0
- data/empty_view/themes/standard/widgets/sitemap/card.css +1 -0
- data/empty_view/themes/standard/widgets/sitemap/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/sitemap/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/sitemap/main.css +2 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/sitemap/sitemap.lt3 +2 -0
- data/empty_view/themes/standard/widgets/sitemap/sitemap.rb +14 -0
- data/empty_view/themes/standard/widgets/tag-cloud/OLD-example.lt3 +12 -0
- data/empty_view/themes/standard/widgets/tag-cloud/README +2 -0
- data/empty_view/themes/standard/widgets/tag-cloud/card.css +1 -0
- data/empty_view/themes/standard/widgets/tag-cloud/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/tag-cloud/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/tag-cloud/main.css +2 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/tag-cloud/tag-cloud.lt3 +1 -10
- data/empty_view/themes/standard/widgets/tag-cloud/tag-cloud.rb +14 -0
- data/lib/default.rb +1 -4
- data/lib/global.rb +8 -7
- data/lib/helpers-blog.rb +15 -15
- data/lib/liveblog.rb +62 -28
- data/lib/logging.rb +17 -8
- data/lib/post.rb +6 -6
- data/lib/publish.rb +4 -4
- data/lib/runeblog.rb +79 -47
- data/lib/runeblog_version.rb +1 -1
- data/lib/view.rb +2 -8
- data/lib/xlate.rb +2 -2
- data/test/austin.rb +150 -0
- data/test/make_blog.rb +23 -2
- metadata +88 -8
- data/empty_view/remote/widgets/links/list.data +0 -3
- data/empty_view/remote/widgets/news/list.data +0 -4
- data/empty_view/remote/widgets/pages/list.data +0 -4
- data/empty_view/themes/standard/widgets/calendar/calendar.lt3 +0 -6
- data/empty_view/themes/standard/widgets/pages/pieces/main.css +0 -1
@@ -1,12 +1,3 @@
|
|
1
1
|
.mixin liveblog
|
2
2
|
|
3
|
-
|
4
|
-
https://google.com/,btn btn-dark m-1,Programming
|
5
|
-
https://google.com/,btn btn-danger m-1,Science Fiction
|
6
|
-
https://google.com/,btn btn-light m-1,Art
|
7
|
-
https://google.com/,btn btn-dark m-1,Robotics
|
8
|
-
https://google.com/,btn btn-warning m-1,Food and Travel
|
9
|
-
https://google.com/,btn btn-light m-1,DIY Hacks
|
10
|
-
https://google.com/,btn btn-info m-1,Surfing
|
11
|
-
.end
|
12
|
-
|
3
|
+
<h3>Currently nothing here -- not implemented</h3)
|
data/lib/default.rb
CHANGED
@@ -5,7 +5,7 @@ class RuneBlog::Default
|
|
5
5
|
def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_view",
|
6
6
|
teaser: "No teaser", body: "No body", tags: ["untagged"],
|
7
7
|
views: [], back: "javascript:history.go(-1)", home: "no url")
|
8
|
-
log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home])
|
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
11
|
<<-TEXT
|
@@ -28,6 +28,3 @@ TEXT
|
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
data/lib/global.rb
CHANGED
@@ -20,7 +20,7 @@ end
|
|
20
20
|
# Refactor, move stuff elsewhere?
|
21
21
|
|
22
22
|
def make_exception(sym, str)
|
23
|
-
log!(enter: __method__, args: [sym, str])
|
23
|
+
log!(enter: __method__, args: [sym, str], level: 3)
|
24
24
|
return if Object.constants.include?(sym)
|
25
25
|
Object.const_set(sym, StandardError.dup)
|
26
26
|
define_method(sym) do |*args|
|
@@ -30,8 +30,9 @@ def make_exception(sym, str)
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def system!(str)
|
34
|
-
log!(enter: __method__, args: [str])
|
33
|
+
def system!(str, show: false)
|
34
|
+
log!(enter: __method__, args: [str], level: 2)
|
35
|
+
STDERR.puts str if show
|
35
36
|
rc = system(str)
|
36
37
|
if rc
|
37
38
|
return rc
|
@@ -44,12 +45,12 @@ end
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def prefix(num)
|
47
|
-
log!(enter: __method__, args: [num])
|
48
|
+
log!(enter: __method__, args: [num], level: 3)
|
48
49
|
"#{'%04d' % num.to_i}"
|
49
50
|
end
|
50
51
|
|
51
52
|
def check_meta(meta, where = "")
|
52
|
-
log!(enter: __method__, args: [meta, where])
|
53
|
+
log!(enter: __method__, args: [meta, where], level: 3)
|
53
54
|
str = "--- #{where}\n"
|
54
55
|
str << "\ncheck_meta: \n" + caller.join("\n") + "\n meta = #{meta.inspect}\n"
|
55
56
|
str << " title missing!\n" unless meta.title
|
@@ -62,14 +63,14 @@ def check_meta(meta, where = "")
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def verify(hash)
|
65
|
-
log!(enter: __method__, args: [hash])
|
66
|
+
log!(enter: __method__, args: [hash], level: 3)
|
66
67
|
hash.each_pair do |expr, msg|
|
67
68
|
puts "<< #{msg}" unless expr
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
72
|
def assure(hash) # really the same as verify for now...
|
72
|
-
log!(enter: __method__, args: [hash])
|
73
|
+
log!(enter: __method__, args: [hash], level: 3)
|
73
74
|
hash.each_pair do |expr, msg|
|
74
75
|
puts "<< #{msg}" unless expr
|
75
76
|
end
|
data/lib/helpers-blog.rb
CHANGED
@@ -6,14 +6,14 @@ require 'xlate'
|
|
6
6
|
module RuneBlog::Helpers
|
7
7
|
|
8
8
|
def copy(src, dst)
|
9
|
-
log!(enter: __method__, args: [src, dst])
|
9
|
+
log!(enter: __method__, args: [src, dst], level: 2)
|
10
10
|
cmd = "cp #{src} #{dst} 2>/dev/null"
|
11
11
|
rc = system!(cmd)
|
12
12
|
puts " Failed: #{cmd} - from #{caller[0]}" unless rc
|
13
13
|
end
|
14
14
|
|
15
15
|
def copy!(src, dst)
|
16
|
-
log!(enter: __method__, args: [src, dst])
|
16
|
+
log!(enter: __method__, args: [src, dst], level: 2)
|
17
17
|
cmd = "cp -r #{src} #{dst} 2>/dev/null"
|
18
18
|
rc = system!(cmd)
|
19
19
|
puts " Failed: #{cmd} - from #{caller[0]}" unless rc
|
@@ -36,7 +36,7 @@ module RuneBlog::Helpers
|
|
36
36
|
# end
|
37
37
|
|
38
38
|
def read_config(file, *syms)
|
39
|
-
log!(enter: __method__, args: [file, *syms])
|
39
|
+
log!(enter: __method__, args: [file, *syms], level: 3)
|
40
40
|
lines = File.readlines(file).map(&:chomp)
|
41
41
|
obj = ::OpenStruct.new
|
42
42
|
lines.each do |line|
|
@@ -61,7 +61,7 @@ module RuneBlog::Helpers
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def try_read_config(file, hash)
|
64
|
-
log!(enter: __method__, args: [file, hash])
|
64
|
+
log!(enter: __method__, args: [file, hash], level: 3)
|
65
65
|
return hash.values unless File.exist?(file)
|
66
66
|
vals = read_config(file, *hash.keys)
|
67
67
|
vals
|
@@ -80,7 +80,7 @@ module RuneBlog::Helpers
|
|
80
80
|
# end
|
81
81
|
|
82
82
|
def write_config(obj, file)
|
83
|
-
log!(enter: __method__, args: [obj, file])
|
83
|
+
log!(enter: __method__, args: [obj, file], level: 2)
|
84
84
|
hash = obj.to_h
|
85
85
|
File.open(file, "w") do |out|
|
86
86
|
hash.each_pair {|key, val| out.puts "#{key}: #{val}" }
|
@@ -88,13 +88,13 @@ module RuneBlog::Helpers
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def get_views # read from filesystem
|
91
|
-
log!(enter: __method__)
|
91
|
+
log!(enter: __method__, level: 3)
|
92
92
|
dirs = subdirs("#@root/views/").sort
|
93
93
|
dirs.map {|name| RuneBlog::View.new(name) }
|
94
94
|
end
|
95
95
|
|
96
96
|
def new_dotfile(root: ".blogs", current_view: "test_view", editor: "vi")
|
97
|
-
log!(enter: __method__, args: [root, current_view, editor])
|
97
|
+
log!(enter: __method__, args: [root, current_view, editor], level: 3)
|
98
98
|
root = Dir.pwd/root
|
99
99
|
x = OpenStruct.new
|
100
100
|
x.root, x.current_view, x.editor = root, current_view, editor
|
@@ -102,21 +102,21 @@ module RuneBlog::Helpers
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def new_sequence
|
105
|
-
log!(enter: __method__)
|
105
|
+
log!(enter: __method__, level: 3)
|
106
106
|
dump(0, "sequence")
|
107
107
|
version_info = "#{RuneBlog::VERSION}\nBlog created: #{Time.now.to_s}"
|
108
108
|
dump(version_info, "VERSION")
|
109
109
|
end
|
110
110
|
|
111
111
|
def subdirs(dir)
|
112
|
-
log!(enter: __method__, args: [dir])
|
112
|
+
log!(enter: __method__, args: [dir], level: 3)
|
113
113
|
dirs = Dir.entries(dir) - %w[. ..]
|
114
114
|
dirs.reject! {|x| ! File.directory?("#@root/views/#{x}") }
|
115
115
|
dirs
|
116
116
|
end
|
117
117
|
|
118
118
|
def find_draft_slugs
|
119
|
-
log!(enter: __method__)
|
119
|
+
log!(enter: __method__, level: 3)
|
120
120
|
files = Dir["#@root/drafts/**"].grep /\d{4}.*.lt3$/
|
121
121
|
flagfile = "#@root/drafts/last_rebuild"
|
122
122
|
last = File.exist?(flagfile) ? File.mtime(flagfile) : (Time.now - 86_400)
|
@@ -128,7 +128,7 @@ module RuneBlog::Helpers
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def create_dirs(*dirs)
|
131
|
-
log!(enter: __method__, args: [*dirs])
|
131
|
+
log!(enter: __method__, args: [*dirs], level: 3)
|
132
132
|
dirs.each do |dir|
|
133
133
|
dir = dir.to_s # symbols allowed
|
134
134
|
next if Dir.exist?(dir)
|
@@ -139,27 +139,27 @@ module RuneBlog::Helpers
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def interpolate(str, bind)
|
142
|
-
log!(enter: __method__, args: [str, bind])
|
142
|
+
log!(enter: __method__, args: [str, bind], level: 3)
|
143
143
|
wrap = "<<-EOS\n#{str}\nEOS"
|
144
144
|
eval wrap, bind
|
145
145
|
end
|
146
146
|
|
147
147
|
def error(err) # Hmm, this is duplicated
|
148
|
-
log!(str: "duplicated method", enter: __method__, args: [err])
|
148
|
+
log!(str: "duplicated method", enter: __method__, args: [err], level: 2)
|
149
149
|
str = "\n Error: #{err}"
|
150
150
|
puts str
|
151
151
|
puts err.backtrace.join("\n")
|
152
152
|
end
|
153
153
|
|
154
154
|
def dump(obj, name)
|
155
|
-
log!(enter: __method__, args: [obj, name])
|
155
|
+
log!(enter: __method__, args: [obj, name], level: 3)
|
156
156
|
File.write(name, obj)
|
157
157
|
end
|
158
158
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def dump(obj, name) # FIXME scope
|
162
|
-
log!(str: "scope problem", enter: __method__, args: [obj, name])
|
162
|
+
log!(str: "scope problem", enter: __method__, args: [obj, name], level: 3)
|
163
163
|
File.write(name, obj)
|
164
164
|
end
|
165
165
|
|
data/lib/liveblog.rb
CHANGED
@@ -33,6 +33,25 @@ def post
|
|
33
33
|
_out " <!-- Post number #{@meta.num} -->\n "
|
34
34
|
end
|
35
35
|
|
36
|
+
def post_trailer
|
37
|
+
perma = _var("publish.proto") + "://" + _var("publish.server") +
|
38
|
+
"/" + _var("publish.path") + "/permalink/" + _var("post.aslug") +
|
39
|
+
".html"
|
40
|
+
tags = _var("post.tags")
|
41
|
+
if tags.empty?
|
42
|
+
taglist = ""
|
43
|
+
else
|
44
|
+
taglist = "Tags: #{tags}"
|
45
|
+
end
|
46
|
+
_out <<~HTML
|
47
|
+
<table width=100%><tr>
|
48
|
+
<td width=10%><a style="text-decoration: none" href="javascript:history.go(-1)">[Back]</a></td>
|
49
|
+
<td width=10%><a style="text-decoration: none" href="#{perma}"> [permalink] </a></td>
|
50
|
+
<td width=80% align=right><font size=-3>#{taglist}</font></td></tr></table>
|
51
|
+
HTML
|
52
|
+
# damned syntax highlighting
|
53
|
+
end
|
54
|
+
|
36
55
|
def backlink
|
37
56
|
_out %[<br><a href="javascript:history.go(-1)">[Back]</a>]
|
38
57
|
end
|
@@ -45,7 +64,7 @@ def dropcap
|
|
45
64
|
p:first-child:first-letter {
|
46
65
|
color: #0000ff;
|
47
66
|
float: left;
|
48
|
-
font-family:
|
67
|
+
font-family: Verdana;
|
49
68
|
font-size: 75px;
|
50
69
|
line-height: 60px;
|
51
70
|
padding-top: 4px;
|
@@ -109,17 +128,17 @@ end
|
|
109
128
|
|
110
129
|
|
111
130
|
def make_main_links
|
112
|
-
log!(enter: __method__)
|
131
|
+
log!(enter: __method__, level: 1)
|
113
132
|
# FIXME remember strings may not be safe
|
114
133
|
line = _data.chomp
|
115
134
|
tag, card_title = *line.split(" ", 2)
|
116
135
|
cardfile, mainfile = "#{tag}-card", "#{tag}-main"
|
117
136
|
input = "list.data"
|
118
|
-
log!(str: "Reading #{input}", pwd: true)
|
137
|
+
log!(str: "Reading #{input}", pwd: true, level: 3)
|
119
138
|
pairs = File.readlines(input).map {|line| line.chomp.split(/, */, 2) }
|
120
139
|
_write_main(mainfile, pairs, card_title, tag)
|
121
140
|
_write_card(cardfile, mainfile, pairs, card_title, tag)
|
122
|
-
log!(str: "...returning from method", pwd: true)
|
141
|
+
log!(str: "...returning from method", pwd: true, level: 3)
|
123
142
|
end
|
124
143
|
|
125
144
|
### inset
|
@@ -142,7 +161,7 @@ def inset
|
|
142
161
|
end
|
143
162
|
lr = _args.first
|
144
163
|
wide = _args[1] || "25"
|
145
|
-
_passthru "<div style='float:#{lr}; width: #{wide}%; padding:8px; padding-right:12px; font-family:verdana'>"
|
164
|
+
_passthru "<div style='float:#{lr}; width: #{wide}%; padding:8px; padding-right:12px'>" # ; font-family:verdana'>"
|
146
165
|
_passthru '<b><i>'
|
147
166
|
_passthru box
|
148
167
|
_passthru_noline '</i></b></div>'
|
@@ -154,7 +173,8 @@ def title
|
|
154
173
|
title = @_data.chomp
|
155
174
|
@meta.title = title
|
156
175
|
setvar :title, title
|
157
|
-
|
176
|
+
# FIXME refactor -- just output variables for a template
|
177
|
+
# _out %[<h1 class="post-title">#{title}</h1><br>]
|
158
178
|
_optional_blank_line
|
159
179
|
end
|
160
180
|
|
@@ -285,7 +305,6 @@ def head # Does NOT output tags
|
|
285
305
|
hash = defaults.dup.update(result) # FIXME collisions?
|
286
306
|
|
287
307
|
hash.each_value {|x| _out " " + x }
|
288
|
-
_out "<body>"
|
289
308
|
end
|
290
309
|
|
291
310
|
########## newer stuff...
|
@@ -319,13 +338,21 @@ def recent_posts # side-effect
|
|
319
338
|
HTML
|
320
339
|
end
|
321
340
|
|
341
|
+
def _make_class_name(app)
|
342
|
+
if app =~ /[-_]/
|
343
|
+
words = app.split(/[-_]/)
|
344
|
+
name = words.map(&:capitalize).join
|
345
|
+
else
|
346
|
+
name = app.capitalize
|
347
|
+
end
|
348
|
+
return name
|
349
|
+
end
|
350
|
+
|
322
351
|
def _load_local(widget)
|
323
352
|
Dir.chdir("widgets/#{widget}") do
|
324
|
-
|
353
|
+
rclass = _make_class_name(widget)
|
325
354
|
found = (require("./#{widget}") if File.exist?("#{widget}.rb"))
|
326
|
-
|
327
|
-
code = found ? ::RuneBlog::Widget.class_eval(widget.capitalize) : nil
|
328
|
-
# STDERR.puts "loadCP3 code = #{code.inspect}"
|
355
|
+
code = found ? ::RuneBlog::Widget.class_eval(rclass) : nil
|
329
356
|
code
|
330
357
|
end
|
331
358
|
rescue => err
|
@@ -348,16 +375,22 @@ def sidebar
|
|
348
375
|
tcard = "#{tag}-card.html"
|
349
376
|
|
350
377
|
code = _load_local(tag)
|
351
|
-
code &&
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
#
|
359
|
-
|
360
|
-
|
378
|
+
if code && tag == "pages"
|
379
|
+
Dir.chdir(wtag) { code.build }
|
380
|
+
else
|
381
|
+
end
|
382
|
+
|
383
|
+
if tag == "ad"
|
384
|
+
num = rand(1..4)
|
385
|
+
img = "widgets/ad/ad#{num}.png"
|
386
|
+
src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
|
387
|
+
system!("cp #{src} #{dst}") # , show: true)
|
388
|
+
File.open(wtag/"vars.lt3", "w") do |f|
|
389
|
+
f.puts ".set ad.image = #{img}"
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
xlate cwd: wtag, src: tag, dst: tcard # , debug: (tag == "ad")
|
361
394
|
_include_file wtag/tcard
|
362
395
|
end
|
363
396
|
_out %[</div>]
|
@@ -566,7 +599,7 @@ def _html_body(file, css = nil)
|
|
566
599
|
end
|
567
600
|
|
568
601
|
def _write_card(cardfile, mainfile, pairs, card_title, tag)
|
569
|
-
log!(str: "Creating #{cardfile}.html", pwd: true)
|
602
|
+
log!(str: "Creating #{cardfile}.html", pwd: true, level: 2)
|
570
603
|
url = mainfile
|
571
604
|
url = :widgets/tag/mainfile + ".html"
|
572
605
|
File.open("#{cardfile}.html", "w") do |f|
|
@@ -581,7 +614,7 @@ def _write_card(cardfile, mainfile, pairs, card_title, tag)
|
|
581
614
|
</h5>
|
582
615
|
<div class="collapse" id="#{tag}">
|
583
616
|
EOS
|
584
|
-
log!(str: "Writing data pairs to #{cardfile}.html", pwd: true)
|
617
|
+
log!(str: "Writing data pairs to #{cardfile}.html", pwd: true, level: 2)
|
585
618
|
local = _local_tag?(tag)
|
586
619
|
pairs.each do |file, title|
|
587
620
|
url = file
|
@@ -646,7 +679,7 @@ def _write_main_pages(mainfile, pairs, card_title, tag)
|
|
646
679
|
when :frame; url_ref = "href = '#{file}'" # local always frameable
|
647
680
|
when :noframe; url_ref = _blank(file) # local always frameable
|
648
681
|
end
|
649
|
-
css = "color: #8888FF; text-decoration: none; font-size:
|
682
|
+
css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
|
650
683
|
f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
|
651
684
|
end
|
652
685
|
f.puts main_tail
|
@@ -654,7 +687,7 @@ def _write_main_pages(mainfile, pairs, card_title, tag)
|
|
654
687
|
end
|
655
688
|
|
656
689
|
def _write_main(mainfile, pairs, card_title, tag)
|
657
|
-
log!(str: "Creating #{mainfile}.html", pwd: true)
|
690
|
+
log!(str: "Creating #{mainfile}.html", pwd: true, level: 2)
|
658
691
|
|
659
692
|
if tag == "pages" # temporary experiment
|
660
693
|
_write_main_pages(mainfile, pairs, card_title, tag)
|
@@ -663,9 +696,10 @@ def _write_main(mainfile, pairs, card_title, tag)
|
|
663
696
|
|
664
697
|
local = _local_tag?(tag)
|
665
698
|
setvar "card.title", card_title
|
699
|
+
css = "* { font-family: verdana }"
|
666
700
|
File.open("#{mainfile}.html", "w") do |f|
|
667
|
-
_html_body(f) do
|
668
|
-
f.puts "<h1>#{card_title}</h1>"
|
701
|
+
_html_body(f, css) do
|
702
|
+
f.puts "<h1>#{card_title}</h1><br><hr>"
|
669
703
|
pairs.each do |file, title|
|
670
704
|
type, title = page_type(tag, title)
|
671
705
|
title = title.gsub(/\\/, "") # kludge
|
@@ -674,7 +708,7 @@ def _write_main(mainfile, pairs, card_title, tag)
|
|
674
708
|
when :frame; url_ref = "href = '#{file}'" # local always frameable
|
675
709
|
when :noframe; url_ref = _blank(file) # local always frameable
|
676
710
|
end
|
677
|
-
css = "color: #8888FF; text-decoration: none; font-size:
|
711
|
+
css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
|
678
712
|
f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
|
679
713
|
end
|
680
714
|
end
|