nesta 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nesta (0.9.0)
4
+ nesta (0.9.1)
5
5
  RedCloth (= 4.2.2)
6
6
  builder (= 2.1.2)
7
7
  haml (= 3.0.12)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2010 Graham Ashton
1
+ Copyright (c) 2008-2011 Graham Ashton
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/bin/nesta CHANGED
@@ -15,11 +15,13 @@ GLOBAL OPTIONS
15
15
 
16
16
  COMMANDS
17
17
  new <path> Create a new Nesta project.
18
+ demo:content Install example pages in ./content-demo.
18
19
  theme:install <url> Install a theme from a git repository.
19
20
  theme:enable <name> Make the theme active, updating config.yml.
20
21
  theme:create <name> Makes a template for a new theme in ./themes.
21
22
 
22
23
  OPTIONS FOR new
24
+ --git Create a new git repository for the project.
23
25
  --heroku Include the heroku:config rake task.
24
26
  --vlad Include config/deploy.rb.
25
27
 
@@ -29,6 +31,7 @@ exit 0
29
31
 
30
32
  def self.parse_command_line
31
33
  opts = GetoptLong.new(
34
+ ['--git', GetoptLong::NO_ARGUMENT],
32
35
  ['--help', '-h', GetoptLong::NO_ARGUMENT],
33
36
  ['--heroku', GetoptLong::NO_ARGUMENT],
34
37
  ['--vlad', GetoptLong::NO_ARGUMENT]
@@ -51,6 +54,8 @@ exit 0
51
54
  case command
52
55
  when 'new'
53
56
  Nesta::Commands::New.new(ARGV[0], options).execute
57
+ when 'demo:content'
58
+ Nesta::Commands::Demo::Content.new.execute
54
59
  when /^theme:(create|enable|install)$/
55
60
  command_cls = Nesta::Commands::Theme.const_get($1.capitalize.to_sym)
56
61
  command_cls.new(ARGV[0], options).execute
data/lib/nesta/app.rb CHANGED
@@ -1,14 +1,16 @@
1
- require "sinatra/base"
2
- require "builder"
3
- require "haml"
4
- require "sass"
1
+ require 'sinatra/base'
2
+ require 'builder'
3
+ require 'haml'
4
+ require 'sass'
5
5
 
6
+ require File.expand_path('nesta', File.dirname(__FILE__))
6
7
  require File.expand_path('cache', File.dirname(__FILE__))
7
8
  require File.expand_path('config', File.dirname(__FILE__))
8
9
  require File.expand_path('models', File.dirname(__FILE__))
10
+ require File.expand_path('navigation', File.dirname(__FILE__))
11
+ require File.expand_path('overrides', File.dirname(__FILE__))
9
12
  require File.expand_path('path', File.dirname(__FILE__))
10
13
  require File.expand_path('plugins', File.dirname(__FILE__))
11
- require File.expand_path('overrides', File.dirname(__FILE__))
12
14
 
13
15
  Nesta::Plugins.load_local_plugins
14
16
 
@@ -18,8 +20,10 @@ module Nesta
18
20
 
19
21
  set :views, File.expand_path('../../views', File.dirname(__FILE__))
20
22
  set :cache_enabled, Config.cache
23
+ set :haml, { :format => :html5 }
21
24
 
22
25
  helpers Overrides::Renderers
26
+ helpers Navigation::Renderers
23
27
 
24
28
  helpers do
25
29
  def set_from_config(*variables)
@@ -42,26 +46,6 @@ module Nesta
42
46
  end
43
47
  end
44
48
 
45
- def display_menu(menu, options = {})
46
- defaults = { :class => nil, :levels => 2 }
47
- options = defaults.merge(options)
48
- if options[:levels] > 0
49
- haml_tag :ul, :class => options[:class] do
50
- menu.each do |item|
51
- haml_tag :li do
52
- if item.respond_to?(:each)
53
- display_menu(item, :levels => (options[:levels] - 1))
54
- else
55
- haml_tag :a, :href => item.abspath do
56
- haml_concat item.heading
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end
63
- end
64
-
65
49
  def no_widow(text)
66
50
  text.split[0...-1].join(" ") + "&nbsp;#{text.split[-1]}"
67
51
  end
@@ -105,11 +89,16 @@ module Nesta
105
89
  end
106
90
 
107
91
  def local_stylesheet?
108
- # Checks for the existence of views/local.sass. Useful for
109
- # themes that want to give the user the option to add their own
110
- # CSS rules.
92
+ Nesta.deprecated('local_stylesheet?', 'use local_stylesheet_link_tag')
111
93
  File.exist?(File.expand_path('views/local.sass', Nesta::App.root))
112
94
  end
95
+
96
+ def local_stylesheet_link_tag(name)
97
+ pattern = File.expand_path("views/#{name}.s{a,c}ss", Nesta::App.root)
98
+ if Dir.glob(pattern).size > 0
99
+ haml_tag :link, :href => "/css/#{name}.css", :rel => "stylesheet"
100
+ end
101
+ end
113
102
  end
114
103
 
115
104
  not_found do
@@ -125,7 +114,7 @@ module Nesta
125
114
  # If you want to change Nesta's behaviour, you have two options:
126
115
  #
127
116
  # 1. Create an app.rb file in your project's root directory.
128
- # 2. Make a theme or a plugin, and put all your code in there.
117
+ # 2. Make a theme or a plugin, and put the relevant code in there.
129
118
  #
130
119
  # You can add new routes, or modify the behaviour of any of the
131
120
  # default objects in app.rb, or replace any of the default view
@@ -161,7 +150,6 @@ module Nesta
161
150
  @heading = @title
162
151
  @title = "#{@title} - #{@subtitle}"
163
152
  @articles = Page.find_articles[0..7]
164
- @body_class = 'home'
165
153
  cache haml(:index)
166
154
  end
167
155
 
@@ -28,6 +28,25 @@ module Nesta
28
28
  def copy_templates(templates)
29
29
  templates.each { |src, dest| copy_template(src, dest) }
30
30
  end
31
+
32
+ def update_config_yaml(pattern, replacement)
33
+ configured = false
34
+ File.open(Nesta::Config.yaml_path, 'r+') do |file|
35
+ output = ''
36
+ file.each_line do |line|
37
+ if configured
38
+ output << line
39
+ else
40
+ output << line.sub(pattern, replacement)
41
+ configured = true if line =~ pattern
42
+ end
43
+ end
44
+ output << "#{replacement}\n" unless configured
45
+ file.pos = 0
46
+ file.print(output)
47
+ file.truncate(file.pos)
48
+ end
49
+ end
31
50
  end
32
51
 
33
52
  class New
@@ -50,6 +69,17 @@ module Nesta
50
69
  @options['heroku'] || @options['vlad']
51
70
  end
52
71
 
72
+ def create_repository
73
+ FileUtils.cd(@path) do
74
+ File.open('.gitignore', 'w') do |file|
75
+ file.puts %w[._* .*.swp .bundle .DS_Store .sass-cache].join("\n")
76
+ end
77
+ system('git', 'init')
78
+ system('git', 'add', '.')
79
+ system('git', 'commit', '-m', 'Initial commit')
80
+ end
81
+ end
82
+
53
83
  def execute
54
84
  make_directories
55
85
  templates = {
@@ -62,6 +92,40 @@ module Nesta
62
92
  templates['config/deploy.rb'] = "#{@path}/config/deploy.rb"
63
93
  end
64
94
  copy_templates(templates)
95
+ create_repository if @options['git']
96
+ end
97
+ end
98
+
99
+ module Demo
100
+ class Content
101
+ include Command
102
+
103
+ def initialize
104
+ @dir = 'content-demo'
105
+ end
106
+
107
+ def clone_or_update_repository
108
+ repository = 'git://github.com/gma/nesta-demo-content.git'
109
+ path = Nesta::Path.local(@dir)
110
+ if File.exist?(path)
111
+ FileUtils.cd(path) { system('git', 'pull', 'origin', 'master') }
112
+ else
113
+ system('git', 'clone', repository, path)
114
+ end
115
+ end
116
+
117
+ def configure_git_to_ignore_repo
118
+ excludes = Nesta::Path.local('.git/info/exclude')
119
+ if File.exist?(excludes) && File.read(excludes).scan(@dir).empty?
120
+ File.open(excludes, 'a') { |file| file.puts @dir }
121
+ end
122
+ end
123
+
124
+ def execute
125
+ clone_or_update_repository
126
+ configure_git_to_ignore_repo
127
+ update_config_yaml(/^\s*#?\s*content:.*/, "content: #{@dir}")
128
+ end
65
129
  end
66
130
  end
67
131
 
@@ -115,19 +179,7 @@ module Nesta
115
179
  end
116
180
 
117
181
  def execute
118
- theme_config = /^\s*#?\s*theme:.*/
119
- configured = false
120
- File.open(Nesta::Config.yaml_path, 'r+') do |file|
121
- output = ''
122
- file.each_line do |line|
123
- output << line.sub(theme_config, "theme: #{@name}")
124
- configured = true if line =~ theme_config
125
- end
126
- output << "theme: #{@name}\n" unless configured
127
- file.pos = 0
128
- file.print(output)
129
- file.truncate(file.pos)
130
- end
182
+ update_config_yaml(/^\s*#?\s*theme:.*/, "theme: #{@name}")
131
183
  end
132
184
  end
133
185
  end
data/lib/nesta/models.rb CHANGED
@@ -42,14 +42,8 @@ module Nesta
42
42
  @@cache = {}
43
43
  end
44
44
 
45
- def self.deprecated(name, message)
46
- if Nesta::App.environment != :test
47
- $stderr.puts "DEPRECATION WARNING: #{name} is deprecated; #{message}"
48
- end
49
- end
50
-
51
45
  def self.menu_items
52
- deprecated("Page.menu_items", "see Menu.top_level and Menu.for_path")
46
+ Nesta.deprecated('Page.menu_items', 'see Menu.top_level and Menu.for_path')
53
47
  Menu.top_level
54
48
  end
55
49
 
@@ -0,0 +1,29 @@
1
+ module Nesta
2
+ module Navigation
3
+ module Renderers
4
+ def display_menu(menu, options = {})
5
+ defaults = { :class => nil, :levels => 2 }
6
+ options = defaults.merge(options)
7
+ if options[:levels] > 0
8
+ haml_tag :ul, :class => options[:class] do
9
+ menu.each do |item|
10
+ display_menu_item(item, options)
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ def display_menu_item(item, options = {})
17
+ haml_tag :li do
18
+ if item.respond_to?(:each)
19
+ display_menu(item, :levels => (options[:levels] - 1))
20
+ else
21
+ haml_tag :a, :href => item.abspath do
22
+ haml_concat item.heading
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
data/lib/nesta/nesta.rb CHANGED
@@ -0,0 +1,7 @@
1
+ module Nesta
2
+ def self.deprecated(name, message)
3
+ if Nesta::App.environment != :test
4
+ $stderr.puts "DEPRECATION WARNING: #{name} is deprecated; #{message}"
5
+ end
6
+ end
7
+ end
data/lib/nesta/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nesta
2
- VERSION = "0.9.0"
2
+ VERSION = '0.9.1'
3
3
  end
@@ -21,6 +21,10 @@ describe "nesta" do
21
21
  File.exist?(project_path(file)).should be_true
22
22
  end
23
23
 
24
+ def create_config_yaml(text)
25
+ File.open(Nesta::Config.yaml_path, 'w') { |f| f.puts(text) }
26
+ end
27
+
24
28
  describe "new" do
25
29
  def gemfile_source
26
30
  File.read(project_path('Gemfile'))
@@ -54,6 +58,30 @@ describe "nesta" do
54
58
  end
55
59
  end
56
60
 
61
+ describe "--git" do
62
+ before(:each) do
63
+ @command = Nesta::Commands::New.new(@project_path, 'git' => '')
64
+ @command.stub!(:system)
65
+ end
66
+
67
+ it "should create a .gitignore file" do
68
+ @command.execute
69
+ File.read(project_path('.gitignore')).should match(/\.bundle/)
70
+ end
71
+
72
+ it "should create a git repo" do
73
+ @command.should_receive(:system).with('git', 'init')
74
+ @command.execute
75
+ end
76
+
77
+ it "should commit the blank project" do
78
+ @command.should_receive(:system).with('git', 'add', '.')
79
+ @command.should_receive(:system)
80
+ .with('git', 'commit', '-m', 'Initial commit')
81
+ @command.execute
82
+ end
83
+ end
84
+
57
85
  describe "--heroku" do
58
86
  before(:each) do
59
87
  Nesta::Commands::New.new(@project_path, 'heroku' => '').execute
@@ -93,6 +121,66 @@ describe "nesta" do
93
121
  end
94
122
  end
95
123
 
124
+ describe "demo:content" do
125
+ before(:each) do
126
+ @config_path = project_path('config/config.yml')
127
+ FileUtils.mkdir_p(File.dirname(@config_path))
128
+ Nesta::Config.stub!(:yaml_path).and_return(@config_path)
129
+ create_config_yaml('content: path/to/content')
130
+ Nesta::App.stub!(:root).and_return(@project_path)
131
+ @repo_url = 'git://github.com/gma/nesta-demo-content.git'
132
+ @demo_path = project_path('content-demo')
133
+ @command = Nesta::Commands::Demo::Content.new
134
+ @command.stub!(:system)
135
+ end
136
+
137
+ it "should clone the repository" do
138
+ @command.should_receive(:system)
139
+ .with('git', 'clone', @repo_url, @demo_path)
140
+ @command.execute
141
+ end
142
+
143
+ it "should configure the content directory" do
144
+ @command.execute
145
+ File.read(@config_path).should match(/^content: content-demo/)
146
+ end
147
+
148
+ describe "when repository already exists" do
149
+ before(:each) do
150
+ FileUtils.mkdir_p(@demo_path)
151
+ end
152
+
153
+ it "should update the repository" do
154
+ @command.should_receive(:system).with('git', 'pull', 'origin', 'master')
155
+ @command.execute
156
+ end
157
+ end
158
+
159
+ describe "when site versioned with git" do
160
+ before(:each) do
161
+ @exclude_path = project_path('.git/info/exclude')
162
+ FileUtils.mkdir_p(File.dirname(@exclude_path))
163
+ File.open(@exclude_path, 'w') { |file| file.puts '# Excludes' }
164
+ end
165
+
166
+ it "should tell git to ignore content-demo" do
167
+ @command.execute
168
+ File.read(@exclude_path).should match(/content-demo/)
169
+ end
170
+
171
+ describe "and content-demo already ignored" do
172
+ before(:each) do
173
+ File.open(@exclude_path, 'w') { |file| file.puts 'content-demo' }
174
+ end
175
+
176
+ it "shouldn't tell git to ignore it twice" do
177
+ @command.execute
178
+ File.read(@exclude_path).scan('content-demo').size.should == 1
179
+ end
180
+ end
181
+ end
182
+ end
183
+
96
184
  describe "theme:install" do
97
185
  before(:each) do
98
186
  @repo_url = 'git://github.com/gma/nesta-theme-mine.git'
@@ -151,10 +239,6 @@ describe "nesta" do
151
239
  @command = Nesta::Commands::Theme::Enable.new(@name)
152
240
  end
153
241
 
154
- def create_config_yaml(text)
155
- File.open(Nesta::Config.yaml_path, 'w') { |f| f.puts(text) }
156
- end
157
-
158
242
  shared_examples_for "command that configures the theme" do
159
243
  it "should enable the theme" do
160
244
  @command.execute
data/spec/page_spec.rb CHANGED
@@ -112,13 +112,14 @@ describe "The home page" do
112
112
  end
113
113
 
114
114
  it "should display site title in h1 tag" do
115
- do_get
116
- body.should have_tag('#header p.title', /My blog/)
115
+ pending "Hpricot doesn't support HTML5"
116
+ body.should have_tag('hgroup h1', /My blog/)
117
117
  end
118
118
 
119
- it "should display site subtitle in h1 tag" do
119
+ it "should display site subtitle in heading tag" do
120
+ pending "Hpricot doesn't support HTML5"
120
121
  do_get
121
- body.should have_tag('#header p.subtitle', /about stuff/)
122
+ body.should have_tag('hgroup h2', /about stuff/)
122
123
  end
123
124
 
124
125
  it "should set description meta tag" do
@@ -159,7 +160,7 @@ describe "The home page" do
159
160
 
160
161
  it "should display link to article in h2 tag" do
161
162
  body.should have_tag(
162
- "h2 a[@href=#{@article.abspath}]", /^\s*#{@article.heading}$/)
163
+ "h1 a[@href=#{@article.abspath}]", /^\s*#{@article.heading}$/)
163
164
  end
164
165
 
165
166
  it "should display article summary if available" do
@@ -227,7 +228,7 @@ describe "An article" do
227
228
 
228
229
  it "should display the date" do
229
230
  do_get
230
- body.should have_tag("div.date", @date)
231
+ body.should have_tag("time", @date)
231
232
  end
232
233
 
233
234
  it "should display the content" do
@@ -251,18 +252,19 @@ describe "An article" do
251
252
  end
252
253
 
253
254
  it "should link to each category" do
255
+ pending "Hpricot doesn't support HTML5"
254
256
  do_get
255
- body.should have_tag("div.categories", /Categories/)
256
- body.should have_tag("div.categories") do |categories|
257
+ body.should have_tag("nav.categories") do |categories|
257
258
  categories.should have_tag("a[@href=/banana]", "Banana")
258
259
  categories.should have_tag("a[@href=/the-apple]", "Apple")
259
260
  end
260
261
  end
261
262
 
262
263
  it "should link to a category in breadcrumb" do
264
+ pending "Hpricot doesn't support HTML5"
263
265
  do_get
264
266
  body.should have_tag(
265
- "div.breadcrumb/a[@href=#{@category.abspath}]", @category.heading)
267
+ "nav.breadcrumb/a[@href=#{@category.abspath}]", @category.heading)
266
268
  end
267
269
 
268
270
  it "should contain category name in page title" do
@@ -342,7 +344,7 @@ describe "A page" do
342
344
  it "should display links to articles" do
343
345
  do_get
344
346
  body.should have_tag(
345
- "h3 a[@href='#{@article.abspath}']", /^\s*#{@article.heading}$/)
347
+ "h1 a[@href='#{@article.abspath}']", /^\s*#{@article.heading}$/)
346
348
  body.should_not have_tag("h3", @article2.heading)
347
349
  end
348
350
  end
@@ -1,3 +1,4 @@
1
1
  - if ! @menu_items.empty?
2
- %h2 Articles by category
3
- - display_menu(@menu_items, :class => "menu")
2
+ %nav.categories
3
+ %h1 Articles by category
4
+ - display_menu(@menu_items, :class => "menu")
data/views/comments.haml CHANGED
@@ -1,8 +1,8 @@
1
1
  - if short_name = Nesta::Config.disqus_short_name
2
2
  #disqus_thread
3
3
  - if Sinatra::Application.environment == :development
4
- %script{ :type => "text/javascript" }
4
+ %script(type="text/javascript")
5
5
  var disqus_developer = true;
6
- %script{ :type => "text/javascript", :src => "http://disqus.com/forums/#{short_name}/embed.js" }
6
+ %script(type="text/javascript" src="http://disqus.com/forums/#{short_name}/embed.js")
7
7
  %noscript
8
- %a{ :href => "http://disqus.com/forums/#{short_name}/?url=ref" } View comments.
8
+ %a(href="http://disqus.com/forums/#{short_name}/?url=ref") View comments.
data/views/error.haml CHANGED
@@ -1,13 +1,12 @@
1
- .breadcrumb
2
- %a{ :href => "/" } Home
1
+ %nav.breadcrumb
2
+ %a(href="/") Home
3
3
 
4
4
  #content
5
- %h1 Sorry, something went wrong
5
+ %section(role="main")
6
+ %h1 Sorry, something went wrong
6
7
 
7
- %p
8
- An error occurred whilst we were trying to serve your page. Please bear
9
- with us, or in the mean time, try another page.
8
+ %p
9
+ An error occurred whilst we were trying to serve your page. Please
10
+ bear with us, or try another page.
10
11
 
11
- #sidebar
12
- = haml :categories, :layout => false
13
- = haml :feed, :layout => false
12
+ = haml :sidebar, :layout => false
data/views/feed.haml CHANGED
@@ -1,3 +1,3 @@
1
1
  - title ||= "Atom feed"
2
2
  .feed
3
- %a{ :href => "/articles.xml", :title => title }= title
3
+ %a(href="/articles.xml" title=title)= title
data/views/footer.haml ADDED
@@ -0,0 +1,8 @@
1
+ %footer.branding
2
+ %p
3
+ Powered by Nesta, a
4
+ = succeed "." do
5
+ %a(href="http://effectif.com/nesta") Ruby CMS
6
+ Design by
7
+ = succeed "." do
8
+ %a(href="http://effectif.com") Graham Ashton
data/views/header.haml ADDED
@@ -0,0 +1,4 @@
1
+ %header(role="banner")
2
+ %hgroup
3
+ %h1= @heading
4
+ %h2= @subtitle
data/views/index.haml CHANGED
@@ -1,5 +1,7 @@
1
+ %nav.breadcrumb Home
2
+
1
3
  #content
2
- %h1 Recent articles
3
- = haml :summaries, :layout => false, :locals => { :pages => @articles, :heading => :h2 }
4
+ %section.articles
5
+ = haml :summaries, :layout => false, :locals => { :pages => @articles }
4
6
 
5
7
  = haml :sidebar, :layout => false
data/views/layout.haml CHANGED
@@ -1,27 +1,24 @@
1
- !!!
2
- %html{ :lang => "en", "xml:lang" => "en", :xmlns => 'http://www.w3.org/1999/xhtml' }
1
+ <!DOCTYPE html>
2
+ %html(lang="en")
3
3
  %head
4
- %meta{ "http-equiv" => "content-type", "content" => "text/html; charset=utf-8" }
4
+ %meta(charset="utf-8")
5
5
  - if @description
6
- %meta{ "name" => "description", "content" => @description }
6
+ %meta(name="description" content=@description)
7
7
  - if @keywords
8
- %meta{ "name" => "keywords", "content" => @keywords }
8
+ %meta(name="keywords" content=@keywords)
9
9
  %title= @title
10
- %link{ :href => "/css/master.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }
11
- - if local_stylesheet?
12
- %link{ :href => "/css/local.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }
13
- %link{ :href => "/articles.xml", :rel => "alternate", :type => "application/atom+xml" }
10
+ <!--[if ! lte IE 6]><!-->
11
+ %link(href="/css/master.css" media="screen" rel="stylesheet")
12
+ <!--<![endif]-->
13
+ /[if lte IE 6]
14
+ %link(rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.1.1.css" media="screen, projection")
15
+ /[if lt IE 9]
16
+ %script(src="//html5shim.googlecode.com/svn/trunk/html5.js")
17
+ = local_stylesheet_link_tag('local')
18
+ %link(href="/articles.xml" rel="alternate" type="application/atom+xml")
14
19
  = haml :analytics, :layout => false
15
- %body{ :class => @body_class }
20
+ %body
16
21
  #container
17
- #header
18
- %p.title= @heading
19
- %p.subtitle= @subtitle
22
+ = haml :header, :layout => false
20
23
  = yield
21
- #footer
22
- %p
23
- Powered by
24
- = succeed "," do
25
- %a{ :href => "http://effectif.com/nesta" } nesta
26
- designed by
27
- %a{ :href => "http://effectif.com" } Graham Ashton
24
+ = haml :footer, :layout => false
data/views/master.sass CHANGED
@@ -1,17 +1,21 @@
1
+ @import "mixins.sass"
2
+
1
3
  // Variables
2
4
 
3
5
  $content-width: 37em
4
6
 
5
- $tint: #D3D4D8
6
- $base-color: $tint - #888
7
- $dark-tint: $tint - #333
8
- $background-tint: $tint + #222
9
- $border-color: $tint + #111
7
+ $base-color: #262626
8
+ $background-color: #fff
9
+ $tint: #f1f1f3
10
+ $border-color: #99d
11
+ $link-color: #3F63DA
12
+ $visited-link-color: darken($link-color, 15%)
13
+ $hover-link-color: lighten($link-color, 15%)
14
+ $active-link-color: darken($link-color, 50%)
15
+ $nav-link-color: desaturate($link-color, 55%)
16
+ $meta-color: #999
10
17
 
11
- $h1-scale: 2.18
12
- $h2-scale: 1.64
13
- $h3-scale: 1.45
14
- $h4-scale: 1.18
18
+ $border-style: 1px dashed $border-color
15
19
 
16
20
  // Reset
17
21
 
@@ -21,36 +25,29 @@ $h4-scale: 1.18
21
25
 
22
26
  // Typography
23
27
 
24
- $base-scale: 0.88
25
- $base-font: $base-scale * 1em
26
- $vertical-rhythm: 1.5em
27
- $base-vertical-margin: 1.5em
28
-
29
- @mixin adjust-font-size($scale, $top-weight: 1, $bottom-weight: 1)
30
- $average-margin: $base-vertical-margin / $scale
31
- margin-top: $average-margin * $top-weight
32
- margin-bottom: $average-margin * $bottom-weight
33
-
34
- $line-height: $vertical-rhythm / $scale
35
- @if $line-height < 1
36
- line-height: $line-height * 2
37
- @else
38
- line-height: $line-height
39
-
40
- font-size: 100% * $scale
41
-
42
- @mixin border-radius($radius)
43
- -webkit-border-radius: $radius
44
- -moz-border-radius: $radius
45
- border-radius: $radius
28
+ @mixin text-shadow
29
+ text-shadow: 0 2px 3px #ddd
46
30
 
47
31
  body
48
- font: $base-font "Helvetica Neue", Helvetica, sans-serif
32
+ font: ($base-font * 1.05) Georgia, serif
49
33
  line-height: $vertical-rhythm
50
34
  color: $base-color
51
35
 
36
+ header[role=banner]
37
+ h1,
38
+ h2
39
+ margin: 0
40
+ line-height: 1.2em
41
+ font-weight: normal
42
+ h1
43
+ font-size: 327%
44
+ @include text-shadow
45
+ h2
46
+ color: $meta-color
47
+ font-size: 1em
48
+
52
49
  h1, h2, h3, h4, h5, h6
53
- font-family: "Helvetica Neue", Helvetica, sans-serif
50
+ font-family: Georgia, serif
54
51
  h1
55
52
  @include adjust-font-size($h1-scale, 0.6, 0.4)
56
53
  font-weight: normal
@@ -75,10 +72,10 @@ li
75
72
 
76
73
  blockquote
77
74
  margin: $base-vertical-margin 0
78
- border-left: 0.5em solid $tint
79
- padding-left: 1em
75
+ padding: 0 $base-vertical-margin
80
76
 
81
77
  font-style: italic
78
+ color: $base-color + #555
82
79
 
83
80
  pre
84
81
  padding: ($vertical-rhythm / 2) 1em
@@ -89,31 +86,36 @@ img
89
86
 
90
87
  // Layout
91
88
 
89
+ article, aside, footer, header, nav, section
90
+ display: block
91
+
92
92
  div#container
93
93
  width: 54em
94
94
  margin: 0 auto
95
+ padding: 1em 1em 0 1em
95
96
 
96
- div#header
97
- padding: 1em
98
-
99
- div.breadcrumb
100
- padding: 0.5em 1.1em
97
+ nav.breadcrumb
98
+ margin-top: $vertical-rhythm
99
+ color: $meta-color
100
+ padding: 0.5em 0
101
101
 
102
102
  font-size: 0.909em
103
103
 
104
104
  div#content
105
+ position: relative
105
106
  width: $content-width
106
107
  float: left
107
- padding: 1px 1em
108
+ padding: 1px 0
108
109
 
109
110
  div#sidebar
110
111
  width: 12em
111
112
  margin-left: 40em
112
113
  padding: 1px 1em
113
114
 
114
- div#footer
115
+ footer.branding
115
116
  clear: both
116
- padding: 0 1em
117
+ color: $meta-color
118
+ @include adjust-font-size($base-scale)
117
119
  p
118
120
  width: $content-width
119
121
  margin: 0
@@ -121,118 +123,110 @@ div#container
121
123
 
122
124
  // The visuals
123
125
 
124
- @mixin dark-tint-text
125
- color: $dark-tint
126
- text-shadow: 0 -1px 1px white
126
+ a
127
+ border-bottom: 1px dotted $link-color
128
+ text-decoration: none
129
+ color: $link-color
130
+ @include transition(color 0.25s 0 ease)
131
+ &:visited
132
+ color: $visited-link-color
133
+ border-bottom-color: $visited-link-color
134
+ &:hover
135
+ color: $hover-link-color
136
+ border-bottom-color: $hover-link-color
137
+ &:active
138
+ color: $active-link-color
139
+ border-bottom-color: $active-link-color
140
+
141
+ nav.categories,
142
+ div.feed,
143
+ article p.meta
144
+ a
145
+ color: $nav-link-color
146
+ border-bottom-color: $background-color
147
+ &:hover a
148
+ color: $link-color
149
+ a:hover
150
+ color: $hover-link-color
151
+
152
+ article p.meta
153
+ a
154
+ @include transition(border-bottom-color 0.5s 0 ease)
155
+ a:hover
156
+ border-bottom-color: $hover-link-color
157
+
158
+ article h1 a
159
+ border-bottom: none
127
160
 
128
161
  body
129
- background: $background-tint
130
-
131
- &.home h1
132
- @include adjust-font-size($h1-scale, 1, -1)
133
-
134
- div#header
135
- p.title,
136
- p.subtitle
137
- margin: 0
138
- line-height: 1.2em
139
- font-weight: normal
140
- p.title
141
- font-size: 327%
142
- text-shadow: -1px 2px 1px $tint
143
- p.subtitle
144
- font-size: 1em
145
- @include dark-tint-text
146
-
147
- div#content
148
- position: relative
149
- @include border-radius(0.5em)
150
- background-color: white
151
-
152
- div.date
153
- position: absolute
154
- right: 40em
155
- top: $vertical-rhythm * 3
156
- text-align: right
157
- @include dark-tint-text
158
-
159
- h2
160
- background: $background-tint - #111
161
- margin-left: (-2em / $h2-scale) * $base-scale
162
- margin-right: 0
163
- padding-left: 1em
164
- padding-right: 1em
165
-
166
- text-shadow: 0 1px 0 $tint + #333
162
+ background: $background-color
167
163
 
168
- ol,
169
- ul
170
- margin-left: 1.5em
171
-
164
+ article
172
165
  img
173
166
  max-width: 100%
174
167
  margin-bottom: $base-vertical-margin
175
168
 
176
169
  code,
177
170
  pre
178
- background-color: $background-tint
171
+ background-color: $tint
179
172
  code
180
173
  padding: 1px 3px
181
174
  pre
182
- border-left: 0.4em solid $border-color
175
+ border-left: $border-style
176
+ background-color: $tint
183
177
  code
184
178
  padding: 0
185
179
 
186
- // Pages/articles assigned to this page
187
- ol.pages
188
- margin-left: 0
189
- li
190
- position: relative
191
-
192
- margin-left: -1.5em
193
- padding-left: 1.5em
194
- background-color: rgba(255, 255, 255, 0.8)
195
-
196
- list-style: none
197
-
198
- h2
199
- margin-left: 0
200
- margin-right: 0
201
- padding: 0
202
- background: none
180
+ footer
181
+ border-top: $border-style
182
+ p.meta
183
+ @include adjust-font-size(0.909, 0.1, 1.9)
184
+ font-style: italic
185
+ color: $meta-color
203
186
 
204
- div.date
205
- top: $vertical-rhythm * 2.5
206
- right: 39em
207
- h3 + div.date
208
- top: $vertical-rhythm * 1.5
187
+ // Pages of content
188
+ article[role="main"]
189
+ h1, h2
190
+ @include text-shadow
209
191
 
210
- p.read_more
211
- @include adjust-font-size(0.909, 0, 0)
212
-
213
- div.categories
214
- margin-left: -1em
215
- margin-right: -1em
216
- border-top: 1px solid $background-tint - #0a0a0a
217
- padding: 0.5em 1em
218
- background: $background-tint
219
- a
220
- margin-right: 0.25em
221
-
222
192
  div#disqus_thread
223
193
  img
224
194
  max-width: none
225
195
  ul#dsq-comments
226
196
  margin-left: 0
227
197
 
228
- div#sidebar
229
- @include border-radius(0.5em)
230
- background-color: white
231
- background-color: rgba(255, 255, 255, 0.9)
232
-
233
- h2
234
- @include adjust-font-size(1, 1.4, 0.6)
235
- font-weight: bold
198
+ // Pages/articles assigned to this page
199
+ section.pages,
200
+ section.articles
201
+ & > ol
202
+ margin-left: 0
203
+ li
204
+ position: relative
205
+ list-style: none
206
+ article
207
+ ol li
208
+ list-style: decimal
209
+ ul li
210
+ list-style: disc
211
+
212
+ header[role=main] h1
213
+ @include adjust-font-size($h1-scale, 1.5, 0.5)
214
+ header h1
215
+ @include adjust-font-size($h2-scale, 1.5, 0.5)
216
+
217
+ article
218
+ h1
219
+ text-shadow: none
220
+ p.read_more
221
+ @include adjust-font-size(1, 0, 0)
222
+ margin-top: -$base-vertical-margin
223
+ footer
224
+ border-top: none
225
+
226
+ nav.categories
227
+ h1
228
+ @include adjust-font-size(1, 2, 0)
229
+
236
230
  ul.menu
237
231
  list-style: none
238
232
  ul
@@ -241,6 +235,5 @@ div#sidebar
241
235
  & > ul
242
236
  @include adjust-font-size(0.909, 0, 0)
243
237
 
244
- div.feed,
245
- div.social
246
- margin: $base-vertical-margin 0
238
+ div.feed
239
+ margin: $base-vertical-margin 0
data/views/mixins.sass ADDED
@@ -0,0 +1,39 @@
1
+ // Default ratios between font sizes; used to maintain the type hierarchy.
2
+ // http://www.markboulton.co.uk/journal/comments/five-simple-steps-to-better-typography-part-4
3
+
4
+ $h1-scale: 2.18
5
+ $h2-scale: 1.64
6
+ $h3-scale: 1.45
7
+ $h4-scale: 1.18
8
+
9
+ // Variables used in calculations used to maintain vertical rhythm.
10
+ // http://webtypography.net/Rhythm_and_Proportion/Vertical_Motion/2.2.2/
11
+
12
+ $base-scale: 0.88
13
+ $base-font: $base-scale * 1em
14
+ $vertical-rhythm: 1.75em
15
+ $base-vertical-margin: 1.75em
16
+
17
+ @mixin adjust-font-size($scale, $top-weight: 1, $bottom-weight: 1)
18
+ $average-margin: $base-vertical-margin / $scale
19
+ margin-top: $average-margin * $top-weight
20
+ margin-bottom: $average-margin * $bottom-weight
21
+
22
+ $line-height: $vertical-rhythm / $scale
23
+ @if $line-height < 1
24
+ line-height: $line-height * 2
25
+ @else
26
+ line-height: $line-height
27
+
28
+ font-size: 100% * $scale
29
+
30
+ @mixin border-radius($radius)
31
+ -webkit-border-radius: $radius
32
+ -moz-border-radius: $radius
33
+ border-radius: $radius
34
+
35
+ @mixin transition($definition)
36
+ -moz-transition: $definition
37
+ -o-transition: $definition
38
+ -webkit-transition: $definition
39
+ transition: $definition
data/views/not_found.haml CHANGED
@@ -1,13 +1,12 @@
1
- .breadcrumb
2
- %a{ :href => "/" } Home
1
+ %nav.breadcrumb
2
+ %a(href="/") Home
3
3
 
4
4
  #content
5
- %h1 Page not found
5
+ %section(role="main")
6
+ %h1 Page not found
6
7
 
7
- %p
8
- Please try another page or, if you think something is wrong with our site,
9
- do get in touch and let us know.
8
+ %p
9
+ Please try another page or, if you think something is wrong with
10
+ our site, do get in touch and let us know.
10
11
 
11
- #sidebar
12
- = haml :categories, :layout => false
13
- = haml :feed, :layout => false
12
+ = haml :sidebar, :layout => false
data/views/page.haml CHANGED
@@ -1,28 +1,25 @@
1
- .breadcrumb
2
- %a{ :href => "/" } Home
1
+ %nav.breadcrumb
2
+ %a(href="/") Home
3
3
  &gt;
4
4
  - if @page.parent
5
- %a{ :href => @page.parent.abspath }= @page.parent.heading
5
+ %a(href="#{@page.parent.abspath}")= @page.parent.heading
6
6
  &gt;
7
7
  = @page.heading
8
8
 
9
9
  #content
10
- - if @page.date
11
- .date= format_date(@page.date)
10
+ %article(role="main")
11
+ ~ @page.to_html(self)
12
12
 
13
- ~ @page.to_html(self)
13
+ %section.pages
14
+ = haml :summaries, :layout => false, :locals => { :pages => @page.pages }
14
15
 
15
- = haml :summaries, :layout => false, :locals => { :pages => @page.pages, :heading => :h3 }
16
+ - unless @page.articles.empty?
17
+ %section.articles
18
+ %header
19
+ %h1= "Articles on #{@page.heading}"
20
+ = haml :summaries, :layout => false, :locals => { :pages => @page.articles, :heading => :h3 }
16
21
 
17
- - unless @page.articles.empty?
18
- %h2= "Articles on #{@page.heading}"
19
- = haml :summaries, :layout => false, :locals => { :pages => @page.articles, :heading => :h3 }
20
-
21
- - unless @page.categories.empty?
22
- .categories
23
- %strong Categories:
24
- - @page.categories.each do |category|
25
- %a{ :href => category.abspath }= category.heading
22
+ = haml :page_meta, :layout => false, :locals => { :page => @page }
26
23
 
27
24
  = haml :comments, :layout => false
28
25
 
@@ -0,0 +1,16 @@
1
+ - if page.date
2
+ %footer
3
+ %p.meta
4
+ Published
5
+ - if page.date
6
+ on
7
+ %time(datetime="#{page.date.to_s}" pubdate=true)= format_date(page.date)
8
+ - if (! page.categories.empty?)
9
+ in
10
+ - page.categories.each do |category|
11
+ - if category != page.categories[-1]
12
+ = succeed ',' do
13
+ %a(href="#{category.abspath}")= category.heading
14
+ - else
15
+ %a(href="#{category.abspath}")= category.heading
16
+
data/views/summaries.haml CHANGED
@@ -1,14 +1,15 @@
1
1
  - unless pages.empty?
2
- %ol.pages
2
+ %ol
3
3
  - pages.each do |page|
4
4
  %li
5
- - haml_tag heading do
6
- %a{ :href => page.abspath }= page.heading
7
- - if page.date
8
- .date= format_date(page.date)
9
- - if page.summary.nil? || page.summary.empty?
10
- ~ page.body
11
- - else
12
- ~ page.summary
13
- %p.read_more
14
- %a{ :href => page.abspath }= page.read_more
5
+ %article
6
+ %header
7
+ %h1
8
+ %a(href="#{page.abspath}")= page.heading
9
+ - if page.summary.nil? || page.summary.empty?
10
+ ~ page.body
11
+ - else
12
+ ~ page.summary
13
+ %p.read_more
14
+ %a(href="#{page.abspath}")= page.read_more
15
+ = haml :page_meta, :layout => false, :locals => { :page => page }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 0
9
- version: 0.9.0
8
+ - 1
9
+ version: 0.9.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Graham Ashton
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-20 00:00:00 +00:00
17
+ date: 2010-12-31 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -217,6 +217,7 @@ files:
217
217
  - lib/nesta/commands.rb
218
218
  - lib/nesta/config.rb
219
219
  - lib/nesta/models.rb
220
+ - lib/nesta/navigation.rb
220
221
  - lib/nesta/nesta.rb
221
222
  - lib/nesta/overrides.rb
222
223
  - lib/nesta/path.rb
@@ -246,11 +247,15 @@ files:
246
247
  - views/comments.haml
247
248
  - views/error.haml
248
249
  - views/feed.haml
250
+ - views/footer.haml
251
+ - views/header.haml
249
252
  - views/index.haml
250
253
  - views/layout.haml
251
254
  - views/master.sass
255
+ - views/mixins.sass
252
256
  - views/not_found.haml
253
257
  - views/page.haml
258
+ - views/page_meta.haml
254
259
  - views/sidebar.haml
255
260
  - views/sitemap.builder
256
261
  - views/summaries.haml
@@ -268,7 +273,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
273
  requirements:
269
274
  - - ">="
270
275
  - !ruby/object:Gem::Version
271
- hash: 4334237335545750937
276
+ hash: 3521966817245856409
272
277
  segments:
273
278
  - 0
274
279
  version: "0"
@@ -277,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
282
  requirements:
278
283
  - - ">="
279
284
  - !ruby/object:Gem::Version
280
- hash: 4334237335545750937
285
+ hash: 3521966817245856409
281
286
  segments:
282
287
  - 0
283
288
  version: "0"