runeblog 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/liveblog.rb +39 -17
- data/lib/runeblog_version.rb +1 -1
- data/test/make_blog.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08da4eebd5d24bcb8586ed0c4a977d79651fde7953df71fd94e7e6e74a09484f'
|
4
|
+
data.tar.gz: ec0907dc80d37026393c70327f81a572c418a5a3553a4eb2d256cecb2deae035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1645347a827726674875a324cd16ad9c21993c741a9b5d79f83c04459cc23b0d0a17bf1ad6c9b91d64ae57f71d180dd7bbfea850d28e1e46dc66e825cb641b53
|
7
|
+
data.tar.gz: 6bd64ef0e17ed76612b5d914de41fbcd4e916865a418acc6ae44755ad2d83fa852cce555c18a2d4c2c4b0a7569395ad4b84beca7ad070b5def25aa0209af8518
|
data/lib/liveblog.rb
CHANGED
@@ -96,50 +96,72 @@ def list!
|
|
96
96
|
_optional_blank_line
|
97
97
|
end
|
98
98
|
|
99
|
-
def
|
99
|
+
def _html_body(file)
|
100
100
|
file.puts "<html>\n <body>"
|
101
101
|
yield
|
102
102
|
file.puts " </body>\n</html>"
|
103
103
|
end
|
104
104
|
|
105
|
-
def
|
106
|
-
# FIXME remember strings may not be safe
|
107
|
-
line = _data.chomp
|
108
|
-
input, cardfile, mainfile, card_title = *line.split(" ", 4)
|
109
|
-
pairs = File.readlines(input).map {|line| line.chomp.split(",", 2) }
|
110
|
-
# HTML for main area (iframe)
|
111
|
-
File.open("#{mainfile}.html", "w") do |f|
|
112
|
-
html_body(f) do
|
113
|
-
f.puts "<h1>#{card_title}</h1>"
|
114
|
-
pairs.each do |file, title|
|
115
|
-
f.puts %[<a style="text-decoration: none; font-size: 24px" href="#{file}">#{title}</a> <br>]
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
105
|
+
def _write_card(cardfile, mainfile, pairs, card_title, tag, relative: true)
|
119
106
|
# HTML for sidebar card
|
107
|
+
log!(str: "Creating #{cardfile}.html", pwd: true)
|
108
|
+
TTY.puts "Creating #{cardfile}.html - pwd = #{Dir.pwd}"
|
120
109
|
File.open("#{cardfile}.html", "w") do |f|
|
121
110
|
f.puts <<-EOS
|
122
111
|
<div class="card mb-3">
|
123
112
|
<div class="card-body">
|
124
113
|
<h5 class="card-title">
|
125
114
|
<a href="javascript: void(0)"
|
126
|
-
onclick="javascript:open_main('widgets
|
115
|
+
onclick="javascript:open_main('widgets/#{tag}/#{mainfile}.html')"
|
127
116
|
style="text-decoration: none; color: black">#{card_title}</a>
|
128
117
|
</h5>
|
118
|
+
<!-- <ul class="list-group list-group-flush"> -->
|
129
119
|
EOS
|
120
|
+
log!(str: "Writing data pairs to #{cardfile}.html", pwd: true)
|
121
|
+
top = relative ? "widgets/#{tag}/" : ""
|
130
122
|
pairs.each do |file, title|
|
131
123
|
f.puts <<-EOS
|
132
124
|
<li class="list-group-item"> <a href="javascript: void(0)"
|
133
|
-
onclick="javascript:open_main('#{file}')">#{title}</a> </li>
|
125
|
+
onclick="javascript:open_main('#{top}#{file}')">#{title}</a> </li>
|
134
126
|
EOS
|
135
127
|
end
|
136
128
|
f.puts <<-EOS
|
129
|
+
<!-- </ul> -->
|
137
130
|
</div>
|
138
131
|
</div>
|
139
132
|
EOS
|
140
133
|
end
|
141
134
|
end
|
142
135
|
|
136
|
+
def _write_main(mainfile, pairs, card_title)
|
137
|
+
# HTML for main area (iframe)
|
138
|
+
log!(str: "Creating #{mainfile}.html", pwd: true)
|
139
|
+
TTY.puts "Creating #{mainfile}.html - pwd = #{Dir.pwd}"
|
140
|
+
File.open("#{mainfile}.html", "w") do |f|
|
141
|
+
_html_body(f) do
|
142
|
+
f.puts "<h1>#{card_title}</h1>"
|
143
|
+
pairs.each do |file, title|
|
144
|
+
f.puts %[<a style="text-decoration: none; font-size: 24px" href="#{file}">#{title}</a> <br>]
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def make_main_links
|
151
|
+
log!(enter: __method__)
|
152
|
+
# FIXME remember strings may not be safe
|
153
|
+
line = _data.chomp
|
154
|
+
tag, card_title = *line.split(" ", 2)
|
155
|
+
cardfile, mainfile = "card-#{tag}", "main-#{tag}"
|
156
|
+
input = "list.data"
|
157
|
+
log!(str: "Reading #{input}", pwd: true)
|
158
|
+
pairs = File.readlines(input).map {|line| line.chomp.split(",", 2) }
|
159
|
+
_write_main(mainfile, pairs, card_title)
|
160
|
+
widget_relative = false # (tag != "news") # FIXME kludge!!!
|
161
|
+
_write_card(cardfile, mainfile, pairs, card_title, tag, relative: widget_relative)
|
162
|
+
log!(str: "...returning from method", pwd: true)
|
163
|
+
end
|
164
|
+
|
143
165
|
### inset
|
144
166
|
|
145
167
|
def inset
|
data/lib/runeblog_version.rb
CHANGED
data/test/make_blog.rb
CHANGED
@@ -112,7 +112,7 @@ Blah blah Waller Creek blah blah...
|
|
112
112
|
BODY
|
113
113
|
|
114
114
|
make_post(x, "Life on Sabine Street", <<-EXCERPT, <<-BODY)
|
115
|
-
It's like Pooh Corner
|
115
|
+
It's like Pooh Corner (except not).
|
116
116
|
EXCERPT
|
117
117
|
This is about Sabine St, blah blah lorem ipsum dolor...
|
118
118
|
BODY
|