runeblog 0.0.18 → 0.0.19
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/data/VERSION +1 -1
- data/lib/runeblog.rb +20 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1a775d7a2266cf324705bb43a5f4c0b027b4bbb
|
4
|
+
data.tar.gz: 6ccaa91f9b29cc0306096b71a9ed10177149a168
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b8211572cf28798f56baf01c685800445b8bd7a876999a936116f8cf158f73da0bc3df8292668b65ac24d4f65ea235390b365939b95de84ac94c17dea324a3b
|
7
|
+
data.tar.gz: 05c70aeedfb2edcfa7b50977d452542f44d746544839a8d9183b7ec0e70c3a25e50228f0584064d201178b1da23ef5065840fc9cd5f24a7c10171573904b61c3
|
data/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
RuneBlog v 0.0.
|
1
|
+
RuneBlog v 0.0.19 2017-05-06
|
data/lib/runeblog.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class RuneBlog
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.19"
|
3
3
|
|
4
4
|
Path = File.expand_path(File.join(File.dirname(__FILE__)))
|
5
5
|
DefaultData = Path + "/../data"
|
@@ -139,11 +139,13 @@ end
|
|
139
139
|
### process_post
|
140
140
|
|
141
141
|
def process_post(file)
|
142
|
-
|
142
|
+
@main ||= Livetext.new
|
143
143
|
# puts " Processing: #{Dir.pwd}/#{file}"
|
144
|
-
|
145
|
-
|
146
|
-
@meta =
|
144
|
+
# path = @config.root + "/src/#{file}"
|
145
|
+
@meta = @main.process_file(file)
|
146
|
+
@meta.slug = make_slug(@meta.title, @config.sequence)
|
147
|
+
# @meta = @main.instance_eval { @meta }
|
148
|
+
p @meta
|
147
149
|
@meta.slug = file.sub(/.lt3$/, "")
|
148
150
|
@meta
|
149
151
|
end
|
@@ -152,21 +154,23 @@ end
|
|
152
154
|
|
153
155
|
def reload_post(file)
|
154
156
|
@main ||= Livetext.new
|
155
|
-
|
157
|
+
process_post("#{@config.root}/src/#{file}")
|
158
|
+
@meta = @main.instance_eval { @meta }
|
156
159
|
@meta.slug = file.sub(/.lt3$/, "")
|
157
160
|
@meta
|
158
161
|
end
|
159
162
|
|
160
163
|
### posting
|
161
164
|
|
162
|
-
def posting(meta)
|
165
|
+
def posting(view, meta)
|
166
|
+
ref = "#{view}/#{meta.slug}/index.html"
|
163
167
|
<<-HTML
|
164
168
|
<br>
|
165
169
|
<font size=+1>#{meta.pubdate} </font>
|
166
|
-
<font size=+2 color=blue><a href=../#{
|
170
|
+
<font size=+2 color=blue><a href=../#{ref} style="text-decoration: none">#{meta.title}</font></a>
|
167
171
|
<br>
|
168
172
|
#{meta.teaser}
|
169
|
-
<a href=../#{
|
173
|
+
<a href=../#{ref} style="text-decoration: none">Read more...</a>
|
170
174
|
<br><br>
|
171
175
|
<hr>
|
172
176
|
HTML
|
@@ -179,30 +183,27 @@ def generate_index(view)
|
|
179
183
|
vdir = "#{@config.root}/views/#{view}"
|
180
184
|
posts = Dir.entries(vdir).grep /^\d\d\d\d/
|
181
185
|
posts = posts.sort.reverse
|
186
|
+
|
182
187
|
# Add view header/trailer
|
183
188
|
@bloghead = File.read("#{vdir}/custom/blogheader.html") rescue ""
|
184
189
|
@blogtail = File.read("#{vdir}/custom/blogtrailer.html") rescue ""
|
190
|
+
|
185
191
|
# Output view
|
186
|
-
posts.map!
|
187
|
-
YAML.load(File.read("#{vdir}/#{post}/metadata.yaml"))
|
188
|
-
end
|
192
|
+
posts.map! {|post| YAML.load(File.read("#{vdir}/#{post}/metadata.yaml")) }
|
189
193
|
out = @bloghead.dup
|
190
|
-
posts.each
|
191
|
-
out << posting(post)
|
192
|
-
end
|
194
|
+
posts.each {|post| out << posting(view, post) }
|
193
195
|
out << @blogtail
|
194
|
-
File.open("#{vdir}/index.html", "w")
|
195
|
-
f.puts out
|
196
|
-
end
|
196
|
+
File.open("#{vdir}/index.html", "w") {|f| f.puts out }
|
197
197
|
end
|
198
198
|
|
199
199
|
### link_post_view
|
200
200
|
|
201
201
|
def link_post_view(view)
|
202
|
+
p @meta
|
202
203
|
# Create dir using slug (index.html, metadata?)
|
203
204
|
vdir = "#{@config.root}/views/#{view}"
|
204
205
|
dir = "#{vdir}/#{@meta.slug}"
|
205
|
-
cmd = "mkdir -p #{dir}"
|
206
|
+
cmd = "mkdir -p #{dir}" #-- FIXME what if this exists??
|
206
207
|
puts " Running: #{cmd}"
|
207
208
|
system(cmd)
|
208
209
|
File.write("#{dir}/metadata.yaml", @meta.to_yaml)
|