lib/repl.rb in runeblog-0.2.95 vs lib/repl.rb in runeblog-0.2.96
- old
+ new
@@ -1,8 +1,9 @@
require 'runeblog'
require 'ostruct'
require 'helpers-repl' # FIXME structure
+require 'pathmagic'
make_exception(:PublishError, "Error during publishing")
make_exception(:EditorProblem, "Could not edit $1")
module RuneBlog::REPL
@@ -376,14 +377,19 @@
puts unless testing
@blog.views.each do |v|
v = v.to_s
v = fx(v, :bold) if v == @blog.view.name
output v + "\n"
- puts " ", v unless testing
+ # FIXME: next 3 lines are crufty as hell
+ lines = File.readlines(@blog.root/"views/#{v}/themes/standard/global.lt3")
+ lines = lines.select {|x| x =~ /^blog / && x !~ /VIEW_/ }
+ title = lines.first.split(" ", 2)[1]
+ print " ", ('%15s' % v) unless testing
+ puts " ", fx(title, :black) unless testing
end
puts unless testing
- @out
+# @out
end
def cmd_list_posts(arg, testing = false)
reset_output
posts = @blog.posts # current view
@@ -398,10 +404,16 @@
posts.each do |post|
outstr " #{colored_slug(post)}\n"
base = post.sub(/.lt3$/, "")
num, rest = base[0..3], base[4..-1]
puts " ", fx(num, Red), fx(rest, Blue) unless testing
+ draft = @blog.root/:drafts/post + ".lt3"
+ other = @blog._get_views(draft) - [@blog.view.to_s]
+ unless other.empty?
+ print fx(" "*7 + "also in: ", :bold)
+ puts other.join(", ")
+ end
end
end
puts unless testing
@out
end
@@ -418,9 +430,14 @@
drafts.each do |draft|
outstr " #{colored_slug(draft.sub(/.lt3$/, ""))}\n"
base = draft.sub(/.lt3$/, "")
num, rest = base[0..3], base[4..-1]
puts " ", fx(num, Red), fx(rest, Blue) unless testing
+ other = @blog._get_views(@blog.root/:drafts/draft) - [@blog.view.to_s]
+ unless other.empty?
+ print fx(" "*7 + "also in: ", :bold)
+ puts other.join(", ")
+ end
end
end
puts unless testing
@out
end