# Custom code for 'pages' widget # How to update repl code? class ::RuneBlog::Widget class Pages Type, Title = "pages", "Pages" def initialize(repo) @blog = repo @datafile = "list.data" @lines = File.readlines(@datafile) @data = @lines.map {|x| x.chomp.split(/, */, 2) } end def build # build child pages children = Dir["*.lt3"] - ["pages.lt3"] children.each do |child| dest = child.sub(/.lt3$/, ".html") preprocess src: child, dst: dest end write_main write_card end def _html_body(file, css = nil) file.puts "" if css file.puts "
" file.puts " " file.puts " " end file.puts " " yield file.puts " \n" end def write_main css = "body { font-family: verdana }" card_title = Title File.open("#{Type}-main.html", "w") do |f| _html_body(f, css) do f.puts "