開発者向けのブログシステムを作りたい。まだデータ構造を考えている状態なので、HTMLに出力する時のエスケープは全くしていない。 index.cgi #!/usr/bin/env ruby require "erb" require "yaml" require "filter" class Entries @@count = 0 def initialize @entries = [] end def load(path) Dir.chdir(path) Dir.glob("[0-9][0-9]/[0-1][0-9]/[0-3][0-9]/*") {|entry| file = open(entry) update = file.mtime content = Filter.run(file.read) @entries.push({ "id" => entry, "content" =>
![ブログシステムを作りたい - 素人がプログラミングを勉強していたブログ](https://cdn-ak-scissors.b.st-hatena.com/image/square/e3acaa05a0d481c1697f404cd47ba7ed20da3e62/height=288;version=1;width=512/http%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fj%2Fjavascripter%2F20081211%2F20081211044356.png)