From 8dca81a0bd57cee31f1de288909b248c1e992773 Mon Sep 17 00:00:00 2001 From: Stephen Bartholomew Date: Fri, 30 Jan 2009 12:17:35 +0000 Subject: [PATCH] Added Haml options & fixed partial options --- .gitignore | 1 + README.markdown | 50 ------------------------------- Rakefile | 3 +- lib/staticmatic.rb | 2 +- lib/staticmatic/configuration.rb | 4 ++- lib/staticmatic/mixins/render.rb | 4 +-- website/src/pages/how_to_use.haml | 13 ++++++++ website/src/partials/news.haml | 6 ++-- 8 files changed, 24 insertions(+), 59 deletions(-) delete mode 100644 README.markdown diff --git a/.gitignore b/.gitignore index 53e7959..d79482b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store coverage pkg +test/sandbox/test_site/site/* website/*.html website/stylesheets/*.css website/releases/ diff --git a/README.markdown b/README.markdown deleted file mode 100644 index 2e78c24..0000000 --- a/README.markdown +++ /dev/null @@ -1,50 +0,0 @@ -# StaticMatic - -*For information on Haml & Sass please see [haml.hamptoncatlin.com](http://haml.hamptoncatlin.com)*. - -## What's it all about? - -CMS is overrated. A lot of the time, clients want us to do what we do -best - well designed pages with structured, accessible and maintainable markup & styling. - -CMSs are often perfect for this, but sometimes they can be restrictive and more cumbersome -than just working with good ol' source code. At the same time we want our code to be -structured, DRY and flexible. - -Enter **StaticMatic**. - -## Usage - -StaticMatic will set up a basic site structure for you with this command: - - staticmatic setup - -After this command you'll have the following files: - - / - site/ - images/ - stylesheets/ - javascripts/ - src/ - helpers/ - layouts/ - application.haml - pages/ - index.haml - stylesheets/ - application.sass - -StaticMatic sets you up with a sample layout, stylesheet and page file. Once you've -edited the pages and stylesheets, you can generate the static site: - - staticmatic build - -All of the pages are parsed and wrapped up in application.haml and put into the site directory. - -## Templates - -StaticMatic adds a few helpers to the core Haml helpers: - - = link 'Title', 'url' - = img 'my_image.jpg' \ No newline at end of file diff --git a/Rakefile b/Rakefile index f1fa998..07fc52b 100644 --- a/Rakefile +++ b/Rakefile @@ -5,6 +5,7 @@ require File.dirname(__FILE__) + '/lib/staticmatic' # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('staticmatic', StaticMatic::VERSION) do |p| p.developer('Stephen Bartholomew', 'steve@curve21.com') + p.summary = "Lightweight Static Site Framework" p.rubyforge_name = p.name p.extra_deps = [ ['haml','>= 2.0'], @@ -16,7 +17,7 @@ $hoe = Hoe.new('staticmatic', StaticMatic::VERSION) do |p| p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" - p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') + p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'markdown') p.rsync_args = '-av --delete --ignore-errors' end diff --git a/lib/staticmatic.rb b/lib/staticmatic.rb index 8d176dc..ceda3fe 100644 --- a/lib/staticmatic.rb +++ b/lib/staticmatic.rb @@ -5,7 +5,7 @@ require 'fileutils' module StaticMatic - VERSION = '0.10.0' + VERSION = '0.10.1' end ["render", "build", "setup", "server", "helpers", "rescue"].each do |mixin| diff --git a/lib/staticmatic/configuration.rb b/lib/staticmatic/configuration.rb index 6edf4c8..8ca4317 100644 --- a/lib/staticmatic/configuration.rb +++ b/lib/staticmatic/configuration.rb @@ -6,11 +6,13 @@ class Configuration attr_accessor :use_extensions_for_page_links attr_accessor :sass_options - + attr_accessor :haml_options + def initialize self.preview_server_port = 3000 self.use_extensions_for_page_links = true self.sass_options = {} + self.haml_options = {} end end end \ No newline at end of file diff --git a/lib/staticmatic/mixins/render.rb b/lib/staticmatic/mixins/render.rb index fc3fff4..de22675 100644 --- a/lib/staticmatic/mixins/render.rb +++ b/lib/staticmatic/mixins/render.rb @@ -93,9 +93,9 @@ def generate_css(source, source_dir = '') # generate_html_from_template_source("content:\n= yield") { "blah" } -> "content: blah" # def generate_html_from_template_source(source, options = {}) - html = Haml::Engine.new(source, options) + html = Haml::Engine.new(source, self.configuration.haml_options.merge(options)) - html.render(@scope) { yield } + html.render(@scope, options) { yield } end def determine_layout(dir = '') diff --git a/website/src/pages/how_to_use.haml b/website/src/pages/how_to_use.haml index 59ba9ca..8764ed4 100644 --- a/website/src/pages/how_to_use.haml +++ b/website/src/pages/how_to_use.haml @@ -86,6 +86,19 @@ = link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass' can take like :style => :compact +%h3 configuration.haml_options + +%p + Default is an empty hash. You can specify any options that + = link 'Haml', 'http://haml.hamptoncatlin.com/docs/haml' + can take like: + +.code :attr_wrapper => '"' + +%p + (have Haml use double quotes instead of single quotes for + wrapping HTML attribute values) + %h2{:id => 'templates'} Templates %p diff --git a/website/src/partials/news.haml b/website/src/partials/news.haml index 6118d22..c415549 100644 --- a/website/src/partials/news.haml +++ b/website/src/partials/news.haml @@ -1,5 +1,3 @@ .heading News -.title 0.10.0 Released! -%p This release brings some major improvements to error reporting as well as preparation for forthcoming improvements. - -= link "And More!", "/releases/0_10_0.html" \ No newline at end of file +.title 0.10.1 Released +%p Adds haml options & fixes bug with partial options \ No newline at end of file