require 'ostruct'
require 'yaml'
def init_liveblog
@teaser = ""
@body = ""
@body = ""
@meta = ::OpenStruct.new
end
def _errout(*args)
::STDERR.puts *args
end
def _passthru(line)
return if line.nil?
@body << "
" if line == "\n" and ! @_nopara
line = _formatting(line)
@body << line + "\n"
end
def title
@meta.title = @_data
@body << "
#{@meta.title}
"
end
def pubdate
_debug "data = #@_data"
match = /(\d{4}).(\d{2}).(\d{2})/.match @_data
junk, y, m, d = match.to_a
y, m, d = y.to_i, m.to_i, d.to_i
@meta.date = ::Date.new(y, m, d)
@meta.pubdate = "%04d%02d%02d" % [y, m, d]
end
def categories
_debug "args = #{_args}"
@meta.categories = _args
end
def views
_debug "data = #{_args}"
@meta.views = _args # + ["main"]
end
def liveblog_version
end
def list
@body << ""
_body {|line| @body << "- #{line}
" }
@body << "
"
end
def list!
@body << ""
lines = _body.each # {|line| @body << "- #{line}
" }
loop do
line = lines.next
line = _formatting(line)
if line[0] == " "
@body << line
else
@body << "- #{line}
"
end
end
@body << "
"
end
def finalize
@meta.body = @body
@meta
end
def teaser
@meta.teaser = _body_text
@body << @meta.teaser + "\n"
# FIXME
end