broadway 0.0.3.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/README.markdown +155 -0
  2. data/lib/broadway.rb +64 -4
  3. data/lib/broadway/{core_ext.rb → ext.rb} +40 -6
  4. data/lib/broadway/filters/erb.rb +10 -0
  5. data/lib/broadway/filters/haml.rb +10 -0
  6. data/lib/broadway/filters/liquid.rb +14 -0
  7. data/lib/broadway/filters/markdown.rb +10 -0
  8. data/lib/broadway/filters/textile.rb +11 -0
  9. data/lib/broadway/migrators/blogger.rb +7 -0
  10. data/lib/broadway/migrators/wordpress.rb +7 -0
  11. data/lib/broadway/mixins/assetable.rb +48 -0
  12. data/lib/broadway/mixins/configurable.rb +32 -0
  13. data/lib/broadway/mixins/convertible.rb +25 -0
  14. data/lib/broadway/mixins/hierarchical.rb +61 -0
  15. data/lib/broadway/mixins/layoutable.rb +18 -0
  16. data/lib/broadway/mixins/pageable.rb +5 -0
  17. data/lib/broadway/mixins/processable.rb +44 -0
  18. data/lib/broadway/mixins/publishable.rb +36 -0
  19. data/lib/broadway/mixins/readable.rb +73 -0
  20. data/lib/broadway/mixins/resourceful.rb +27 -0
  21. data/lib/broadway/mixins/sluggable.rb +36 -0
  22. data/lib/broadway/mixins/sortable.rb +24 -0
  23. data/lib/broadway/mixins/taggable.rb +46 -0
  24. data/lib/broadway/mixins/themeable.rb +39 -0
  25. data/lib/broadway/processors/link.rb +45 -0
  26. data/lib/broadway/processors/post.rb +117 -0
  27. data/lib/broadway/processors/site.rb +77 -0
  28. data/lib/broadway/processors/tree.rb +121 -0
  29. data/lib/broadway/resources/asset.rb +28 -0
  30. data/lib/broadway/resources/configuration.rb +114 -0
  31. data/lib/broadway/resources/file.rb +88 -0
  32. data/lib/broadway/resources/layout.rb +28 -0
  33. data/lib/broadway/resources/link.rb +16 -0
  34. data/lib/broadway/resources/post.rb +63 -0
  35. data/lib/broadway/resources/site.rb +164 -0
  36. data/lib/broadway/resources/slug.rb +69 -0
  37. data/lib/broadway/sinatra/app.rb +21 -0
  38. data/lib/broadway/sinatra/helpers/collection_helper.rb +2 -1
  39. data/lib/broadway/sinatra/helpers/partial_helper.rb +5 -5
  40. data/lib/broadway/sinatra/helpers/text_helper.rb +5 -11
  41. data/lib/broadway/sinatra/processor.rb +84 -0
  42. data/lib/broadway/tasks.rb +1 -0
  43. data/lib/broadway/tasks/default.rake +85 -0
  44. metadata +46 -41
  45. data/README.textile +0 -306
  46. data/Rakefile +0 -85
  47. data/lib/broadway/api.rb +0 -51
  48. data/lib/broadway/asset.rb +0 -17
  49. data/lib/broadway/base.rb +0 -120
  50. data/lib/broadway/convertible.rb +0 -91
  51. data/lib/broadway/page.rb +0 -71
  52. data/lib/broadway/post.rb +0 -112
  53. data/lib/broadway/rails.rb +0 -3
  54. data/lib/broadway/resource.rb +0 -128
  55. data/lib/broadway/runner.rb +0 -62
  56. data/lib/broadway/sinatra.rb +0 -5
  57. data/lib/broadway/sinatra/base.rb +0 -90
  58. data/lib/broadway/sinatra/helpers.rb +0 -7
  59. data/lib/broadway/site.rb +0 -421
  60. data/lib/broadway/static_file.rb +0 -32
@@ -1,5 +1,5 @@
1
1
  module Broadway
2
- module Helpers
2
+ module Sinatra
3
3
  module CollectionHelper
4
4
 
5
5
  # comment from http://openmonkey.com/articles/2009/02/a-cycle-helper-for-sinatra
@@ -68,6 +68,7 @@ module Broadway
68
68
  elsif i == array.length - 1 and options.has_key?(:last)
69
69
  attributes[:class] << " #{options[:last]}"
70
70
  end
71
+ attributes.delete(:class) if attributes[:class].blank?
71
72
  haml_tag :li, attributes do
72
73
  if block_given?
73
74
  yield node
@@ -1,5 +1,5 @@
1
1
  module Broadway
2
- module Helpers
2
+ module Sinatra
3
3
  module PartialHelper
4
4
 
5
5
  def partial(template, options = {})
@@ -8,8 +8,8 @@ module Broadway
8
8
  options.merge!(:layout => false)
9
9
  template_array = template.to_s.split('/')
10
10
  template = "_#{template_array[-1]}"
11
- local_template = File.join(request.env["PATH_INFO"][1..-1], template)
12
- template = local_template if File.exists?(File.join("public", local_template) + ".haml")
11
+ local_template = ::File.join(request.env["PATH_INFO"][1..-1], template)
12
+ template = local_template if ::File.exists?(::File.join("public", local_template) + ".haml")
13
13
  template = template_array[0..-2].join('/') + "/#{template}"
14
14
  if collection = options.delete(:collection) then
15
15
  collection.inject([]) do |buffer, member|
@@ -22,14 +22,14 @@ module Broadway
22
22
  end
23
23
 
24
24
  def theme_partial(template, options = {})
25
- theme = File.join(c(:theme_path), c(:theme))
25
+ theme = ::File.join(c(:theme_path), c(:theme))
26
26
  version = nil
27
27
  if options.has_key?(:locals) and options[:locals].has_key?(:theme_version)
28
28
  version = options[:locals][:theme_version]
29
29
  else
30
30
  version = "main"
31
31
  end
32
- partial(File.join(theme, version, template.to_s), options)
32
+ partial(::File.join(theme, version, template.to_s), options)
33
33
  end
34
34
 
35
35
  end
@@ -1,12 +1,10 @@
1
1
  module Broadway
2
- module Helpers
2
+ module Sinatra
3
3
  module TextHelper
4
4
 
5
5
  # config helper method
6
6
  def c(path)
7
- result = site.config
8
- path.to_s.split(".").each { |node| result = result[node.to_sym] if result }
9
- result.nil? ? [] : result
7
+ site.configuration.get(path)
10
8
  end
11
9
 
12
10
  # read the post and parse it with Liquid
@@ -14,15 +12,11 @@ module Broadway
14
12
  post.read(attribute)
15
13
  end
16
14
 
17
- def read_excerpt(post, max_length = nil)
18
- result = read(post, "excerpt")
19
- result = read(post) if result.nil? || result.empty?
20
- max_length ||= result.length
21
- result[0..max_length] + "..."
22
- result
15
+ def read_excerpt(post, max_length = nil, format = nil, strip = true)
16
+ post.read_excerpt(max_length, format, strip)
23
17
  end
24
18
 
25
- def code(code, options={})
19
+ def code(code, options = {})
26
20
  options[:lang] = extension_to_lang(options[:extension]) if options.has_key?(:extension)
27
21
  puts options.inspect
28
22
  options[:lang] ||= "plain_text" unless Uv.syntaxes.include?(options[:lang])
@@ -0,0 +1,84 @@
1
+ require 'fileutils'
2
+ require 'net/http'
3
+
4
+ module Broadway
5
+ module Sinatra
6
+ class Processor
7
+ attr_accessor :site, :url, :paths
8
+
9
+ def initialize(site, url = nil)
10
+ self.site = site
11
+ self.url = URI.parse(url || site.url)
12
+ end
13
+
14
+ def setting(name)
15
+ Sinatra::Application.send(name).to_s
16
+ end
17
+
18
+ def error?(response, path, whiny = true)
19
+ if !response.is_a?(Net::HTTPSuccess)
20
+ raise message if whiny
21
+ puts "Error at '#{path}': #{response.to_s}"
22
+ return true
23
+ end
24
+ false
25
+ end
26
+
27
+ def path(path)
28
+ self.paths << path
29
+ end
30
+
31
+ def run(&block)
32
+ self.paths = [] if block_given?
33
+ self.instance_eval(&block)
34
+ self.paths.reverse!
35
+ requests
36
+ end
37
+
38
+ def requests
39
+ begin
40
+ request
41
+ rescue Exception => e
42
+ requests # in case connection breaks
43
+ #raise "Make sure you've started the server, run: 'ruby app.rb'"
44
+ end
45
+ end
46
+
47
+ def request
48
+ Net::HTTP.start(url.host, url.port) do |http|
49
+ trap("SIGINT") { http.finish; return }
50
+ while path = self.paths.pop
51
+ process(path, http.get(path))
52
+ end
53
+ end
54
+ end
55
+
56
+ def process(path, response)
57
+ root = ::File.expand_path(Broadway.index)
58
+ date = "2010-01-01"
59
+ if path == "/"
60
+ write_to = ::File.expand_path(root).squeeze("/")
61
+ else
62
+ write_to = ::File.expand_path(::File.join(site.setting(:destination), path).squeeze("/"))
63
+ end
64
+ # if the file doesn't exist or is not rendered correctly
65
+ return if error?(response, path, false)
66
+ #return if sitemap?(response.body, post)
67
+ body = response.body
68
+ content = ""
69
+ if path == "/"
70
+ name = "index.html"
71
+ else
72
+ FileUtils.mkdir_p(write_to)
73
+ name = ::File.join(write_to, "#{date}-index.html")
74
+ content << "---\n"
75
+ content << "categories: [#{path.split("/").delete_if {|node| node.blank?}.join(", ")}]\n"
76
+ content << "---\n"
77
+ end
78
+ content << body
79
+ puts "done... #{path}"
80
+ ::File.open(name, "w") { |f| f.write(content) }
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1 @@
1
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].each { |ext| load ext }
@@ -0,0 +1,85 @@
1
+ namespace :broadway do
2
+ desc "Create a new Post"
3
+ task :post do
4
+ title = ENV["title"]
5
+ to = ENV["to"]
6
+
7
+ raise "What's the title?" if title.blank?
8
+ raise "Where should the post go? (`rake post to='./here'`)" if to.blank?
9
+
10
+ slug = title.downcase.gsub(/[\s_-]+/, "-").gsub(/[^a-z0-9-]/, "")
11
+ date = Time.now.strftime("%Y-%m-%d")
12
+ full_date = Time.now.strftime("%Y-%m-%d @ %I:%M%p").downcase
13
+ name = "#{date}-#{slug}.markdown"
14
+ path = File.join(to, name)
15
+
16
+ raise "#{name} already exists!" if File.exists?(path)
17
+
18
+ content = ""
19
+ content << "---\n"
20
+ content << "title: #{title}\n"
21
+ content << "date: #{full_date}\n"
22
+ content << "---\n\n"
23
+ File.open(path, "w+") { |f| f.puts content }
24
+
25
+ puts "Created Post '#{title}' at #{path}"
26
+ end
27
+
28
+ desc "Generate static files"
29
+ task :generate do
30
+ Broadway.generate
31
+ end
32
+
33
+ desc "Run Broadway build"
34
+ task :build do
35
+ site = Broadway.build
36
+ if ENV['inspect']
37
+ site.pages.each do |page|
38
+ puts page.inspect
39
+ end
40
+ site.posts.each do |post|
41
+ puts post.inspect
42
+ end
43
+ end
44
+ end
45
+ =begin
46
+ desc "download large arrays of files"
47
+ task :theme do
48
+ downloads = {}
49
+ downloads[:domain] = "domain.com"
50
+ downloads[:urls] = %w()
51
+ downloads[:folder] = "themes/my-theme"
52
+ Net::HTTP.start(downloads[:domain]) do |http|
53
+ puts downloads.inspect
54
+ downloads[:urls].each do |url|
55
+ puts url
56
+ url.gsub!("http://#{downloads[:domain]}", "") # get rid of base
57
+ response = http.get(url)
58
+ dir = File.join(downloads[:folder], File.dirname(url))
59
+ name = File.join(dir, File.basename(url)).split(/\&\?/).first
60
+ FileUtils.mkdir_p(dir) unless File.exists?(dir)
61
+ puts name
62
+ begin
63
+ open(name, "wb") do |file|
64
+ file.write(response.body)
65
+ end
66
+ rescue Exception => e
67
+ puts e.inspect
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ desc "Remove static file history from the tree because we don't need it and it takes up space"
74
+ task :remove_history do
75
+ # remove all paths passed as arguments from the history of the repo
76
+ files = "_posts/*"
77
+ `git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch #{files}" HEAD`
78
+
79
+ # remove the temporary history git-filter-branch otherwise leaves behind for a long time
80
+ `rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune`
81
+ # don't know how to prevent it from removing everything except the current commit yet
82
+ FileUtils.mkdir_p("_posts")
83
+ end
84
+ =end
85
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: broadway
3
3
  version: !ruby/object:Gem::Version
4
- hash: 73
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 3
10
- - 5
11
- version: 0.0.3.5
10
+ version: 0.1.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Lance Pollard
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-03-22 20:12:47 -07:00
18
+ date: 2010-08-17 00:00:00 -05:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -49,52 +48,58 @@ dependencies:
49
48
  version: 2.3.5
50
49
  type: :runtime
51
50
  version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: activerecord
54
- prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 9
61
- segments:
62
- - 2
63
- - 3
64
- - 5
65
- version: 2.3.5
66
- type: :runtime
67
- version_requirements: *id003
68
- description: "Broadway: Static and Dynamic Site Generator"
51
+ description: "Broadway: Pluggable, portable, framework-friendly static site generator. Setting the Stage for the Ruby CMS."
69
52
  email: lancejpollard@gmail.com
70
53
  executables: []
71
54
 
72
55
  extensions: []
73
56
 
74
57
  extra_rdoc_files:
75
- - README.textile
58
+ - README.markdown
76
59
  files:
77
- - README.textile
78
- - Rakefile
79
- - lib/broadway/api.rb
80
- - lib/broadway/asset.rb
81
- - lib/broadway/base.rb
82
- - lib/broadway/convertible.rb
83
- - lib/broadway/core_ext.rb
84
- - lib/broadway/page.rb
85
- - lib/broadway/post.rb
86
- - lib/broadway/rails.rb
87
- - lib/broadway/resource.rb
88
- - lib/broadway/runner.rb
89
- - lib/broadway/sinatra/base.rb
60
+ - lib/broadway/ext.rb
61
+ - lib/broadway/filters/erb.rb
62
+ - lib/broadway/filters/haml.rb
63
+ - lib/broadway/filters/liquid.rb
64
+ - lib/broadway/filters/markdown.rb
65
+ - lib/broadway/filters/textile.rb
66
+ - lib/broadway/migrators/blogger.rb
67
+ - lib/broadway/migrators/wordpress.rb
68
+ - lib/broadway/mixins/assetable.rb
69
+ - lib/broadway/mixins/configurable.rb
70
+ - lib/broadway/mixins/convertible.rb
71
+ - lib/broadway/mixins/hierarchical.rb
72
+ - lib/broadway/mixins/layoutable.rb
73
+ - lib/broadway/mixins/pageable.rb
74
+ - lib/broadway/mixins/processable.rb
75
+ - lib/broadway/mixins/publishable.rb
76
+ - lib/broadway/mixins/readable.rb
77
+ - lib/broadway/mixins/resourceful.rb
78
+ - lib/broadway/mixins/sluggable.rb
79
+ - lib/broadway/mixins/sortable.rb
80
+ - lib/broadway/mixins/taggable.rb
81
+ - lib/broadway/mixins/themeable.rb
82
+ - lib/broadway/processors/link.rb
83
+ - lib/broadway/processors/post.rb
84
+ - lib/broadway/processors/site.rb
85
+ - lib/broadway/processors/tree.rb
86
+ - lib/broadway/resources/asset.rb
87
+ - lib/broadway/resources/configuration.rb
88
+ - lib/broadway/resources/file.rb
89
+ - lib/broadway/resources/layout.rb
90
+ - lib/broadway/resources/link.rb
91
+ - lib/broadway/resources/post.rb
92
+ - lib/broadway/resources/site.rb
93
+ - lib/broadway/resources/slug.rb
94
+ - lib/broadway/sinatra/app.rb
90
95
  - lib/broadway/sinatra/helpers/collection_helper.rb
91
96
  - lib/broadway/sinatra/helpers/partial_helper.rb
92
97
  - lib/broadway/sinatra/helpers/text_helper.rb
93
- - lib/broadway/sinatra/helpers.rb
94
- - lib/broadway/sinatra.rb
95
- - lib/broadway/site.rb
96
- - lib/broadway/static_file.rb
98
+ - lib/broadway/sinatra/processor.rb
99
+ - lib/broadway/tasks/default.rake
100
+ - lib/broadway/tasks.rb
97
101
  - lib/broadway.rb
102
+ - README.markdown
98
103
  has_rdoc: true
99
104
  homepage: http://github.com/viatropos/broadway
100
105
  licenses: []
@@ -128,6 +133,6 @@ rubyforge_project: broadway
128
133
  rubygems_version: 1.3.7
129
134
  signing_key:
130
135
  specification_version: 3
131
- summary: Write Posts in Textile and Markdown, built it into a Rails or Sinatra Blog
136
+ summary: Pluggable, portable, framework-friendly Ruby Static Site Generator. Setting the Stage for the Ruby CMS.
132
137
  test_files: []
133
138
 
@@ -1,306 +0,0 @@
1
- h1. Broadway
2
-
3
- TODO: Tests. I've just extracted this out of a project and now I'll write tests.
4
-
5
- "html2haml":http://html2haml.heroku.com/
6
-
7
- "JAVASCRIPT <script src=":http://github.com/HenrikJoreteg/jquery-magic-labels/raw/master/jquery.magiclabels.min.js
8
-
9
- This is the source for my blog. I develop the themes in Sinatra, and convert them into Jekyll for posts. I'm only doing this until _someone_ gives Jekyll some HAML support so I can use it with Github... Or I find that it's really not that good of an investment to use Github Pages.
10
-
11
- h2. The Goal
12
-
13
- The goal of this project is to make it easy to manage 20 public software projects at once. This way, anyone developing their thing on github can easily post new examples and documentation as they develop their project, without anything out of their ordinary workflow.
14
-
15
- h2. Sinatra, HAML, JQuery, Textile
16
-
17
- "About this Blog":http://blog.peepcode.com/tutorials/2010/about-this-blog
18
-
19
- h2. Jekyll and Sinatra
20
-
21
- I use Jekyll for the static page generation (spits out all the pages, essentially pre-compiling everything into raw HTML). I don't use Jekyll because it uses Liquid. Liquid might be nice for someone who doesn't want to learn programming but would like to have fun with a few variables, and reuse some code. But for a programmer who takes pride in efficiency, clean code, and being DRY, HAML and full Ruby access is much better; it gives me freedom to _do_. I can:
22
-
23
- # Format the HTML perfectly (using HAML with Textmate)
24
- # Have Ruby hooks to conditionally link in elements throughout (getting rid of YAML headers)
25
- # Use Ruby to dynamically process other URLs
26
- # Extend the application to do other things like file uploading, all the while
27
- # Keeping everything DRY and clean.
28
-
29
- You can use @_posts@ without any layout! And they can be raw HTML files!
30
-
31
- h3. Notes
32
-
33
- * Any folder starting with an underscore is private in terms of browser access
34
-
35
- h2. Directory Structure
36
-
37
- <pre>
38
- .
39
- |-- _config.yml
40
- |-- _layouts
41
- |-- _posts (generated output)
42
- |-- _site (github's place)
43
- |-- _source (sinatra application for development)
44
- | |-- files (blog files to-be published)
45
- | |-- posts (blog files)
46
- | |-- lib (sinatra helpers)
47
- | `-- public (sinatra public directory)
48
- |-- shared (javascripts, css, media, etc.)
49
- |-- index.html
50
- |-- robots.txt (what google should ignore)
51
- `-- sitemap.xml (google's sitemap from jekyll)
52
- </pre>
53
-
54
- h2. Configuration
55
-
56
- h3. Default Configuration
57
-
58
- <pre>
59
- permalink:
60
- if post's name is "entry": /path/to (index.haml)
61
- if post's name is "something-else": /path/to/something-else
62
- those are "directory" styled permalinks
63
- title: Path - To - Index
64
- keywords: nil
65
- description: nil
66
- </pre>
67
-
68
- h4. Permalink Styles
69
-
70
- directory: /path/to/index or /path/to/title
71
- date: /year/month/day/title
72
- category: /root/child/childer/title
73
-
74
- If directories have underscores, they are subtracted from the path:
75
-
76
- /path/to/_some_way_of_organizing_my_posts/my-post.textile
77
- => /path/to/my-post
78
-
79
- Preference:
80
-
81
- # If directory contains all of [index.haml, entry.textile], it will render index.haml
82
- # If directory contains all of [entry.textile], it will render entry.textile
83
-
84
- h2. The Rendering Process
85
-
86
- # Startup Sinatra
87
- # Generate URLs from Post metadata, or, by default, directory to index.html or index.haml. Also collect all tags and categories in the application
88
- # Now we have all: urls, tags, categories. But we haven't read all of the files into memory which can be a problem
89
- # Go to a URL via Sinatra, render HAML
90
- # Read post for that URL into memory
91
- # Save HAML to HTML file
92
-
93
- h2. Themes
94
-
95
- When you make a request to a url, it renders out the template from the public/themes directory, but your content goes in public/posts. In public/posts, you can add HAML/HTML files to customize the base of the them (via 'yield'), but you don't need to. Instead, you just create your posts and they will be given a url. The default layout for anything in your public/posts directory is the root directory it's in. That's because you're likely to initially structure your posts according to the theme's RESTful page structure. But if you specify a <code>layout</code> in the header of your file, it will use that from the theme.
96
-
97
- ln -s ~/viatropos/shared/themes ~/viatropos/_source/public/shared
98
-
99
- h2. Posts
100
-
101
- There are 3 types of posts:
102
-
103
- # Blog Posts
104
- # Index Posts
105
- # Regular Posts
106
-
107
- Blog posts are dated, so they must be prefixed with a date (2010-03-11-my-blog-post.textile). Index posts describe the default page and metadata, and they must be named "index" (index.textile). Regular posts are posts that don't care about date (such as wiki posts or just simple pages for a portfolio site), and they are named however (my-service-page.textile). Each post has metadata defined in a YAML header. The metadata can be wired explicitly to a themes implementation because, eventually, we'll all come to some sort of consensus on what should and shouldn't be included in the page metadata definition.
108
-
109
- h2. View Variables
110
-
111
- Inside your view you have access to quite a lot of variables:
112
-
113
- # @metadata@: Hash of all the config variables defined for your header metadata.
114
- # @config@: Hash of global config values
115
- # @params@: Hash of values passed in through the URL
116
- # @site@: site object, which has these properties
117
- ## @posts@: array of posts
118
- ## @categories@: array of categories @{:name => post}@
119
- ## @pages@: array of pages (TBD)
120
- # @post@: Post object, if applicable
121
- ## @data@: Hash of metadata specific to this post (symbolized keys)
122
- ## @title@: Post title
123
- ## @url@: Relative URL to Post
124
- ## @date@: Date post was created
125
- ## @published@: Whether or not it's been officially published
126
- ## @tags@
127
- ## @categories@
128
-
129
- ALL HASH KEYS ARE SYMBOLS, NOT STRINGS!
130
-
131
- h2. Layouts
132
-
133
- There are quite a few layouts available in each project:
134
-
135
- # Overview
136
- # Blog
137
- # Post w/ column
138
- # Post w/o column
139
- # Portfolio: two column grid
140
- # Portfolio: three column grid
141
- # Testimonials
142
- # two column list
143
- # Contact
144
-
145
- h2. TODO
146
-
147
- # CycleHelper for easier haml repeaters
148
-
149
- h2. Theme Development
150
-
151
- "html2haml":http://html2haml.heroku.com/
152
-
153
- Create a folder called shared/themes/my-theme-name. In there, create folders for html, touch, and flash. In the html folder, you need the following
154
-
155
- <pre>
156
- .
157
- |-- index.haml # home page (layout.haml is somewhere else entirely)
158
- |-- about
159
- |-- blog
160
- |-- features
161
- |-- demos
162
- |-- download
163
- |-- support
164
- |-- community
165
- |-- shared
166
- | |-- stylesheets
167
- | |-- javascripts
168
- | |-- images
169
- | `-- partials
170
- | |-- _head.haml
171
- | `-- _header.haml
172
- </pre>
173
-
174
- There are two ways the posts/pages can be constructed:
175
-
176
- # They have a date prefixing their name
177
- # They are in an XML file
178
-
179
- Dates specify an order, so do XML files. In the end, we have an xml file for each root directory that lists all of the posts in a tree. Whether they were from being in the "_posts" directory or because they were in an XML file, it doesn't matter.
180
-
181
- If the content of the post doesn't need more than a few lines, you can specify it in XML (each item in XML is converted to a Post). Saves on space.
182
-
183
- The end result is that we have 1 xml file for each category of posts, which can be imported into Flex.
184
-
185
- h2. Posts vs. Pages
186
-
187
- Posts are pages that can be mass produced, such as wiki pages, blog entries, and forum posts. They may have these extra defined properties:
188
-
189
- # date
190
- # categories
191
- # tags
192
-
193
- However, Pages can also have categories and tags and dates, but they are not used the same way as posts.
194
-
195
- A major difference between pages and posts however is that Posts cannot be nested; Pages can be nested.
196
-
197
- h3. So how do we define the difference between Pages and Posts in Broadway?
198
-
199
- # Posts and Pages can be written with a date in their name: 2010-03-30-my-post.textile.
200
- # Directories determine _some_ of the categories of Posts and Pages (you can define additional ones)
201
- # Posts are basically subclasses of Page, which we can define in two ways:
202
- ## Placing Posts into the __posts_ directory
203
- ## Adding a @category@ to a Page called "post"
204
- # Related Posts have the same layout, while related pages may have completely different layouts
205
-
206
- So what we do is say, _all Posts are leaf items_. If a file is called @index.textile@, however, it is considered a Page for the corresponding directory. Thus, the following directory structure:
207
-
208
- |-- overview
209
- | |-- index.textile
210
- | |-- screenshots.textile
211
- | |-- performance.textile
212
-
213
- ...corresponds to this XML structure:
214
-
215
- <pre><code>
216
- <page url="/overview">
217
- <post url="/overview/screenshots"/>
218
- <post url="/overview/performance"/>
219
- </page>
220
- </code></pre>
221
-
222
- ...which corresponds to these ruby objects
223
-
224
- <pre><code>
225
- page = Page.new(:url => "/overview")
226
- page.posts << Post.new(:url => "/overview/screenshots")
227
- page.posts << Post.new(:url => "/overview/performance")
228
- </pre></code>
229
-
230
- Posts can have dates, categories, and tags, while pages can only have categories and tags.
231
-
232
- h2. Post Properties
233
-
234
- # title
235
- # url
236
- # has_one: image
237
- # tooltip
238
- # content
239
- # description
240
- # categories (directory)
241
- # tags
242
- # slug (identifier)
243
- # published
244
- # author
245
- # comments
246
- # attachments
247
-
248
- h2. Attachment Properties
249
-
250
- id - Integer
251
- url - String
252
- slug - String
253
- title - String
254
- description - String
255
- caption - String
256
- parent - Integer
257
- mime_type - String
258
- images - Object
259
-
260
- - Go through public directory
261
- - look for .xml and .textile/.markdown/.html
262
- - Can go arbitrary levels deep
263
- - Pages are for each directory
264
- - if no page, then it will render an error page
265
- - if index.haml, it will render that
266
- - Posts are organized by category, which map directly to their directory
267
- - Posts also have tags
268
- - Themes can sort posts based on categories
269
- - There is a global list of tags and categories
270
- - Posts unique id is the slug
271
- - posts can't be nested
272
- - pages can't be nested, but the urls can be
273
- - there are config files for random variables
274
- - posts are stored into xml files by page (root level)
275
- - posts can have 1 image, plus any random content in the post
276
- - snippets are config items, which can be textile/markdown/html
277
-
278
- If there is an index.xml in a folder, it is appended to the child matching that url node in the root index.xml file
279
- - Content is either in XML, or in the index.textile file of a folder, or the name of the url dot textile.
280
- - overview/index.textile
281
- - overview.textile
282
- - The Post (textile file) or XML node can specify the layout:
283
- - <item layout="guides".../>
284
- - layout: guides
285
- If no layout is specified, it will check for these files:
286
- - path/to/post/index.haml
287
- - theme/path/index.haml
288
- - error
289
-
290
- h2. Defining Posts and Pages
291
-
292
- Posts can be created in two ways: XML or text
293
-
294
- h3. Posts from Text (HTML, Textile, Markdown)
295
-
296
- Post objects are built out of the path to the file
297
-
298
- h3. Posts from XML
299
-
300
- Post objects are built out of everything in the XML. If the XML node is referencing a file outside of itself, then it falls into the first category.
301
-
302
- h3. Graphics
303
-
304
- http://www.iconarchive.com/show/mac-icons-by-artua/Microphone-icon.html
305
- http://www.iconarchive.com/show/vista-multimedia-icons-by-icons-land/Microphone-Disabled-icon.html
306
- http://www.iconarchive.com/show/play-stop-pause-icons-by-icons-land/Microphone-Disabled-icon.html