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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbd97f1cfd9631550e0ef799e14f8c5dfd621d29c4231dfb9f5bbc0f065b436e
4
- data.tar.gz: 449f13d68fc2a247e9e307083c7b0f4c9034bc4e85d307d7775d8a7a881284a7
3
+ metadata.gz: '08da4eebd5d24bcb8586ed0c4a977d79651fde7953df71fd94e7e6e74a09484f'
4
+ data.tar.gz: ec0907dc80d37026393c70327f81a572c418a5a3553a4eb2d256cecb2deae035
5
5
  SHA512:
6
- metadata.gz: 476e0804dd0085123c19019548bd7803ccfeff526d27e70b5bab1dcf3904fe8ec414b69a9562b34a9fd2e0574843cdbe66cdf9ed226b94d0d2aca92aebb1a7b5
7
- data.tar.gz: 598f65529e5a1d52558142a3ad5230fa53bab77f12325efedc9a6c9f688a737633b4937088bf234e5e5b2fbee8bb17fc0778968e7547797ded0d116dbe024abc
6
+ metadata.gz: 1645347a827726674875a324cd16ad9c21993c741a9b5d79f83c04459cc23b0d0a17bf1ad6c9b91d64ae57f71d180dd7bbfea850d28e1e46dc66e825cb641b53
7
+ data.tar.gz: 6bd64ef0e17ed76612b5d914de41fbcd4e916865a418acc6ae44755ad2d83fa852cce555c18a2d4c2c4b0a7569395ad4b84beca7ad070b5def25aa0209af8518
@@ -96,50 +96,72 @@ def list!
96
96
  _optional_blank_line
97
97
  end
98
98
 
99
- def html_body(file)
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 make_news_links
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/news/#{mainfile}.html')"
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
@@ -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.11"
5
+ VERSION = "0.2.12"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -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, except not.
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
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.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton