lib/runeblog.rb in runeblog-0.2.33 vs lib/runeblog.rb in runeblog-0.2.34
- old
+ new
@@ -294,10 +294,11 @@
def teaser(slug)
log!(enter: __method__, args: [slug])
id = slug.to_i
text = nil
+ @theme = @view.dir/"themes/standard"
post_entry_name = @theme/"blog/post_entry.lt3"
xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , debug: true
@_post_entry ||= File.read("/tmp/post_entry.html")
vp = post_lookup(id)
nslug, aslug, title, date, teaser_text =
@@ -395,16 +396,21 @@
def generate_view(view) # huh?
log!(enter: __method__, args: [view])
generate_index(view) # recent posts (recent.html)
vdir = @root/:views/view
+ @theme = @root/:views/view/:themes/:standard
xlate cwd: vdir/"themes/standard/etc",
src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
xlate cwd: vdir/"themes/standard",
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
-
+ rescue => err
+ puts err
+ puts err.backtrace.join("\n")
+ print "Pause... "
+ gets
end
def _get_views(draft)
log!(enter: __method__, args: [draft])
# FIXME dumb code
@@ -492,15 +498,10 @@
_handle_post(draft, view)
generate_view(view) # FIXME leads to inefficiency?
end
end
- def relink # FIXME no longer used?
- log!(enter: __method__)
- self.views.each {|view| generate_index(view) }
- end
-
def index_entry(view, meta)
log!(enter: __method__, args: [view, meta])
debug "=== index_entry #{view.to_s.inspect} #{meta.num} #{meta.title.inspect}"
check_meta(meta, "index_entry1")
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
@@ -536,9 +537,10 @@
end
def remove_post(num)
log!(enter: __method__, args: [num])
raise ArgumentError unless num.is_a?(Integer)
+ # FIXME update original draft .views
tag = prefix(num)
files = Find.find(self.view.dir).to_a
list = files.select {|x| File.directory?(x) and x =~ /#{tag}/ }
return nil if list.empty?
dest = list.map {|f| f.sub(/(?<num>\d{4}-)/, "_\\k<num>") }