lib/hubdown/page_builder.rb in hubdown-0.0.4 vs lib/hubdown/page_builder.rb in hubdown-0.0.5

- old
+ new

@@ -1,53 +1,23 @@ +require 'hubdown/style_scraper' +require 'erb' + module Hubdown class PageBuilder - def initialize body - @body = body + def initialize args + @body = args.fetch("body"){ '' } + @uri = args.fetch("uri"){ 'https://github.com/knomedia/hubdown' } + @filename = args.fetch("filename"){ '' } + @scraper = StyleScraper.new( @uri ) end def get_page - page = "#{get_head}#{@body}#{get_closing}" + links = @scraper.get_css_links + body = @body + filename = @filename + template = ERB.new( File.read("lib/hubdown/template.html.erb"), nil, "-" ) + page = template.result(binding) page - end - - def get_head - opening = <<EOF -<!DOCTYPE html> -<html> -<head> - <title>OUTPUT</title> - <link href="https://a248.e.akamai.net/assets.github.com/assets/github-8dd5c1a834790ecb6b900ff7b2d9a1377fd5aef1.css" media="screen" rel="stylesheet" type="text/css" /> - <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-4591451faf42b997173d752065f048736e6f9872.css" media="screen" rel="stylesheet" type="text/css" /> - <style> - #wrapper { - width: 920px; - margin: 20px auto; - } - </style> -</head> - -<body> - <div id="wrapper"> - <div id="slider"> - <div class="frames"> - <div class="frame"> - <div id="readme" class="clearfix announce instapaper_body md"> - <span class="name">FILE_NAME</span> - <article class="markdown-body entry-content"> -EOF - end - - def get_closing - closing = <<EOF - </article> - </div> - </div> - </div> - </div> - </div> -</body> -</html> -EOF end end end