module OddJob::HtmlRender

A very basic utility for rendering OddJob specific pages.

Public Instance Methods

page(content, title) click to toggle source

Wrap content in the standard page layout. title is set as the HTML page’s title.

# File lib/oddjob.rb, line 97
def page(content, title)
  [
    "<!DOCTYPE html>",
    "<head>",
    "  <title>OJ #{title}</title>",
    "  <style>",
    "  body {font:100% arial,sans-serif; margin:1.5em 5em 4em 5em;}",
    "  a {text-decoration:none; color:rgb(248,157,30)}",
    "  a:hover {color:rgb(239,131,0);}",
    "  .header {font-size:0.75em; float:right; margin-bottom: 2.0em;}",
    "  .fineprint {font-size:0.85em;}",
    "  li {margin-bottom:0.4em;}",
    "  </style>",
    "</head>",
    "<html><body>",
    "  <div class=\"header\">",
    "    <em>v#{VERSION}</em>",
    "    <a href=\"https://github.com/MCF/oddjob\">OddJob on github</a>",
    "  </div>",
    "  <div style=\"clear:both;\"></div>",
       content.kind_of?(Array) ? content.join("\n") : content,
    "</body></html>",
  ].join("\n")
end