diff --git a/.gitignore b/.gitignore index c8799d05..28ae51a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -doc +doc/api +doc/website/index.html +doc/website/tmp/* *.log .DS_Store /dist diff --git a/Rakefile b/Rakefile index 630a9921..4077cc8c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,7 @@ +require 'rubygems' require 'rake/clean' +require 'fileutils' +require 'hpricot' task :default => :test @@ -98,7 +101,7 @@ task :doc => ['doc/api/index.html'] file 'doc/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f| rb_files = f.prerequisites sh((<<-end).gsub(/\s+/, ' ')) - hanna --charset utf8 \ + rdoc --charset utf8 \ --fmt html \ --inline-source \ --line-numbers \ @@ -109,3 +112,13 @@ file 'doc/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f| end end CLEAN.include 'doc/api' + +desc "Generate simple website" +task :website do + `rdoc --force-update -o doc/website/tmp README.rdoc` + readme = Hpricot( open("doc/website/tmp/files/README_rdoc.html") ).at('#bodyContent').inner_html + # Replace placeholder with Readme content + html = File.read("doc/website/index.tpl").sub(Regexp.new(Regexp.escape("{{REPLACE}}")), readme) + # TODO: Fix RDoc links + File.open( "doc/website/index.html", 'w+' ) { |f| f << html } +end diff --git a/doc/website/favicon.ico b/doc/website/favicon.ico new file mode 100755 index 00000000..e69de29b diff --git a/doc/website/index.tpl b/doc/website/index.tpl new file mode 100644 index 00000000..7a29964c --- /dev/null +++ b/doc/website/index.tpl @@ -0,0 +1,28 @@ + + + + + + Sinatra.rb + + + + + +
+ Sinatra Logo + +
+{{REPLACE}} +
+
+ + diff --git a/doc/website/master.css b/doc/website/master.css new file mode 100644 index 00000000..ff0ca1a3 --- /dev/null +++ b/doc/website/master.css @@ -0,0 +1,103 @@ +body { + font-size: 100%; + font-family: Helvetica, Arial, sans-serif; + margin: auto 10em; } + +body + { color: #222; + background: #fafafa; + font-family: Helvetica, Arial, sans-serif; + margin: auto 8em; + padding: 0; } + +a { + color: #1177DD; + text-decoration: none; } +a:hover { + text-decoration: underline; } + +a img + { border: none; } + +#navigation ul { + text-align: right; + list-style-type: none; + padding: 0; + margin: 0; + clear: both; + position: relative; } +#navigation ul li { + background: #e0e0e0; + padding: 0.4em; + margin-right: 0.5em; + display: inline; } + +#content + { background: #fff; + padding: 1em 2em; + margin: auto 2em; + border: 1px solid #ccc; + border-top: none; border-bottom: none; } + +#content .inner { + position: relative; + border-top: 4px solid #222; + margin-top: 0.2em; } + +#content h1, #content h2, #content h3, #content h4, #content h5, #content h6 { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } + +body #content h1:first-child { + color: #222; + background: #fff; + font: bold 300% Georgia, "Times New Roman", serif; + position: absolute; + left: 180px; + top: -2.7em; } + +#content h1 a { + color: #222; } + +#content p.first { /* TODO */ + font-size: 200%; } + +#content h2 { + color: #333; + font-size: 150%; + margin-top: 1.5em; + border-top: 4px solid #e0e0e0; + padding-top: .5em; } + +#content h3 { + font-weight: bold; + font-size: 120%; + color: #4e4e4e; + margin: 1em 0 .2em; } + +/* code */ +#content code, #content pre, #content textarea { + font-family: "Deja Vu Sans Mono", "Bitstream Vera Sans Mono", "Inconsolata", "Consolas", monospace; } +#content pre { + margin: .5em 0; + padding: .5em; } +#content pre { + margin: 1em 0; + font-size: 90%; + background-color: #f8f8ff; + border: 1px solid #dedede; + padding: .5em; + line-height: 1.5em; + color: #444; } + +#content pre code { + padding: 0; + font-size: 100%; + background-color: #f8f8ff; + border: none; } + +#content code { + font-size: 90%; + background-color: #f8f8ff; + color: #444; + padding: 0 .2em; + border: 1px solid #dedede; } diff --git a/doc/website/sinatra-logo.gif b/doc/website/sinatra-logo.gif new file mode 100644 index 00000000..b213dfbe Binary files /dev/null and b/doc/website/sinatra-logo.gif differ