├── lib
├── brite.yml
├── brite.rb
└── brite
│ ├── version.rb
│ ├── post.rb
│ ├── layout.rb
│ ├── part.rb
│ ├── model.rb
│ ├── command.rb
│ ├── controller.rb
│ ├── site.rb
│ ├── server.rb
│ ├── config.rb
│ └── page.rb
├── test
├── fixture
│ ├── brite.yml
│ ├── example-page.page
│ └── example-post.post
├── helper.rb
├── test_config.rb
├── test_page.rb
└── test_site.rb
├── bin
├── brite
└── brite-server
├── .gitignore
├── work
├── trash
│ ├── webrite-server
│ ├── post.rb
│ ├── part.rb
│ ├── layout.rb
│ ├── context.rb
│ ├── site.rb
│ ├── template.rb
│ └── page.rb
├── deprecated
│ ├── plugins
│ │ └── sow
│ │ │ └── brite
│ │ │ └── awesome
│ │ │ ├── brite.yaml
│ │ │ ├── assets
│ │ │ ├── fade.png
│ │ │ ├── ruby.png
│ │ │ ├── reset.css
│ │ │ ├── highlight.css
│ │ │ ├── custom.less
│ │ │ ├── jquery.tabs.js
│ │ │ ├── highlight.js
│ │ │ └── jquery.js
│ │ │ ├── Sowfile
│ │ │ ├── history.page
│ │ │ ├── logs.page
│ │ │ ├── index.page
│ │ │ ├── legal.page
│ │ │ ├── about.page
│ │ │ └── page.layout
│ └── rackup.rb
└── reference
│ ├── temp.rb
│ ├── page.rb
│ ├── server.rb
│ └── generator.rb
├── .yardopts
├── Rakefile
├── .travis.yml
├── Gemfile
├── Assembly
├── MANIFEST
├── Indexfile
├── LICENSE.md
├── HISTORY.md
├── .index
├── README.md
└── .gemspec
/lib/brite.yml:
--------------------------------------------------------------------------------
1 | ../.index
--------------------------------------------------------------------------------
/test/fixture/brite.yml:
--------------------------------------------------------------------------------
1 | ---
2 | post_slug: "%Y/%M/%D/$name"
3 |
4 |
--------------------------------------------------------------------------------
/bin/brite:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'brite'
3 | Brite.cli(*ARGV)
4 |
--------------------------------------------------------------------------------
/test/helper.rb:
--------------------------------------------------------------------------------
1 | require 'lemon'
2 | require 'ae'
3 |
4 | require 'brite'
5 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .reap/digest
2 | .yardoc
3 | doc
4 | log
5 | pkg
6 | tmp
7 | web
8 | work/sandbox
9 |
--------------------------------------------------------------------------------
/bin/brite-server:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'brite/server'
3 | Brite::Server.start(ARGV)
4 |
5 |
--------------------------------------------------------------------------------
/work/trash/webrite-server:
--------------------------------------------------------------------------------
1 | #! /usr/bin/ruby
2 |
3 | require 'rage/server'
4 |
5 | Rage::Server.start
6 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/brite.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | url : http://___URL___.com
3 | stencil: erb
4 |
--------------------------------------------------------------------------------
/.yardopts:
--------------------------------------------------------------------------------
1 | --title "Brite Site"
2 | --readme README.rdoc
3 | --protected
4 | --private
5 | lib
6 | -
7 | [A-Z]*.*
8 |
--------------------------------------------------------------------------------
/test/fixture/example-page.page:
--------------------------------------------------------------------------------
1 | ---
2 | author: trans
3 |
4 | --- rdoc
5 |
6 | # Hello World
7 |
8 | This is an example post.
9 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | #ignore 'doc', 'log', 'pkg', 'web', 'work'
2 |
3 | desc "Run unit tests."
4 | task :test do
5 | sh 'rubytest -Ilib -Itest test/test_*.rb'
6 | end
7 |
8 |
--------------------------------------------------------------------------------
/test/fixture/example-post.post:
--------------------------------------------------------------------------------
1 | ---
2 | author: trans
3 | date : 2011-11-11
4 |
5 | --- rdoc
6 |
7 | # Hello World
8 |
9 | This is an example post.
10 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/fade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rubyworks/brite/master/work/deprecated/plugins/sow/brite/awesome/assets/fade.png
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/ruby.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rubyworks/brite/master/work/deprecated/plugins/sow/brite/awesome/assets/ruby.png
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ---
2 | language: ruby
3 | script: "bundle exec rubytest -Ilib -Itest test_*.rb"
4 | rvm:
5 | - 1.8.7
6 | - 1.9.3
7 | - 2.0.0
8 | - rbx
9 | - jruby
10 |
11 |
--------------------------------------------------------------------------------
/work/deprecated/rackup.rb:
--------------------------------------------------------------------------------
1 | # The static content rooted in the current working directory
2 | # Eg. Dir.pwd => http://0.0.0.0:3000/
3 | root = Dir.pwd
4 | puts ">>> Serving: #{root}"
5 | run Rack::Directory.new("#{root}")
6 |
7 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | gem "neapolitan", ">= 0.4.0"
4 | gem "facets"
5 |
6 | group :build do
7 | gem "rake"
8 | #gem "detroit"
9 | end
10 |
11 | group :test do
12 | gem "lemon"
13 | gem "rubytest-cli"
14 | gem "ae"
15 | end
16 |
17 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/Sowfile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | #use 'gemdo'
4 |
5 | argument :site
6 |
7 | site = output.glob_relative('{site,website,web,www}').first
8 | site = data.site || site || 'site'
9 |
10 | copy :to=>site, :verbatim=>true
11 |
12 |
--------------------------------------------------------------------------------
/lib/brite.rb:
--------------------------------------------------------------------------------
1 | # Brite namespace.
2 | #
3 | # "entia non sunt multiplicanda praeter necessitatem"
4 | #
5 | # --Ockham's razor
6 | #
7 | module Brite; end
8 |
9 | require 'brite/version'
10 | require 'brite/controller'
11 | require 'brite/command'
12 |
13 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/history.page:
--------------------------------------------------------------------------------
1 | ---
2 | title : History
3 | layout : page
4 | stencil : erb
5 |
6 | --- html
7 |
8 | <% if file = project.exist?('HISTORY*') %>
9 | <% if File.extname(file) == '' %>
10 | <%= render('HISTORY*', :type=>'rdoc') %>
11 | <% else %>
12 | <%= render('HISTORY*') %>
13 | <% end %>
14 | <% end %>
15 |
16 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/logs.page:
--------------------------------------------------------------------------------
1 | ---
2 | title : Logs
3 | layout : page
4 | stencil : erb
5 |
6 | --- html
7 |
8 |
LOG REPORTS
9 | <% logs = output.glob('log/*').each do |path| %>
10 |
13 | <% end %>
14 |
15 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/index.page:
--------------------------------------------------------------------------------
1 | ---
2 | title : Welcome
3 | layout : page
4 | stencil : erb
5 |
6 | --- html
7 |
8 |
12 |
13 |
14 |
15 | <%= yield %>
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Assembly:
--------------------------------------------------------------------------------
1 | ---
2 | email:
3 | mailto:
4 | - ruby-talk@ruby-lang.org
5 | - rubyworks-mailinglist@googlegroups.com
6 |
7 | gem:
8 | active: true
9 |
10 | github:
11 | gh_pages: web
12 |
13 | dnote:
14 | title: Source Notes
15 | output: log/notes.html
16 | labels: ~
17 |
18 | locat:
19 | output: log/locat.html
20 |
21 | vclog:
22 | output:
23 | - log/changes.html
24 | - log/history.html
25 |
26 |
--------------------------------------------------------------------------------
/work/trash/post.rb:
--------------------------------------------------------------------------------
1 | require 'brite/page'
2 |
3 | module Brite
4 |
5 | # The Post class is essentially the same as the Page class.
6 | class Post < Page
7 |
8 | def default_layout
9 | config.post_layout
10 | end
11 |
12 | # TODO
13 | def next
14 | #self
15 | end
16 |
17 | # TODO
18 | def previous
19 | #self
20 | end
21 |
22 | #def to_contextual_attributes
23 | # { 'site' => site.to_h, 'post' => to_h }
24 | #end
25 | end
26 |
27 | end
28 |
29 |
--------------------------------------------------------------------------------
/test/test_config.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | testcase Brite::Config do
4 |
5 | method :location do
6 |
7 | test "config loads given location" do
8 | config = Brite::Config.new('test/fixture')
9 | config.assert.location == 'text/fixture'
10 | end
11 |
12 | end
13 |
14 | method :file do
15 |
16 | test "config find configuraiton file" do
17 | config = Brite::Config.new('test/fixture')
18 | config.file.assert == 'test/fixture/brite.yml'
19 | end
20 |
21 | end
22 |
23 | end
24 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/legal.page:
--------------------------------------------------------------------------------
1 | ---
2 | title : Legal
3 | layout : page
4 | stencil : erb
5 |
6 | --- html
7 |
8 | <% if file = project.exist?('COPYING*') %>
9 | COPYING
10 |
11 | <%= File.read(file) %>
12 |
13 | <% end %>
14 |
15 | <% if file = project.exist?('LICENSE*') %>
16 | LICENCE
17 |
18 | <%= File.read(file) %>
19 |
20 | <% end %>
21 |
22 | <% if file = project.exist?('NOTICE*') %>
23 | NOTICE
24 |
25 | <%= File.read(file) %>
26 |
27 | <% end %>
28 |
29 |
--------------------------------------------------------------------------------
/test/test_page.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | testcase Brite::Page do
4 |
5 | before do
6 | @site ||= Brite::Site.new('test/fixture')
7 | end
8 |
9 | method :permalink do
10 |
11 | test "permalink is calculated correctly" do
12 | page = @site.pages.first
13 | page.permalink.assert == '/example-page.html'
14 | end
15 |
16 | end
17 |
18 | method :layout do
19 |
20 | test "default layout is given" do
21 | page = @site.pages.first
22 | page.layout.assert == 'page'
23 | end
24 |
25 | end
26 |
27 | end
28 |
29 |
--------------------------------------------------------------------------------
/lib/brite/version.rb:
--------------------------------------------------------------------------------
1 | module Brite
2 |
3 | # Access to project metadata as given in `brite.yaml` which
4 | # is soft linked to the `.ruby` project file.
5 | #
6 | # @return [Hash] project metadata
7 | def self.metadata
8 | @metadata ||= (
9 | require 'yaml'
10 | YAML.load(File.dirname(__FILE__) + '/../brite.yml')
11 | )
12 | end
13 |
14 | # If constant is missing, check project metadata.
15 | #
16 | # @raise [NameError] uninitialized constant
17 | def self.const_missing(name)
18 | metadata[name.to_s.downcase] || super(name)
19 | end
20 |
21 | end
22 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/about.page:
--------------------------------------------------------------------------------
1 | ---
2 | title : About
3 | layout : page
4 | stencil : erb
5 |
6 | --- html
7 |
8 | <%= if file = project.exist?('{,meta}{PACKAGE,VERSION}*') %>
9 | VERSION
10 |
11 | <%= File.read(file) %>
12 | <% end %>
13 |
14 |
15 | <%= if file = project.exist?('{,meta}{PROFILE}*') %>
16 | PROFILE
17 |
18 | <%= File.read(file) %>
19 |
20 | <% end %>
21 |
22 | <%= if file = project.exist?('{MANIFEST}*') %>
23 | MANIFEST
24 |
25 | <%= read('MANIFEST*') %>
26 | <%= File.read(file) %>
27 |
28 | <% end %>
29 |
--------------------------------------------------------------------------------
/MANIFEST:
--------------------------------------------------------------------------------
1 | #!mast -x etc .index bin demo lib man spec test *.md *.rdoc *.txt
2 | .index
3 | bin/brite
4 | bin/brite-server
5 | lib/brite/command.rb
6 | lib/brite/config.rb
7 | lib/brite/controller.rb
8 | lib/brite/layout.rb
9 | lib/brite/model.rb
10 | lib/brite/page.rb
11 | lib/brite/part.rb
12 | lib/brite/post.rb
13 | lib/brite/server.rb
14 | lib/brite/site.rb
15 | lib/brite/version.rb
16 | lib/brite.rb
17 | lib/brite.yml
18 | test/fixture/brite.yml
19 | test/fixture/example-page.page
20 | test/fixture/example-post.post
21 | test/helper.rb
22 | test/test_config.rb
23 | test/test_page.rb
24 | test/test_site.rb
25 | LICENSE.md
26 | README.md
27 | HISTORY.md
28 |
--------------------------------------------------------------------------------
/work/trash/part.rb:
--------------------------------------------------------------------------------
1 | module Brite
2 |
3 | # A Part is the section of a page. Pages can be segmented into
4 | # parts using the '--- FORMAT' notation.
5 | class Part
6 |
7 | # Markup format (html, rdoc, markdown, textile)
8 | attr :format
9 |
10 | # Body of text as given in the part.
11 | attr :text
12 |
13 | #
14 | def initialize(text, format=nil)
15 | @format = format
16 | @text = text
17 | end
18 |
19 | #
20 | def render(type, attributes, &output)
21 | template_engine.render(type, format, text, attributes, &output)
22 | end
23 |
24 | #
25 | def template_engine
26 | TemplateEngine
27 | end
28 |
29 | end
30 |
31 | end
32 |
33 |
--------------------------------------------------------------------------------
/work/trash/layout.rb:
--------------------------------------------------------------------------------
1 | module Birte
2 |
3 | # Layout class
4 | class Layout < Page
5 |
6 | # Layouts cannot be saved.
7 | undef_method :save
8 |
9 | #def to_contextual_attributes
10 | # { 'site'=>site.to_h }
11 | #end
12 |
13 | #
14 | def render(scope=nil, &content)
15 | if scope
16 | scope.merge!(attributes)
17 | else
18 | scope = Scope.new(self, fields, attributes)
19 | end
20 |
21 | result = template.render(scope, &content).to_s
22 |
23 | if layout
24 | result = site.lookup_layout(layout).render(scope){ result }
25 | end
26 |
27 | result.to_s
28 | end
29 |
30 | # Layouts have no default layout.
31 | def default_layout
32 | nil
33 | end
34 |
35 | end
36 |
37 | end
38 |
39 |
--------------------------------------------------------------------------------
/Indexfile:
--------------------------------------------------------------------------------
1 | ---
2 | name: brite
3 |
4 | version: 0.7.1
5 |
6 | title: Brite
7 |
8 | slogan: Light Up Your Site
9 |
10 | summary:
11 | Brite is an easy to use static site generator.
12 |
13 | description:
14 | Brite is an easy to use, light-weight website generator. It supports
15 | a variety of backend rendering engines including erb, liquid, rdoc,
16 | markdown, textile and so on.
17 |
18 | resources:
19 | home: http://rubyworks.github.com/brite
20 | code: http://github.com/rubyworks/brite
21 | bugs: http://github.com/rubyworks/brite/issues
22 | mail: http://groups.google.com/groups/rubyworks-mailinglist
23 |
24 | repositories:
25 | upstream: git://github.com/rubyworks/brite.git
26 |
27 | authors:
28 | - Trans
29 |
30 | organization: Rubyworks
31 |
32 | copyrights:
33 | - 2006 Rubyworks (BSD-2)
34 |
35 |
--------------------------------------------------------------------------------
/work/reference/temp.rb:
--------------------------------------------------------------------------------
1 | require 'erb'
2 |
3 | class Context
4 |
5 | def initialize(page)
6 | @page = page
7 | end
8 |
9 | def render(*a)
10 | @page.render(*a)
11 | end
12 |
13 | end
14 |
15 |
16 | class Page
17 |
18 | def initialize
19 | @context = Context.new(self)
20 | @binding = @context.instance_eval{ binding }
21 | end
22 |
23 | def in1
24 | %{
25 | WAY UP HERE
26 | <%= render('in2') %>
27 | WAY DOWN HERE
28 | }
29 | end
30 |
31 | def in2
32 | %{
33 | RIGHT UP HERE
34 | <%= render('in3') %>
35 | RIGHT DOWN HERE
36 | }
37 | end
38 |
39 | def in3
40 | "IN THE MIDDLE"
41 | end
42 |
43 | def render(var)
44 | input = eval(var)
45 | template = ERB.new(input)
46 | template.result(binding)
47 | end
48 |
49 | end
50 |
51 | p = Page.new
52 |
53 | puts p.render('in1')
54 |
55 |
--------------------------------------------------------------------------------
/test/test_site.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | testcase Brite::Site do
4 |
5 | method :config do
6 |
7 | test "site instance has access to config instance" do
8 | site = Brite::Site.new('test/fixture')
9 | site.config.assert.is_a?(Brite::Config)
10 | end
11 |
12 | end
13 |
14 | method :pages do
15 |
16 | test "site should have a list of pages" do
17 | site = Brite::Site.new('test/fixture')
18 | site.pages.assert.is_a?(Array)
19 | site.pages.size.assert == 1
20 | site.posts.first.assert.is_a?(Brite::Page)
21 | end
22 |
23 | end
24 |
25 | method :posts do
26 |
27 | test "site should have a list of posts" do
28 | site = Brite::Site.new('test/fixture')
29 | site.posts.assert.is_a?(Array)
30 | site.posts.size.assert == 1
31 | site.posts.first.assert.is_a?(Brite::Post)
32 | end
33 |
34 | end
35 |
36 | end
37 |
38 |
--------------------------------------------------------------------------------
/lib/brite/post.rb:
--------------------------------------------------------------------------------
1 | require 'brite/page'
2 |
3 | module Brite
4 |
5 | # Models a blog post. A post is essentially the same as a page,
6 | # but carries a relatition with other posts that a page does not.
7 | #
8 | class Post < Page
9 |
10 | #
11 | def initialize_defaults
12 | super
13 |
14 | @route = site.config.post_route
15 | @layout = site.config.post_layout #@site.config.find_layout(@site.config.post_layout)
16 |
17 | @previous_post = nil
18 | @next_post = nil
19 | end
20 |
21 | # This assumes `site.posts` is sorted by date.
22 | #
23 | # @todo Rename to back_post.
24 | def previous_post
25 | @previous_post ||= (
26 | index = site.posts.index(self)
27 | index == 0 ? nil : site.posts[index - 1]
28 | )
29 | end
30 |
31 | # This assumes `site.posts` is sorted by date.
32 | def next_post
33 | @next_post ||= (
34 | index = site.posts.index(self)
35 | site.posts[index + 1]
36 | )
37 | end
38 |
39 | end
40 |
41 | end
42 |
--------------------------------------------------------------------------------
/lib/brite/layout.rb:
--------------------------------------------------------------------------------
1 | require 'brite/model'
2 |
3 | module Brite
4 |
5 | # Layout class
6 | class Layout < Model
7 |
8 | #
9 | def initialize(site, file)
10 | @site = site
11 | @file = file
12 |
13 | @name = file.chomp('.layout')
14 | @path = File.expand_path(file)
15 | end
16 |
17 | #
18 | attr :site
19 |
20 | #
21 | attr :file
22 |
23 | #
24 | attr :name
25 |
26 | #
27 | attr :path
28 |
29 | # TODO: merge layout header ?
30 |
31 | # Render layout.
32 | def render(model, &content)
33 | template = Neapolitan.file(path, :stencil=>site.config.stencil)
34 |
35 | # update the model's metadata
36 | #model.update(template.metadata)
37 |
38 | result = template.render(model, &content).to_s
39 |
40 | layout_name = template.metadata['layout']
41 |
42 | if layout_name
43 | layout = site.lookup_layout(layout_name)
44 |
45 | raise "No such layout -- #{layout}" unless layout
46 |
47 | result = layout.render(model){ result }
48 | end
49 |
50 | result.to_s
51 | end
52 |
53 | end
54 |
55 | end
56 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2 |
3 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
4 |
5 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
6 |
7 | THIS SOFTWARE IS PROVIDED BY RUBYWORKS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUBYWORKS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 |
9 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/reset.css:
--------------------------------------------------------------------------------
1 | /* http://meyerweb.com/eric/tools/css/reset/ */
2 | /* v1.0 | 20080212 */
3 |
4 | html, body, div, span, applet, object, iframe,
5 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
6 | a, abbr, acronym, address, big, cite, code,
7 | del, dfn, em, font, img, ins, kbd, q, s, samp,
8 | small, strike, strong, sub, sup, tt, var,
9 | b, u, i, center,
10 | dl, dt, dd, ol, ul, li,
11 | fieldset, form, label, legend,
12 | table, caption, tbody, tfoot, thead, tr, th, td {
13 | margin: 0;
14 | padding: 0;
15 | border: 0;
16 | outline: 0;
17 | font-size: 100%;
18 | vertical-align: baseline;
19 | background: transparent;
20 | }
21 | body {
22 | line-height: 1;
23 | }
24 | ol, ul {
25 | list-style: none;
26 | }
27 | li p {
28 | margin: 0; padding: 0;
29 | }
30 | blockquote, q {
31 | quotes: none;
32 | }
33 | blockquote:before, blockquote:after,
34 | q:before, q:after {
35 | content: '';
36 | content: none;
37 | }
38 |
39 | /* remember to define focus styles! */
40 | :focus {
41 | outline: 0;
42 | }
43 |
44 | /* remember to highlight inserts somehow! */
45 | ins {
46 | text-decoration: none;
47 | }
48 | del {
49 | text-decoration: line-through;
50 | }
51 |
52 | /* tables still need 'cellspacing="0"' in the markup */
53 | table {
54 | border-collapse: collapse;
55 | border-spacing: 0;
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/HISTORY.md:
--------------------------------------------------------------------------------
1 | # RELEASE HISTORY
2 |
3 |
4 | ## 0.7.0 / 2011-12-15
5 |
6 | New release of Brite cleans up the code a great deal, adds templated route
7 | support via `route` field, and actually adds a few unit tests (wowzeres,
8 | that's a good thing, right?).
9 |
10 | Changes:
11 |
12 | * Add route field for templated routes.
13 | * Fix use of config field defaults.
14 | * Add some initial unit tests.
15 |
16 |
17 | ## 0.6.0 / 2010-11-12
18 |
19 | Version 0.6 is a full rewrite of Brite's underlying site generation system.
20 | Where as before the Site and Page classes handled their own rendering, now
21 | they are simply information containers and the Controller class handles
22 | rendering. This has made for a much cleaner and more maintainable design.
23 | Overall functionality has remained the same.
24 |
25 | Changes:
26 |
27 | * Complete rewrite of the site generation system.
28 | * Sow templates modified to work with latest release.
29 |
30 |
31 | ## 0.5.0 / 2010-10-25
32 |
33 | Brite (formerly Webrite) has been completely rewritten from the ground-up,
34 | applying a number of ideas gathered from other systems and adding further
35 | innovations. This is still an early release, and in need of features
36 | and overt tire-kicking, but hey I'm already using to generate a pretty
37 | damn nice looking site.
38 |
39 | Changes:
40 |
41 | * 1 Monumentously Important Enhancment
42 |
43 | * Happy Rebirthday!
44 |
45 |
--------------------------------------------------------------------------------
/.index:
--------------------------------------------------------------------------------
1 | ---
2 | revision: 2013
3 | type: ruby
4 | sources:
5 | - Indexfile
6 | - Gemfile
7 | authors:
8 | - name: Trans
9 | email: transfire@gmail.com
10 | organizations:
11 | - name: Rubyworks
12 | requirements:
13 | - version: '>= 0.4.0'
14 | name: neapolitan
15 | - version: '>= 0'
16 | name: facets
17 | - groups:
18 | - build
19 | version: '>= 0'
20 | name: rake
21 | - groups:
22 | - test
23 | version: '>= 0'
24 | name: lemon
25 | - groups:
26 | - test
27 | version: '>= 0'
28 | name: rubytest-cli
29 | - groups:
30 | - test
31 | version: '>= 0'
32 | name: ae
33 | conflicts: []
34 | alternatives: []
35 | resources:
36 | - type: home
37 | uri: http://rubyworks.github.com/brite
38 | label: Homepage
39 | - type: code
40 | uri: http://github.com/rubyworks/brite
41 | label: Source Code
42 | - type: bugs
43 | uri: http://github.com/rubyworks/brite/issues
44 | label: Issue Tracker
45 | - type: mail
46 | uri: http://groups.google.com/groups/rubyworks-mailinglist
47 | label: Mailing List
48 | repositories:
49 | - name: upstream
50 | scm: git
51 | uri: git://github.com/rubyworks/brite.git
52 | categories: []
53 | copyrights:
54 | - holder: Rubyworks
55 | year: '2006'
56 | license: BSD-2
57 | customs: []
58 | paths:
59 | lib:
60 | - lib
61 | name: brite
62 | title: Brite
63 | version: 0.7.1
64 | slogan: Light Up Your Site
65 | summary: Brite is an easy to use static site generator.
66 | description: Brite is an easy to use, light-weight website generator. It supports
67 | a variety of backend rendering engines including erb, liquid, rdoc, markdown, textile
68 | and so on.
69 | date: '2014-04-08'
70 |
--------------------------------------------------------------------------------
/lib/brite/part.rb:
--------------------------------------------------------------------------------
1 | module Brite
2 |
3 | # In you templates:
4 | #
5 | # <%= part.some_part_name %>
6 | #
7 | class Part < Model
8 |
9 | # New Page.
10 | def initialize(site, file, copy={})
11 | @site = site
12 | @file = file
13 |
14 | initialize_defaults
15 |
16 | update(copy)
17 |
18 | @_template = Neapolitan.file(file, :stencil=>site.config.stencil) #site.page_defaults)
19 |
20 | update(@_template.metadata)
21 | end
22 |
23 | #
24 | def initialize_defaults
25 | @layout = nil
26 |
27 | @part = nil
28 | @name = nil
29 | @basename = nil
30 | end
31 |
32 | #
33 | def name
34 | @name ||= file.chomp('.part')
35 | end
36 |
37 | #
38 | def basename
39 | @basename ||= File.basename(name)
40 | end
41 |
42 | # Render page or post template.
43 | #
44 | def render
45 | render = @_template.render(self) #, &body)
46 |
47 | result = render.to_s
48 |
49 | if layout
50 | if layout_object = site.lookup_layout(layout)
51 | result = layout_object.render(self){ result }
52 | #else
53 | # raise "No such layout -- #{layout}"
54 | end
55 | end
56 |
57 | result.to_s.strip
58 | end
59 |
60 | #
61 | class Manager
62 |
63 | def initialize(model)
64 | @model = model
65 | @site = model.site
66 |
67 | @parts = {}
68 | model.site.parts.each do |part|
69 | @parts[part.basename] = part
70 | end
71 | end
72 |
73 | #
74 | def to_h
75 | @parts
76 | end
77 |
78 | #
79 | def method_missing(name, *args, &block)
80 | @parts[name.to_s].render
81 | end
82 |
83 | end
84 |
85 | end
86 |
87 | end
88 |
89 |
--------------------------------------------------------------------------------
/work/trash/context.rb:
--------------------------------------------------------------------------------
1 | # TODO: Make this a configuration option
2 | #require 'gemdo'
3 | require 'erb'
4 |
5 | module Brite
6 |
7 | # The Scope class provides a clean context for rendering pages and posts.
8 | # An instance of Scope is passed to Malt (eg. ERB).
9 | class Scope
10 | include ERB::Util
11 |
12 | #instance_methods(true).each{ |m| private m unless m =~ /^(__|inspect$)/ }
13 |
14 | def initialize(delegate, fields, attributes={})
15 | @delegate = delegate
16 | @fields = fields
17 | @attributes = attributes
18 |
19 | fields.each do |f|
20 | (class << self; self; end).class_eval do
21 | define_method(f){ delegate.__send__(f) }
22 | end
23 | end
24 |
25 | attributes.each do |k,v|
26 | (class << self; self; end).class_eval do
27 | define_method(k){ v }
28 | end
29 | end
30 | end
31 |
32 | # Using ERB, the #render method can be used to render external files
33 | # and embed them in the current document. This is useful, for example,
34 | # when rendering a project's README file as part of a project website.
35 | #
36 | # The +file+ is rendered via Malt.
37 | def render(file, options={})
38 | options[:file] = file
39 | Malt.render(options)
40 | end
41 |
42 | #
43 | def to_binding(&yld)
44 | binding
45 | end
46 |
47 | #
48 | def to_h
49 | hash = {}
50 | @fields.each do |field|
51 | hash[field] = @delegate.__send__(field)
52 | end
53 | hash.merge(@attributes)
54 | end
55 |
56 | #
57 | def to_liquid
58 | to_h
59 | end
60 |
61 | #
62 | def merge!(hash)
63 | @attributes.merge!(hash)
64 | hash.each do |k,v|
65 | (class << self; self; end).class_eval do
66 | define_method(k){ v }
67 | end
68 | end
69 | end
70 |
71 | #
72 | #def method_missing(s, *a)
73 | # s = s.to_s
74 | # @attributes.key?(s) ? @attributes[s] : super(s,*a)
75 | #end
76 | end
77 |
78 | end
79 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/highlight.css:
--------------------------------------------------------------------------------
1 | /* github.com style (c) Vasily Polovnyov */
2 |
3 | /* NOTE: This has been included in the rdoc.css stylesheet
4 | rather then have it's own file simply b/c I have not
5 | figured out how to utilize my own generator to be able
6 | to copy additional files.
7 | */
8 |
9 | pre code {
10 | display: block;
11 | color: #000;
12 | background: #f8f8ff;
13 | background: #eee;
14 | -moz-border-radius: 10px;
15 | border-radius: 10px;
16 | }
17 |
18 | code .comment, .template_comment, .diff .header, .javadoc {
19 | color: #998;
20 | font-style: italic
21 | }
22 |
23 | code .keyword, .css .rule .keyword, .winutils, .javascript .title, .lisp .title, .subst {
24 | color: #000;
25 | font-weight: bold
26 | }
27 |
28 | code .number, .hexcolor {
29 | color: #40a070
30 | }
31 |
32 | code .string, .attribute .value, .phpdoc {
33 | color: #d14
34 | }
35 |
36 | code .title, .id {
37 | color: #900;
38 | font-weight: bold
39 | }
40 |
41 | code .javascript .title, .lisp .title, .subst {
42 | font-weight: normal
43 | }
44 |
45 | code .class .title {
46 | color: #458;
47 | font-weight: bold
48 | }
49 |
50 | code .tag, .css .keyword, .html .keyword, .tag .title, .django .tag .keyword {
51 | color: #000080;
52 | font-weight: normal
53 | }
54 |
55 | code .attribute, .variable, .instancevar, .lisp .body {
56 | color: #008080
57 | }
58 |
59 | code .regexp {
60 | color: #009926
61 | }
62 |
63 | code .class {
64 | color: #458;
65 | font-weight: bold
66 | }
67 |
68 | code .symbol, .lisp .keyword {
69 | color: #990073
70 | }
71 |
72 | code .builtin, .built_in, .lisp .title {
73 | color: #0086b3
74 | }
75 |
76 | code .preprocessor, .pi, .doctype, .shebang, .cdata {
77 | color: #999;
78 | font-weight: bold
79 | }
80 |
81 | code .deletion {
82 | background: #fdd
83 | }
84 |
85 | code .addition {
86 | background: #dfd
87 | }
88 |
89 | code .diff .change {
90 | background: #0086b3
91 | }
92 |
93 | code .chunk {
94 | color: #aaa
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Brite
2 |
3 | [Homepage](http://rubyworks.github.com/brite) |
4 | [Documentation](http://rubydoc.info/gems/brite/frames) |
5 | [Report Issue](http://github.com/rubyworks/brite/issues) |
6 | [Development](http://github.com/rubyworks/brite) |
7 | [Mailing List](http://groups.google.com/group/rubyworks-mailinglist)
8 |
9 | [](http://travis-ci.org/rubyworks/brite)
10 |
11 |
12 | ## DESCRIPTION
13 |
14 | Brite is an innovative static website/blog generation utility
15 | which is as easy to use as it is versatile.
16 |
17 |
18 | ## FEATURES
19 |
20 | * Site layout is 100% user-defined.
21 | * Can generate files in place, so no "special directories" are required.
22 | * Or templated routes can customize the site organization.
23 | * Supports multi-format templates via Neapolitan template engine.
24 | * Which supports many markup and templating formats via Malt or Tilt.
25 |
26 |
27 | ## SYNOPSIS
28 |
29 | Very briefly, one creates `.page`, `.post`, `.part` and `.layout` files and
30 | then runs:
31 |
32 | $ brite
33 |
34 | Voila, website made!
35 |
36 | Of course, the question really is: how does one go about creating `.page`,
37 | `.post`, `.part`, and `.layout` files and such. For information about that see the
38 | [Brite website](https://rubyworks.github.com/brite) and see the
39 | [Getting Started Tutorial](https://github.com/rubyworks/brite/wiki/Getting-Started).
40 |
41 | For a quick start, have a look at the [brite-site repository](https://github.com/rubyworks/brite-site),
42 | which contains a generic Brite project anyone can use to start their own Brite Site.
43 |
44 | To get further under the hood, see Brite source code in the
45 | [GitHub hosted repository](http://github.com/rubyworks/brite)
46 | and read the [API documentation](http://rubydoc.info/gems/brite/frames).
47 |
48 |
49 | ## HOW TO INSTALL
50 |
51 | ### RubyGems
52 |
53 | $ gem install brite
54 |
55 | ### Setup.rb
56 |
57 | If you are old fashioned and want to install to a site location,
58 | see [Setup.rb](http://rubyworks.github.com/setup).
59 |
60 |
61 | ## COPYRIGHTS
62 |
63 | Copyright (c) 2009 Rubyworks
64 |
65 | Brite is distributable in accordance with the *BSD-2-Clause* license.
66 |
67 | See LICENSE.md file for details.
68 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/page.layout:
--------------------------------------------------------------------------------
1 | ---
2 | stencil : erb
3 |
4 | --- html
5 | <% resources = project.metadata.resources %>
6 |
7 |
8 |
9 | <%= project.metadata.title %>
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
33 |
55 |
56 |
57 |
58 | <%= yield %>
59 |
60 |
61 |
62 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/lib/brite/model.rb:
--------------------------------------------------------------------------------
1 | module Brite
2 |
3 | # Base class for all site classes.
4 | #
5 | class Model
6 |
7 | #
8 | def initialize(site, file, data={})
9 | @site = site
10 | @files = file
11 |
12 | update(date)
13 | end
14 |
15 | attr_reader :site
16 |
17 | attr_reader :file
18 |
19 | #
20 | def config
21 | site.config
22 | end
23 |
24 | #
25 | # Render partial template.
26 | #
27 | def part(path)
28 | @part ||= (
29 | partial = site.lookup_partial(path.to_s)
30 | #if path
31 | # partial = site.parts.find{ |part|
32 | # part.name == path
33 | # }
34 | raise "no such part -- #{path} from #{file}" unless partial
35 | partial.render
36 | #else
37 | # Part::Manager.new(self)
38 | #end
39 | )
40 | end
41 |
42 | #
43 | def update(data)
44 | data.each do |k,v|
45 | self[k] = v
46 | end
47 | end
48 |
49 | # Add entry to settings data.
50 | def [](k)
51 | instance_variable_get("@#{k}")
52 | end
53 |
54 | # Add entry to settings data.
55 | def []=(k,v)
56 | if respond_to?("#{k}=")
57 | __send__("#{k}=", v)
58 | else
59 | instance_variable_set("@#{k}", v)
60 | end
61 | end
62 |
63 | #def to_ary
64 | # p caller
65 | # raise
66 | #end
67 |
68 | #
69 | def method_missing(name, *a, &b)
70 | instance_variable_get("@#{name}")
71 | end
72 |
73 | # Returns a Binding for this instance.
74 | def to_binding(&block)
75 | binding
76 | end
77 |
78 | # Returns a Hash of rendering fields.
79 | def to_h
80 | hash = {}
81 | fields = rendering_fields
82 | fields.each do |field|
83 | hash[field.to_s] = __send__(field)
84 | end
85 | hash
86 | end
87 |
88 | # Returns an Array of attribute/method names to be visible to the page
89 | # rendering.
90 | def rendering_fields
91 | list = []
92 | instance_variables.each do |iv|
93 | name = iv.to_s.sub('@','')
94 | next if name.start_with?('_')
95 | list << name
96 | end
97 | list
98 | end
99 |
100 | #
101 | #def singleton_class
102 | # (class << self; self; end)
103 | #end
104 |
105 | end
106 |
107 | end
108 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/custom.less:
--------------------------------------------------------------------------------
1 | @color_background: #ffffff;
2 | @color_foreground: #222222;
3 | @color_hyperlink: #220022;
4 | @colot_highlight: #111111;
5 |
6 | /* ------------ TAG STYLES -------------- */
7 |
8 | html { font-family: sans-setif; font-size: 100%; }
9 | body { position: relative; color: #222233; background: #ffffff; }
10 |
11 | p { text-align: justify; font-size: 100%; line-height: 150%; margin: 0 0 1.2em 0; }
12 | a { text-decoration: none; color: @color_hyperlink; }
13 | a:hover { text-decoration: underline; }
14 |
15 | td { vertical-align: top; text-align: left; }
16 | ul { padding: 0 0 10px 0; }
17 | li { padding: 0 0 3px 0; font-size: 0.9em; line-height: 130%; }
18 |
19 | img { border: none; }
20 | pre { margin: 10px 0; font-family: monospace; color: white; }
21 | pre code { padding: 10px 10px; }
22 |
23 | h1, h2, h3, h4, h5, h6 { margin: 1.75em 0 0.7em 0; }
24 | h1 { font-size: 200%; }
25 | h2 { font-size: 150%; }
26 | h3 { font-size: 120%; }
27 | h4 { font-size: 100%; }
28 |
29 |
30 | /* ------------ CLASS STYLES ------------ */
31 |
32 | .centered {
33 | width: 760px;
34 | margin: 0 auto;
35 | }
36 |
37 | .colorized {
38 | background: @color_backgound;
39 | color: @color_foreground;
40 | }
41 |
42 | .highlighted {
43 | background: @color_backgound;
44 | color: @color_highlight;
45 | }
46 |
47 | /* ------------ ID STYLES ------------ */
48 |
49 | /* #header */
50 |
51 | #header { border-bottom: 1px solid #ccc; padding: 0; }
52 | #header .title { padding: 10px 0; font-size: 20px; height: 120px; vertical-align: absmiddle; text-align: center; }
53 | #header .title h1 { font-size: 81px; font-weight: bold; margin-top: 30px; }
54 | #header .title h1 { color: @color_highlight; }
55 | #header .title pre { background: transparent; }
56 | #header .menu { text-align: center; padding: 5px 0 15px 0; }
57 |
58 | /* #nav */
59 |
60 | #nav { padding: 0 10px 0 50px; text-align: left; }
61 | #nav ul { list-style-type: none; margin: 0px; padding: 0px; width: 100%; position: relative; }
62 | #nav ul li { margin: 0 1px 10px 0; line-height: 20px; white-space:nowrap; }
63 | #nav ul li a { border-top: 0 solid; }
64 | #nav { text-align: right; }
65 | #nav ul li a { font-weight: bold; text-decoration: none; font-size: 1.5em; line-height: 1.4em; }
66 | #nav ul li a:hover { text-decoration: underline; }
67 | #nav ul li a:active { text-decoration: underline; }
68 | #nav ul { background: transparent; }
69 |
70 | /* #main */
71 |
72 | .main { padding: 20px 0 30px 0; }
73 | .main { }
74 | .main a { font-size: 100%; }
75 | .main a:hover { text-decoration: underline; }
76 | .main h1:first-child { margin-top: 20px; }
77 | .main h2 { font-size: 2em; font-weight: bold; }
78 | .main h3 { font-style: italic; }
79 |
80 | /* #doc */
81 |
82 | #doc { font-weight: bold; line-height: 150%; padding-right: 20px; }
83 | #doc a:hover { }
84 | #doc p { font-weight: bold; font-size: 150%; }
85 | #doc h2 { color: @color_highlight; border-color: @color_highlight; }
86 | #doc h3 { border-color: @color_highlight; }
87 |
88 | #readme { margin-top: 10px; margin-bottom: 20px; padding-top: 20px; }
89 | #readme ol, ul { list-style: square; margin-left: 24px; }
90 |
91 | /* #footer */
92 |
93 | #footer { margin-top: 0; padding-top: 30px; border-top: 1px solid #ccc; }
94 | #footer .advert { border: 1px solid :eee; }
95 | #footer .copyright { margin-top: 20px; padding: 20px 0px 35px 0px; font-size: 0.8em; color: #aaa; }
96 |
97 |
--------------------------------------------------------------------------------
/lib/brite/command.rb:
--------------------------------------------------------------------------------
1 | require 'optparse'
2 | require 'brite/controller'
3 |
4 | module Brite
5 |
6 | # Initialize and run Command.
7 | def self.cli(*argv)
8 | Command.call(*argv)
9 | end
10 |
11 | # Brite command module.
12 | module Command
13 | extend self
14 |
15 | # Execute command.
16 | #
17 | # @public
18 | def call(*argv)
19 | options = parse(argv)
20 |
21 | begin
22 | controller(options).build
23 | rescue => e
24 | $DEBUG ? raise(e) : puts(e.message)
25 | end
26 | end
27 |
28 | # Create an instance of Brite::Controller given controller options.
29 | #
30 | # @private
31 | #
32 | # @return [Controller] New controller instance.
33 | def controller(options)
34 | Controller.new(options)
35 | end
36 |
37 | # Parse controller options from command line arguments.
38 | #
39 | # @private
40 | #
41 | # @return [Hash] controller options
42 | def parse(argv)
43 | parser = OptionParser.new
44 |
45 | options = {
46 | :output => nil,
47 | :url => nil
48 | }
49 |
50 | options_url parser, options
51 | options_general parser, options
52 | options_help parser, options
53 |
54 | parser.parse!(argv)
55 |
56 | options[:location] = argv.shift || '.'
57 |
58 | options
59 | end
60 |
61 | # Add `--url` option to command line parser.
62 | #
63 | # @param [OptionParser] parser
64 | # An instance of option parser.
65 | #
66 | # @param [Hash] options
67 | # An options hash to be passed to Controller.
68 | #
69 | # @private
70 | def options_url(parser, options)
71 | parser.on("--url URL", "website fully qualified URL") do |url|
72 | options[:url] = url
73 | end
74 | end
75 |
76 | # Add `--trace`, `--dryrun`, `--force`, `--debug` and `--warn` options
77 | # to command line interface. These are all "global" options which means
78 | # they set global variables if used.
79 | #
80 | # @param [OptionParser] parser
81 | # An instance of option parser.
82 | #
83 | # @param [Hash] options
84 | # An options hash to be passed to Controller.
85 | #
86 | # @private
87 | def options_general(parser, options)
88 | parser.on("--trace", "show extra operational information") do
89 | $TRACE = true
90 | end
91 |
92 | parser.on("--dryrun", "-n", "don't actually write to disk") do
93 | $DRYRUN = true
94 | end
95 |
96 | parser.on("--force", "force overwrites") do
97 | $FORCE = true
98 | end
99 |
100 | parser.on("--debug", "run in debug mode") do
101 | $DEBUG = true
102 | end
103 |
104 | parser.on("--warn", "show Ruby warnings") do
105 | $VERBOSE = true
106 | end
107 | end
108 |
109 | # Add `--help` option to command line parser.
110 | #
111 | # @param [OptionParser] parser
112 | # An instance of option parser.
113 | #
114 | # @param [Hash] options
115 | # An options hash to be passed to Controller.
116 | #
117 | # @private
118 | def options_help(parser, options)
119 | parser.on_tail("--help", "display this help message") do
120 | puts parser
121 | exit
122 | end
123 | end
124 |
125 | end
126 |
127 | end
128 |
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/jquery.tabs.js:
--------------------------------------------------------------------------------
1 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(5($){$.1G.g=5(9,2){4(P 9==\'2a\')2=9;2=$.1d({9:(9&&P 9==\'2r\'&&9>0)?--9:0,1c:j,19:j,1g:j,1e:j,Q:\'2d\',1z:j,1D:j,1K:1J,n:j,u:\'g-2e\',10:\'g-R\',N:\'1k\'},2||{});$.c.1l=$.c.C&&P 2f==\'5\';3 1h=5(){1A(0,0)};A 6.D(5(){3 l=6;4(r.7){$(\'>Z:q(0)>T>a\',6).D(5(i){4(6.7==r.7){2.9=i;4($.c.C){3 8=$(r.7);3 I=r.7.J(\'#\',\'\');8.t(\'\');O(5(){8.t(I)},2g)}1h();4($.c.2h)O(1h,2i);A 1J}})}3 g=$(\'>Z:q(0)>T>a\',6);$(\'>\'+2.N,6).2k(\':q(\'+2.9+\')\').U(2.10);$(\'>Z:q(0)>T:q(\'+2.9+\')\',6).U(2.u);4(2.1K){3 S=$(\'>\'+2.N,l);3 14=5(1L){3 18=$.2l(S.F(),5(v){3 h,1j=$(v);4(1L){4($.c.1l){v.y.2n(\'1M\');v.y.d=\'\';v.11=j}h=1j.B({\'1m-d\':\'\'}).d()}f{h=1j.d()}A h}).2o(5(a,b){A b-a});4($.c.1l){S.D(5(){6.11=18[0]+\'1B\';6.y.2p(\'1M\',\'6.y.d = 6.11 ? 6.11 : "1P"\')})}f{S.B({\'1m-d\':18[0]+\'1B\'})}};14();3 H=l.1r;3 1i=l.G;3 12=$(\'#g-1o-1O-16\').F(0)||$(\'<1u t="g-1o-1O-16">M1u>\').B({1N:\'1Q\',1Z:\'1R\',1T:\'1s\'}).1U(m.17).F(0);3 V=12.G;1W(5(){3 L=l.1r;3 15=l.G;3 Y=12.G;4(15>1i||L!=H||Y!=V){14((L>H||Y0){4($.c.C){3 I=6.7.J(\'#\',\'\');8.t(\'\');O(5(){8.t(I)},0)}3 1H=6;3 z=$(\'>\'+2.N+\':23\',l);3 n;4(P 2.n==\'5\')n=5(){2.n.24(8[0],[8[0],z[0]])};3 p={},o={};3 w,s;4(2.19||2.1c){4(2.19){p[\'d\']=\'1b\';o[\'d\']=\'R\'}4(2.1c){p[\'E\']=\'1b\';o[\'E\']=\'R\'}w=s=2.Q}f{4(2.1g){p=$.1d(p,2.1g);w=2.1z||2.Q}f{p[\'E\']=\'1b\';w=1f}4(2.1e){o=$.1d(o,2.1e);s=2.1D||2.Q}f{o[\'E\']=\'R\';s=1f}}z.1w(o,s,5(){$(1H.1I).U(2.u).2b().1n(2.u);8.1n(2.10).1w(p,w,5(){4($.c.C){z[0].y.2m=\'\';z.U(2.10).B({1N:\'\',1p:\'\',d:\'\'})}8.B({d:\'\',1p:\'\'});4(n)n()})})}f{1S(\'1V 13 1X 1Y l.\')}}3 1C=1a.20||m.K&&m.K.1t||m.17.1t||0;3 1E=1a.22||m.K&&m.K.1x||m.17.1x||0;O(5(){1a.1A(1C,1E)},0);6.27()})})};$.1G.29=5(X){A 6.D(5(){3 i=X&&X>0&&X-1||0;3 x=$(\'>Z:q(0)>T>a\',6).q(i);3 7=x[0].7;4($(7).13(\':1s\')){4($.c.C){x.W();4($.k){$.k.1F(7)}r.7=7.J(\'#\',\'\')}f 4($.c.25){3 1v=$(\'<1q 26="\'+7+\'"><1k><28 2c="1y" 2j="h" />1k>1q>\').F(0);1v.1y();x.W();4($.k){$.k.1F(7)}}f{r.7=7.J(\'#\',\'\');4(!$.k){x.W()}}}})}})(2q);',62,152,'||settings|var|if|function|this|hash|toShow|initial|||browser|height||else|tabs|||null|history|container|document|callback|hideAnim|showAnim|eq|location|hideSpeed|id|selectedClass|el|showSpeed|tabToTrigger|style|toHide|return|css|msie|each|opacity|get|offsetHeight|cachedWidth|toShowId|replace|documentElement|currentWidth||tabStruct|setTimeout|typeof|fxSpeed|hide|tabsContents|li|addClass|cachedFontSize|click|tabIndex|currentFontSize|ul|hideClass|minHeight|watchFontSize|is|_setAutoHeight|currentHeight|size|body|heights|fxSlide|window|show|fxFade|extend|fxHide|50|fxShow|_unFocus|cachedHeight|jq|div|msie6|min|removeClass|watch|overflow|form|offsetWidth|hidden|scrollLeft|span|tempForm|animate|scrollTop|submit|fxShowSpeed|scrollTo|px|scrollX|fxHideSpeed|scrollY|setHash|fn|clicked|parentNode|false|fxAutoHeight|reset|behaviour|display|font|1px|block|absolute|alert|visibility|appendTo|There|setInterval|no|such|position|pageXOffset|observe|pageYOffset|visible|apply|safari|action|blur|input|triggerTab|object|siblings|type|normal|selected|XMLHttpRequest|500|opera|100|value|not|map|filter|removeExpression|sort|setExpression|jQuery|number'.split('|'),0,{}))
2 |
--------------------------------------------------------------------------------
/lib/brite/controller.rb:
--------------------------------------------------------------------------------
1 | require 'neapolitan'
2 | require 'brite/config'
3 | require 'brite/layout'
4 | require 'brite/site'
5 | require 'brite/page'
6 | require 'brite/post'
7 | require 'brite/part'
8 |
9 | module Brite
10 |
11 | # The Controller class is the primary Brite class, handling
12 | # the generation of site files.
13 | #
14 | class Controller
15 |
16 | # New Controller.
17 | #
18 | # @param [Hash] options
19 | # Controller options.
20 | #
21 | # @option options [String] :location
22 | # Location of brite project.
23 | #
24 | # @option options [String] :output
25 | # Redirect all output to this directory.
26 | #
27 | def initialize(options={})
28 | @location = options[:location] || Dir.pwd
29 | @output = options[:output]
30 | #@dryrun = options[:dryrun]
31 | #@trace = options[:trace]
32 |
33 | @site = Site.new(location, :url=>options[:url])
34 | end
35 |
36 | # Returns an instance of Site.
37 | attr :site
38 |
39 | # Directory of site files on disk.
40 | attr :location
41 |
42 | # Where to save results. Usually the templates are shadowed, which means
43 | # the ouput is the same a location.
44 | attr :output
45 |
46 | ## Returns an Array of Layouts.
47 | #def layouts
48 | # @site.layouts
49 | #end
50 |
51 | # Access to configuration file data.
52 | def config
53 | site.config
54 | end
55 |
56 | # URL of site as set in initializer or configuration file.
57 | def url
58 | site.url
59 | end
60 |
61 | # Is `dryrun` mode on? Checks the global variable `$DRYRUN`.
62 | def dryrun?
63 | $DRYRUN #@dryrun
64 | end
65 |
66 | # Is `trace` mode on? Checks global variable `$TRACE`.
67 | def trace?
68 | $TRACE #@trace
69 | end
70 |
71 | # Build the site.
72 | def build
73 | if trace?
74 | puts "Layouts: " + site.layouts.map{ |layout| layout.name }.join(", ")
75 | puts "Parts: " + site.parts.map{ |part| part.name }.join(", ")
76 | puts "Pages: " + site.pages.map{ |page| page.file }.join(", ")
77 | puts "Posts: " + site.posts.map{ |post| post.file }.join(", ")
78 | puts
79 | end
80 |
81 | Dir.chdir(location) do
82 | site.posts.each do |post|
83 | puts "Rendering #{post.file}" if $DEBUG
84 | save(post)
85 | end
86 | site.pages.each do |page|
87 | puts "Rendering #{page.file}" if $DEBUG
88 | save(page)
89 | end
90 | end
91 | puts "\n#{site.pages.size + site.posts.size} Files: #{site.pages.size} Pages, #{site.posts.size} Posts"
92 | end
93 |
94 | # Save page/post redering to disk.
95 | #
96 | # @param [Model] model
97 | # The {Page} or {Post} to save to disk.
98 | #
99 | def save(model)
100 | file = output ? File.join(output, model.output) : model.output
101 | text = model.to_s
102 |
103 | if File.exist?(file)
104 | current = File.read(file)
105 | else
106 | current = nil
107 | end
108 |
109 | if current != text or $FORCE
110 | if dryrun?
111 | puts " dry run: #{file}"
112 | else
113 | puts " write: #{file}"
114 | File.open(file, 'w'){ |f| f << text }
115 | end
116 | else
117 | puts " unchanged: #{file}"
118 | end
119 | end
120 |
121 | end
122 |
123 | end
124 |
--------------------------------------------------------------------------------
/lib/brite/site.rb:
--------------------------------------------------------------------------------
1 | require 'brite/model'
2 | #require 'brite/page'
3 | #require 'brite/post'
4 | #require 'brite/part'
5 |
6 | module Brite
7 |
8 | # TODO: Limit Neapolitan to Markup formats only ?
9 |
10 | #
11 | class Site #< Model
12 |
13 | # New Site model.
14 | #
15 | # @param [String] location
16 | # The directory of the site's files.
17 | #
18 | def initialize(location, options={})
19 | @location = location
20 | @config = Config.new(location)
21 |
22 | options.each do |k,v|
23 | __send__("#{k}=", v)
24 | end
25 |
26 | @pages = []
27 | @posts = []
28 | @parts = []
29 | @layouts = []
30 |
31 | @tags = nil
32 | @posts_by_tag = nil
33 |
34 | load_site
35 | end
36 |
37 | #
38 | attr :location
39 |
40 | # Access to site configuration.
41 | attr :config
42 |
43 | # Returns and Array of Page instances.
44 | attr :pages
45 |
46 | # Returns and Array of Post instances.
47 | attr :posts
48 |
49 | #
50 | attr :parts
51 |
52 | #
53 | attr :layouts
54 |
55 | # Returns a String of the site's URL.
56 | def url
57 | @url ||= config.url
58 | end
59 |
60 | # Change site URL.
61 | attr_writer :url
62 |
63 | # Returns an Array of all tags used in all posts.
64 | def tags
65 | @tags ||= (
66 | list = []
67 | posts.each{ |post| list.concat(post.tags) }
68 | list.uniq.sort
69 | )
70 | end
71 |
72 | # Returns a Hash posts indexed by tag.
73 | def posts_by_tag
74 | @posts_by_tag ||= (
75 | chart ||= Hash.new{|h,k|h[k]=[]}
76 | posts.each do |post|
77 | post.tags.each do |tag|
78 | chart[tag] << post
79 | end
80 | end
81 | chart
82 | )
83 | end
84 |
85 | #
86 | def inspect
87 | "#"
88 | end
89 |
90 | #private
91 |
92 | def load_site
93 | Dir.chdir(location) do
94 | files = Dir['**/*']
95 | files.each do |file|
96 | name = File.basename(file)
97 | ext = File.extname(file)
98 | case ext
99 | when '.layout'
100 | layouts << Layout.new(self, file)
101 | when '.part'
102 | parts << Part.new(self, file)
103 | when '.page' #*%w{.markdown .rdoc .textile .whtml}
104 | page = Page.new(self, file)
105 | pages << page unless page.draft
106 | when '.post'
107 | post = Post.new(self, file)
108 | posts << post unless post.draft
109 | end
110 | end
111 | end
112 |
113 | @posts.sort!{ |a,b| b.date <=> a.date }
114 | end
115 |
116 | #
117 | #def page_defaults
118 | # { :stencil => config.stencil,
119 | # :layout => config.layout,
120 | # :author => config.author
121 | # }
122 | #end
123 |
124 | public
125 |
126 | #
127 | # Lookup layout by name.
128 | #
129 | def lookup_layout(name)
130 | layouts.find do |layout|
131 | config.layout_path.any? { |path|
132 | File.join(path, name) == layout.name
133 | } or name == layout.name
134 | end
135 | end
136 |
137 | #
138 | #
139 | #
140 | def lookup_partial(name)
141 | parts.find do |part|
142 | config.partial_path.any? { |path|
143 | File.join(path, name) == part.name
144 | } or name == part.name
145 | end
146 | end
147 |
148 | end
149 |
150 | end
151 |
--------------------------------------------------------------------------------
/work/reference/page.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # "entia non sunt multiplicanda praeter necessitatem"
3 | # --Ockham's razor
4 | ##
5 |
6 | begin ; require 'rubygems' ; rescue LoadError ; end
7 | begin ; require 'erb' ; rescue LoadError ; end
8 | begin ; require 'redcloth' ; rescue LoadError ; end
9 | begin ; require 'bluecloth' ; rescue LoadError ; end
10 |
11 | begin
12 | require 'rdoc/markup/simple_markup'
13 | require 'rdoc/markup/simple_markup/to_html'
14 | rescue LoadError
15 | end
16 |
17 | # = Webrite module
18 |
19 | module Webrite
20 |
21 | # Page class renders a single page.
22 |
23 | class Page
24 |
25 | attr_reader :page
26 |
27 | attr_reader :main
28 |
29 | attr_reader :parts
30 |
31 | attr_reader :context
32 |
33 | # Accepts a raze file, which is simply a YAML map of parts,
34 | # that interface to the main part.
35 |
36 | #def self.load(file)
37 | # parts = YAML.load(File.read(file))
38 | # parts = parts.inject({}) do |memo, (name, part)|
39 | # memo[name] = File.join(PARTS_DIR,part)
40 | # memo
41 | # end
42 | # new(parts)
43 | #end
44 |
45 | # Shiny New Raze Page.
46 |
47 | def initialize(page, parts={})
48 | @page = page
49 | @parts = parts
50 | @main = parts.delete('main') #|| MAINS_ALT TODO Add a default section for pages.yaml
51 |
52 | raise "missing main section" unless @main
53 |
54 | @context = PageContext.new(self) #, parts)
55 | @binding = @context.bound #instance_eval{ binding }
56 | end
57 |
58 | # Render page to html.
59 |
60 | def to_html
61 | render_file(main)
62 | end
63 |
64 | def link_rel(path)
65 | path
66 | end
67 |
68 | # Render part.
69 |
70 | def render(name)
71 | file = @parts[name.to_s]
72 | raise "bad file -- #{name}" unless file
73 | render_file(file)
74 | end
75 |
76 | # Render file.
77 |
78 | def render_file(path)
79 | case File.extname(path)
80 | #when '.raze'
81 | # raze(path)
82 | when '.red'
83 | redcloth(path)
84 | when '.blue'
85 | redcloth(path)
86 | when '.rdoc'
87 | rdoc(path)
88 | when '.rhtml'
89 | eruby(path)
90 | when '.html'
91 | html(path)
92 | else
93 | raise "unknown file type"
94 | end
95 | end
96 |
97 | #def raze(path)
98 | # parts = YAML.load(File.read(path))
99 | # Raze::Page.new(parts).to_html
100 | #end
101 |
102 | def redcloth(path)
103 | input = File.read(path)
104 | RedCloth.new(input).to_html
105 | end
106 |
107 | def bluecloth(path)
108 | input = File.read(path)
109 | BlueCloth.new(input).to_html
110 | end
111 |
112 | def rdoc(path)
113 | markup = SM::SimpleMarkup.new
114 | format = SM::ToHtml.new
115 | input = File.read(path)
116 | markup.convert(input, format)
117 | end
118 |
119 | def eruby(path)
120 | input = File.read(path)
121 | template = ERB.new(input)
122 | result = template.result(@binding) # (@binding) DOESN WORK, WHY?
123 | result
124 | end
125 |
126 | def html(path)
127 | File.read(path)
128 | end
129 |
130 | end
131 |
132 | #
133 |
134 | class PageContext
135 |
136 | def initialize(page)
137 | @page = page
138 | end
139 |
140 | #
141 |
142 | def render(name)
143 | @page.render(name)
144 | end
145 |
146 | #
147 |
148 | def render_file(path)
149 | @page.render_file(path)
150 | end
151 |
152 | #
153 |
154 | def part(name)
155 | @page.parts[name.to_s]
156 | end
157 |
158 | #
159 |
160 | def bound
161 | binding
162 | end
163 |
164 | end
165 |
166 | end
167 |
--------------------------------------------------------------------------------
/lib/brite/server.rb:
--------------------------------------------------------------------------------
1 | require 'fileutils'
2 | require 'tmpdir'
3 | require 'optparse'
4 |
5 | require 'rack'
6 | require 'rack/server'
7 | require 'rack/handler'
8 | require 'rack/builder'
9 | require 'rack/directory'
10 | require 'rack/file'
11 |
12 | require 'brite/config'
13 |
14 | module Brite
15 |
16 | # Brite::Server is a Rack-based server useful for testing sites locally.
17 | # Most sites cannot be fully previewed by loading static files into a browser.
18 | # Rather, a webserver is required to render and navigate a site completely.
19 | # So this light server is provided to facilitate this.
20 | #
21 | class Server
22 |
23 | # Rack configuration file.
24 | RACK_FILE = 'brite.ru'
25 |
26 | #
27 | def self.start(argv)
28 | new(argv).start
29 | end
30 |
31 | # Server options, parsed from command line.
32 | attr :options
33 |
34 | # Setup new instance of Brite::Server.
35 | def initialize(argv)
36 | @options = ::Rack::Server::Options.new.parse!(argv)
37 |
38 | @root = argv.first || Dir.pwd
39 |
40 | @options[:app] = app
41 | @options[:pid] = "#{tmp_dir}/pids/server.pid"
42 |
43 | @options[:Port] ||= '4444'
44 | end
45 |
46 | # THINK: Should we be using a local tmp directory instead?
47 | # Then again, why do we need them at all, really?
48 |
49 | # Temporary directory used by the rack server.
50 | def tmp_dir
51 | @tmp_dir ||= File.join(Dir.tmpdir, 'brite', root)
52 | end
53 |
54 | # Start the server.
55 | def start
56 | ensure_brite_site
57 |
58 | # create required tmp directories if not found
59 | %w(cache pids sessions sockets).each do |dir_to_make|
60 | FileUtils.mkdir_p(File.join(tmp_dir, dir_to_make))
61 | end
62 |
63 | ::Rack::Server.start(options)
64 | end
65 |
66 | # Ensure root is a Brite Site.
67 | def ensure_brite_site
68 | return true if File.exist?(rack_file)
69 | return true if config.file
70 | abort "Not a brite site."
71 | end
72 |
73 | # Load Brite configuration.
74 | def config
75 | @config ||= Brite::Config.new(root)
76 | end
77 |
78 | # Site root directory.
79 | def root
80 | @root
81 | end
82 |
83 | # Configuration file for server.
84 | def rack_file
85 | RACK_FILE
86 | end
87 |
88 | # If the site has a `brite.ru` file, that will be used to start the server,
89 | # otherwise a standard Rack::Directory server ise used.
90 | def app
91 | @app ||= (
92 | if ::File.exist?(rack_file)
93 | app, options = Rack::Builder.parse_file(rack_file, opt_parser)
94 | @options.merge!(options)
95 | app
96 | else
97 | root = self.root
98 | Rack::Builder.new do
99 | use Index, root
100 | run Rack::Directory.new("#{root}")
101 | end
102 | end
103 | )
104 | end
105 |
106 | # Rack middleware to serve `index.html` file by default.
107 | class Index
108 | def initialize(app, root)
109 | @app = app
110 | @root = root || Dir.pwd
111 | end
112 |
113 | def call(env)
114 | path = Rack::Utils.unescape(env['PATH_INFO'])
115 | index_file = File.join(@root, path, 'index.html')
116 | if File.exists?(index_file)
117 | [200, {'Content-Type' => 'text/html'}, File.new(index_file)]
118 | else
119 | @app.call(env) #Rack::Directory.new(@root).call(env)
120 | end
121 | end
122 | end
123 |
124 | #
125 | #def log_path
126 | # "_brite.log"
127 | #end
128 |
129 | #
130 | #def middleware
131 | # middlewares = []
132 | # #middlewares << [Rails::Rack::LogTailer, log_path] unless options[:daemonize]
133 | # #middlewares << [Rails::Rack::Debugger] if options[:debugger]
134 | # Hash.new(middlewares)
135 | #end
136 |
137 | end
138 |
139 | end
140 |
--------------------------------------------------------------------------------
/work/trash/site.rb:
--------------------------------------------------------------------------------
1 | require 'brite/config'
2 | require 'brite/page'
3 | require 'brite/post'
4 | require 'brite/layout'
5 |
6 | #
7 | module Brite
8 |
9 | # Site class
10 | class Site
11 |
12 | # Location of site in local file system.
13 | attr :location
14 |
15 | # Location of output directory. This path will be prefixed to path of
16 | # generated files. By default this is the current working directory.
17 | attr :output
18 |
19 | # Array of layouts.
20 | attr :layouts
21 |
22 | # Array of pages.
23 | attr :pages
24 |
25 | # Array of posts.
26 | attr :posts
27 |
28 | # If +true+ dont' actually write files to disk.
29 | attr :dryrun
30 |
31 | # Trace execution, providing details on $stderr, about what is
32 | # transpiring as the site is being generated.
33 | attr :trace
34 |
35 | def initialize(options={})
36 | @location = options[:location] || Dir.pwd
37 | @output = options[:output] || Dir.pwd
38 | @url = options[:url]
39 | @dryrun = options[:dryrun]
40 | @trace = options[:trace]
41 |
42 | @layouts = []
43 | @pages = []
44 | @posts = []
45 | end
46 |
47 | # Returns an Array of all tags used in all posts.
48 | def tags
49 | @tags ||= posts.map{ |post| post.tags }.flatten.uniq.sort
50 | end
51 |
52 | # Returns a Hash posts indexed by tag.
53 | def posts_by_tag
54 | @posts_by_tag ||= (
55 | chart ||= Hash.new{|h,k|h[k]=[]}
56 | posts.each do |post|
57 | post.tags.each do |tag|
58 | chart[tag] << post
59 | end
60 | end
61 | chart
62 | )
63 | end
64 |
65 | #
66 | def trace?
67 | @trace
68 | end
69 |
70 | # DEPRECATE: replaced by trace?
71 | def verbose?
72 | @trace
73 | end
74 |
75 | # Build site.
76 | def build
77 | Dir.chdir(location) do
78 | sort_files
79 | if trace?
80 | puts "Layouts: " + layouts.join(", ")
81 | puts "Pages: " + pages.join(", ")
82 | puts "Posts: " + posts.join(", ")
83 | puts
84 | end
85 | render
86 | puts "#{pages.size + posts.size} Files: #{pages.size} Pages, #{posts.size} Posts"
87 | end
88 | end
89 |
90 | # Lookup layout file by name.
91 | def lookup_layout(name)
92 | layouts.find{ |layout| name == layout.name }
93 | end
94 |
95 | #
96 | def sort_files
97 | files = Dir['**/*']
98 | files.each do |file|
99 | temp = false
100 | name = File.basename(file)
101 | ext = File.extname(file)
102 | case ext
103 | when '.layout'
104 | layouts << Layout.new(self, file)
105 | when '.page' #*%w{.markdown .rdoc .textile .whtml}
106 | pages << Page.new(self, file)
107 | when '.post'
108 | posts << Post.new(self, file)
109 | end
110 | end
111 | posts.sort!{ |a,b| b.date <=> a.date }
112 | end
113 |
114 | # Render and save site.
115 | def render
116 | render_posts # render posts first, so pages can use them
117 | render_pages
118 | end
119 |
120 | # Render and save posts.
121 | def render_posts
122 | posts.each do |post|
123 | post.save(output)
124 | end
125 | end
126 |
127 | # Render and save pages.
128 | def render_pages
129 | pages.each do |page|
130 | page.save(output)
131 | end
132 | end
133 |
134 | # Access to configuration file data.
135 | def config
136 | @config ||= Config.new(location)
137 | end
138 |
139 | # URL of site as set in configuration file.
140 | def url
141 | @url ||= config.url
142 | end
143 |
144 | ## Returns and instance of Gem::Do::Project.
145 | ##--
146 | ## TODO: incorporate location
147 | ##++
148 | #def project
149 | # @project ||= Gemdo::Project.new
150 | #end
151 |
152 | #
153 | def defaults
154 | config.defaults
155 | end
156 |
157 | # Convert pertinent information to a Hash to be used in rendering.
158 | def to_h
159 | pbt = {}
160 | posts_by_tag.each do |tag, posts|
161 | pbt[tag] = posts.map{ |p| p.to_h }
162 | end
163 | {
164 | 'posts' => posts.map{ |p| p.to_h },
165 | 'posts_by_tag' => pbt, #posts_by_tag, #.map{ |t, ps| [t, ps.map{|p|p.to_h}] }
166 | 'tags' => tags,
167 | 'url' => url
168 | }
169 | end
170 |
171 | # Conversion method provide support for the Liquid template engine. However,
172 | # at this time Brite is standardizing on ERB, since it is more versitle.
173 | # So this method may be deprecated in the future.
174 | def to_liquid
175 | to_h
176 | end
177 |
178 | end
179 |
180 | end
181 |
--------------------------------------------------------------------------------
/lib/brite/config.rb:
--------------------------------------------------------------------------------
1 | require 'yaml'
2 | require 'ostruct'
3 |
4 | module Brite
5 |
6 | # Configuration
7 | class Config
8 |
9 | # Configuration file name glob.
10 | CONFIG_FILE = '{.brite,brite.yml,brite.yaml}'
11 |
12 | # Default URL, which is just for testing purposes.
13 | DEFAULT_URL = 'http://0.0.0.0:3000'
14 |
15 | # Default stencil.
16 | DEFAULT_STENCIL = 'erb'
17 |
18 | # Default format.
19 | DEFAULT_FORMAT = nil #html
20 |
21 | # Default page layout file name (less `.layout` extension).
22 | DEFAULT_PAGE_LAYOUT = 'page'
23 |
24 | # Default post layout file name (less `.layout` extension).
25 | DEFAULT_POST_LAYOUT = 'post'
26 |
27 | # Default page route (`:path`).
28 | DEFAULT_PAGE_ROUTE = ':path'
29 |
30 | # Default post route (`:path`).
31 | DEFAULT_POST_ROUTE = ':path'
32 |
33 | # Default author for pages and posts.
34 | DEFAULT_AUTHOR = 'Anonymous'
35 |
36 | # Default location of layouts.
37 | DEFAULT_LAYOUT_PATH = ['assets/layouts']
38 |
39 | # Default location of partials.
40 | DEFAULT_PARTIAL_PATH = ['assets/partials']
41 |
42 | # Location of brite project files. By necessity the configuration file
43 | # will be located in this directory.
44 | attr :location
45 |
46 | # Configuration file.
47 | attr :file
48 |
49 | # Site's absolute URL. Where possible links are relative,
50 | # but it is not alwasy possible. So a URL should *ALWAYS*
51 | # be provided for the site.
52 | attr_accessor :url
53 |
54 | # Defaut section template engine.
55 | attr_accessor :stencil
56 |
57 | # Default section markup format.
58 | attr_accessor :format
59 |
60 | # Default page layout file name (less extension).
61 | attr_accessor :page_layout
62 |
63 | # Default post layout file name (less extension).
64 | attr_accessor :post_layout
65 |
66 | # Default page route.
67 | attr_accessor :page_route
68 |
69 | # Default post route.
70 | attr_accessor :post_route
71 |
72 | # Default author.
73 | attr_accessor :author
74 |
75 | # Paths to look for layouts.
76 | attr_accessor :layout_path
77 |
78 | # Paths to look for layouts.
79 | attr_accessor :partial_path
80 |
81 | # New instance of Config.
82 | def initialize(location=nil)
83 | @location = location || Dir.pwd
84 | @file = Dir.glob(File.join(@location, CONFIG_FILE)).first
85 |
86 | @url = DEFAULT_URL
87 | @stencil = DEFAULT_STENCIL
88 | @format = DEFAULT_FORMAT
89 |
90 | @page_layout = DEFAULT_PAGE_LAYOUT
91 | @post_layout = DEFAULT_POST_LAYOUT
92 |
93 | @page_route = DEFAULT_PAGE_ROUTE
94 | @post_route = DEFAULT_POST_ROUTE
95 |
96 | @author = DEFAULT_AUTHOR
97 |
98 | @layout_path = DEFAULT_LAYOUT_PATH
99 | @partial_path = DEFAULT_PARTIAL_PATH
100 |
101 | @custom = {}
102 |
103 | configure
104 | end
105 |
106 | #
107 | # Load configuration file.
108 | #
109 | def configure
110 | if file
111 | data = YAML.load(File.new(file))
112 | data.each do |k,v|
113 | __send__("#{k}=", v)
114 | end
115 | end
116 | end
117 |
118 | #
119 | # Make sure layout_path is a list.
120 | #
121 | def layout_path=(path)
122 | @layout_path = [path].flatten
123 | end
124 |
125 | #
126 | # Make sure partial_path is a list.
127 | #
128 | def partial_path=(path)
129 | @partial_path = [path].flatten
130 | end
131 |
132 | =begin
133 | #
134 | # Locate a layout looking in layout paths.
135 | #
136 | def find_layout(name)
137 | # look for layout in layout_path locations
138 | file = nil
139 | @layout_path.find do |path|
140 | file = Dir.glob(File.join(path, "#{name}.layout")).first
141 | end
142 | # fallback to site's root location
143 | if !file
144 | file = Dir.glob(File.join(@location, "#{name}.layout")).first
145 | end
146 | # if not found raise an error
147 | raise "Cannot locate layout #{name}." unless file
148 | # return layout file
149 | file
150 | end
151 | =end
152 |
153 | #
154 | # Provide access to POM.
155 | #
156 | # @todo Will become GemDo in future ?
157 | #
158 | def pom=(set)
159 | return unless set
160 | require 'pom'
161 | Brite::Context.class_eval do
162 | def project
163 | @project ||= POM::Project.new
164 | end
165 | end
166 | end
167 |
168 | #
169 | alias_method :gemdo=, :pom=
170 |
171 | #
172 | def method_missing(s, v=nil, *a, &b)
173 | s = s.to_s
174 | case s
175 | when /=$/
176 | @custom[s.chomp('=')] = v
177 | else
178 | if @custom.key?(s)
179 | @custom[s]
180 | else
181 | super(s.to_sym, v, *a, &b)
182 | end
183 | end
184 | end
185 |
186 | end
187 |
188 | end
189 |
--------------------------------------------------------------------------------
/lib/brite/page.rb:
--------------------------------------------------------------------------------
1 | require 'brite/model'
2 |
3 | module Brite
4 |
5 | # Models a site page.
6 | class Page < Model
7 |
8 | # New Page.
9 | def initialize(site, file, copy={})
10 | @site = site
11 | @file = file
12 |
13 | initialize_defaults
14 |
15 | update(copy)
16 |
17 | @_template = Neapolitan.file(file, :stencil=>site.config.stencil) #site.page_defaults)
18 |
19 | update(@_template.metadata)
20 | end
21 |
22 | #
23 | def initialize_defaults
24 | @tags = []
25 | @author = site.config.author
26 | @route = site.config.page_route
27 | @layout = site.config.page_layout
28 |
29 | @extension = '.html'
30 |
31 | # these are filled-out as needed, but the instance variable
32 | # must define up front to ensure #to_h will pick them up.
33 | # Probably this should be done in a different way in the future.
34 | @output = nil
35 | @path = nil
36 | @name = nil
37 | @url = nil
38 | @root = nil
39 | end
40 |
41 | # Instance of Site class to which this page belongs.
42 | attr_reader :site
43 |
44 | # The `.page` file.
45 | attr_reader :file
46 |
47 | # Author of page.
48 | attr_accessor :author
49 |
50 | # Title of page/post.
51 | attr_accessor :title
52 |
53 | # Publish date.
54 | attr_accessor :date
55 |
56 | def date
57 | @date ||= date_from_filename(file) || Time.now
58 | end
59 |
60 | # Category ("a glorified tag")
61 | attr_accessor :category
62 |
63 | # Is this page a draft? If so it will not be rendered.
64 | attr_accessor :draft
65 |
66 | # Query alias for #draft.
67 | alias_method :draft?, :draft
68 |
69 | # Output route.
70 | attr_accessor :route
71 |
72 | # Layout to use for page.
73 | attr_accessor :layout
74 |
75 | # Tags (labels)
76 | attr_accessor :tags
77 |
78 | #
79 | def tags=(entry)
80 | case entry
81 | when String, Symbol
82 | entry = entry.to_s.strip
83 | if entry.index(/[,;]/)
84 | entry = entry.split(/[,;]/)
85 | else
86 | entry = entry.split(/\s+/)
87 | end
88 | else
89 | entry = entry.to_a.flatten
90 | end
91 | @tags = entry.map{ |e| e.strip }
92 | end
93 |
94 | # The page's route, which is effectively the "Save As" output file.
95 | def output
96 | @output ||= calculate_output
97 | end
98 |
99 | # Set route directly, relative to file, overriding any slug.
100 | def output=(path)
101 | @output = path.sub(/^\//,'')
102 | end
103 |
104 | # Setting the peramlink is the same as setting output.
105 | alias_method :permalink=, :output=
106 |
107 | # Same as output but prefixed with `/`.
108 | def permalink
109 | '/' + output
110 | end
111 |
112 | alias_method :url, :permalink
113 |
114 | #
115 | #def url
116 | # @url ||= config.url ? File.join(config.url, output) : permalink
117 | #end
118 |
119 | # The `name` is same as `output` but without any file extension.
120 | def name
121 | @name ||= output.chomp(extension)
122 | end
123 |
124 | #
125 | #attr_accessor :relative_url do
126 | # output #File.join(root, output)
127 | #end
128 |
129 | # THINK: Is there any reason to have #work ?
130 | # Working directory of file being rendering.
131 | #def work
132 | # @work ||= '/' + File.dirname(file)
133 | #end
134 |
135 | # Relative path difference between the route and the site's root.
136 | # The return value is a string of `..` paths, e.g. `"../../"`.
137 | #
138 | # @return [String] multiples of `../`.
139 | def root
140 | #@root ||= '../' * file.count('/')
141 | @root ||= '../' * (output.count('/') - (output.scan('../').length*2))
142 | end
143 |
144 | # Output extension (defualts to 'html').
145 | def extension
146 | @extension #||= '.html'
147 | end
148 |
149 | # Set output extension.
150 | #
151 | # @param [String] extname
152 | # The file extension.
153 | #
154 | def extension=(extname)
155 | @extension = (
156 | e = (extname || 'html').to_s
157 | e = '.' + e unless e.start_with?('.')
158 | e
159 | )
160 | end
161 |
162 | # TODO: Summary is being set externally, is there a way to fix ?
163 |
164 | # Summary is the rendering of the first part.
165 | attr_accessor :summary
166 |
167 | # Renders page template.
168 | def to_s
169 | render
170 | end
171 |
172 | #
173 | def inspect
174 | "#<#{self.class} #{@file}>"
175 | end
176 |
177 | private
178 |
179 | #
180 | def date_from_filename(file)
181 | if md = (/^\d\d\d\d-\d\d-\d\d/.match(file))
182 | md[1]
183 | else
184 | File.mtime(file)
185 | end
186 | end
187 |
188 | #
189 | def calculate_output
190 | path = file.chomp(File.extname(file))
191 | name = File.basename(path)
192 |
193 | out = route.dup
194 | out = date.strftime(out) if out.index('%')
195 | out = out.sub(':path', path)
196 | out = out.sub(':name', name)
197 | out = out + extension
198 | out
199 | end
200 |
201 | # Render page or post.
202 | #
203 | # @param [Neapolitan::Template] template
204 | # Template to be rendered.
205 | #
206 | # @param [Model] model
207 | # Page or Post model to use for rendering.
208 | #
209 | def render
210 | render = @_template.render(self) #, &body)
211 |
212 | self.summary = render.summary # TODO: make part of neapolitan?
213 |
214 | result = render.to_s
215 |
216 | if layout
217 | if layout_object = site.lookup_layout(layout)
218 | result = layout_object.render(self){ result }
219 | #else
220 | # raise "No such layout -- #{layout}" unless layout
221 | end
222 | end
223 |
224 | result.to_s.strip
225 | end
226 |
227 | end
228 |
229 | end
230 |
--------------------------------------------------------------------------------
/work/reference/server.rb:
--------------------------------------------------------------------------------
1 | # TITLE:
2 | #
3 | # Raze Server
4 | #
5 | # SUMMARY:
6 | #
7 | # The Raze server uses Rack to provide a simple means of serving
8 | # a Raze-based site. One can use this as an alternative to
9 | # generating the site, or simply for testing purposes before
10 | # deploying.
11 |
12 | require 'webrite/page'
13 |
14 | begin
15 | require 'rack'
16 | require 'rack/request'
17 | require 'rack/response'
18 | rescue LoadError => e
19 | if require 'rubygems'
20 | retry
21 | else
22 | raise e
23 | end
24 | end
25 |
26 |
27 | module Webrite
28 |
29 | # TODO Make alterable?
30 |
31 | def self.root
32 | Dir.pwd
33 | end
34 |
35 | # = Raze Rack-based Server
36 | #
37 | # The server looks for a configuration file 'server.yaml' in your raze site's
38 | # root directory. These are configuration options fed to Rack's handler. Use
39 | # 'adapter' entry in this to select which handler to use (webrick, cgi, fcgi).
40 | # If not server.yaml file is found, or entries not given, the deafult settings
41 | # are Webrick on port 8181.
42 |
43 | class Server
44 |
45 | DEFAULT_ROUTE = "routes.yaml"
46 |
47 | DEFAULT_CONFIG = { 'port' => 8181 }
48 |
49 | def self.adapters(name)
50 | case name..to_s.downcase
51 | when 'webrick'
52 | Rack::Handler::WEBrick
53 | when 'cgi'
54 | Rack::Handler::CGI
55 | when 'fcgi'
56 | Rack::Handler::FastCGI
57 | else
58 | Rack::Handler::WEBrick
59 | end
60 | end
61 |
62 | # Go Raze!
63 |
64 | def self.start
65 | config = load_config
66 | adapter = config.delete(:Adapter)
67 | #use Rack::ShowExceptions
68 | server = Raze::Server.new
69 |
70 | adapters(adapter).run(server, config)
71 | end
72 |
73 | # Load server configuration.
74 |
75 | def self.load_config
76 | default = DEFAULT_CONFIG
77 | if File.file?('server.yaml')
78 | default.update(YAML.load(File.new("server.yaml")))
79 | end
80 | default.inject({}){|m, (k,v)| m[k.capitalize.to_sym] = v; m}
81 | end
82 |
83 | # Shiny new Raze site server.
84 |
85 | def initialize
86 | #load_config
87 | load_routes
88 | end
89 |
90 | # Load routes.
91 |
92 | def load_routes
93 | @routes = []
94 | routes = YAML.load(DEFAULT_ROUTE)
95 | routes.each do |target, parts|
96 | puts "[Add Route] " + target
97 | #name = name.chomp(File.extname(name))
98 | load_route(target, parts)
99 | end
100 | end
101 |
102 | # Load a route.
103 |
104 | def load_route(target, parts)
105 | @routes << Route.new(target, parts)
106 | end
107 |
108 | # for rack
109 |
110 | def call(env)
111 | req = Request.new(
112 | :method => env['REQUEST_METHOD'], # GET/POST
113 | :script => env['SCRIPT_NAME'], # The initial portion of the request URL’s "path" that corresponds to the application object, so that the application knows its virtual "location". This may be an empty string, if the application corresponds to the "root" of the server.
114 | :path => env['PATH_INFO'], # The remainder of the request URL’s "path", designating the virtual "location" of the request’s target within the application. This may be an empty string, if the request URL targets the application root and does not have a trailing slash.
115 | :query => env['QUERY_STRING'], # The portion of the request URL that follows the ?, if any. May be empty, but is always required!
116 | :domain => env['SERVER_NAME'], # When combined with SCRIPT_NAME and PATH_INFO, these variables can be used to complete the URL. Note, however, that HTTP_HOST, if present, should be used in preference to SERVER_NAME for reconstructing the request URL. SERVER_NAME and SERVER_PORT can never be empty strings, and so are always required.
117 | :port => env['SERVER_PORT']
118 | #env['HTTP_???']
119 | )
120 | return respond(req)
121 | end
122 |
123 | # Respond to request.
124 |
125 | def respond(request)
126 | puts "[Request] " + request.path
127 |
128 | route = find_route(request.path)
129 | if route
130 | status, header, body = route.respond(request)
131 | else
132 | path = request.path
133 | path = path[1..-1] if path[0,1] == '/'
134 | if File.exist?(path) # pass through to webserver?
135 | status = 200
136 | header = {"Content-Type" => "text/plain"} # how to decipher?
137 | body = File.new(path)
138 | else
139 | status = 404
140 | header = {"Content-Type" => "text/html"}
141 | body = "404
" # FIX just return rack exception page if development mode.
142 | end
143 | end
144 |
145 | return status, header, body
146 | end
147 |
148 | # Find a route for the given url.
149 |
150 | def find_route(url)
151 | @routes.each do |route|
152 | if route.match(url)
153 | return route
154 | end
155 | end
156 | nil
157 | end
158 |
159 | end
160 |
161 |
162 | # Site Request
163 |
164 | class Request
165 | attr_accessor :method
166 | attr_accessor :script
167 | attr_accessor :path
168 | attr_accessor :query
169 | attr_accessor :domain
170 | attr_accessor :port
171 |
172 | def initialize(options)
173 | options.each do |k,v| send("#{k}=", v) end
174 | end
175 | end
176 |
177 |
178 | # Site Route
179 |
180 | class Route
181 | attr :route
182 | attr :parts
183 |
184 | #def self.load(file)
185 | # new(YAML.load(File.new(file)))
186 | #end
187 |
188 | def initialize(route, parts)
189 | @route = route #'/' + File.basename(file).chomp('.raze')
190 | @parts = parts
191 | end
192 |
193 | def match(url)
194 | route == url || route + 'html' == url
195 | #Regexp.new(@route).match(url)
196 | end
197 |
198 | def respond(request)
199 | body = Page.new(route, parts).to_html
200 | return 200, {"Content-Type" => "text/html"}, [body]
201 | end
202 |
203 | end
204 |
205 | end
206 |
--------------------------------------------------------------------------------
/work/reference/generator.rb:
--------------------------------------------------------------------------------
1 | require 'webrite/page'
2 | require 'fileutils'
3 |
4 | # = Webrite module
5 |
6 | module Webrite
7 |
8 | # Site generator
9 |
10 | class Generator
11 |
12 | class NoSource < ArgumentError
13 | def message; "No source folder."; end
14 | end
15 |
16 | #SOURCE = 'parts'
17 | SITEMAP = 'sitemap.yaml'
18 |
19 | RSYNC_FILTER = %{
20 | - .svn
21 | P wiki
22 | P robot.txt
23 | P statcvs
24 | P statsvn
25 | P usage
26 | }.gsub(/^\s*/m,'')
27 |
28 | # New Generator.
29 |
30 | def initialize(options={})
31 | #@source = options[:source] || SOURCE
32 | @sitemap = options[:sitemap] || SITEMAP
33 | @output = options[:output] || '.'
34 |
35 | @noharm = options[:noharm] || options[:dryrun]
36 | @trace = options[:trace]
37 |
38 | #unless File.directory?(@source)
39 | # raise(NoSource, "no parts source -- #{@source}")
40 | #end
41 |
42 | unless File.file?(@sitemap)
43 | raise(LoadError, "sitemap file not found -- #{@sitemap}")
44 | end
45 |
46 | # link vs install?
47 | end
48 |
49 | def noharm? ; @noharm ; end
50 | alias_method :dryrun?, :noharm?
51 |
52 | # Load routes.
53 |
54 | def routes
55 | @routes ||= (
56 | YAML::load(File.open(@sitemap))
57 | )
58 | end
59 |
60 | # Generate site.
61 |
62 | def generate
63 | actions = routes.collect do |page, parts|
64 | case page
65 | when '.rsync-filter'
66 | ['rsync', page, parts]
67 | else
68 | case parts
69 | #when String
70 | # ['ditto', page, parts]
71 | when Hash
72 | ['page', page, parts]
73 | when YAML::PrivateType
74 | [parts.type_id, page, parts.value]
75 | else
76 | raise "Unknown target type."
77 | end
78 | end
79 | end
80 |
81 | actions.each do |action, page, parts|
82 | send("handle_#{action}", page, parts)
83 | end
84 | end
85 |
86 | # # Link handler.
87 | # # This is a lighter alternative to using install.
88 | #
89 | # def handle_link(target, parts)
90 | # part, glob = parts.split(/\s+/)
91 | # if File.directory?(File.join(@source, part))
92 | # files = nil
93 | # Dir.chdir(File.join(@source, part)) do
94 | # files = Dir.glob(glob||'**/*')
95 | # files = files.select{|file| File.file?(file)}
96 | # end
97 | # files.each do |file|
98 | # src = File.join(@source, part, file)
99 | # dst = File.join(@output, target, file)
100 | # link(src, dst)
101 | # end
102 | # else
103 | # src = File.join(@source, part)
104 | # dst = File.join(@output, target)
105 | # link(src,dst)
106 | # end
107 | # end
108 |
109 | # # Rule handler.
110 | #
111 | # def handle_rule(page, parts)
112 | # i = 0
113 | # page = page.gsub('*'){ |m| '\\' + "#{i += 1}" }
114 | # parts = parts.gsub('*', '(.*?)')
115 | # regex = Regexp.new(parts)
116 | # files = source_files
117 | #
118 | # copy = []
119 | # Dir.chdir(@source) do
120 | # files.grep(regex){ |file|
121 | # next unless File.file?(file)
122 | # dest = file.sub(regex, page)
123 | # copy << [file, dest]
124 | # }
125 | # end
126 | #
127 | # copy.each do |src, dst|
128 | # src = File.join(@source, src)
129 | # dst = File.join(@output, dst)
130 | # link(src, dst)
131 | # #unless File.exist?(dest)
132 | # # fs.mkdir_p(File.dirname(dest))
133 | # # fs.ln(srce, dest)
134 | # # puts " " + dest
135 | # #end
136 | # end
137 | # end
138 |
139 | # Handle rysnc filter.
140 |
141 | def handle_rsync(page, parts)
142 | case parts
143 | when String
144 | parts = parts.strip + "\n"
145 | parts << "- #{@source}"
146 | parts << "- #{@sitemap}"
147 | parts << RSYNC_FILTER
148 | end
149 | Dir.chdir(@output) do
150 | File.open('.rsync-filter', 'w'){ |f| f << parts }
151 | end
152 | end
153 |
154 | # Page handler.
155 |
156 | def handle_page(page, parts)
157 | dest = File.join(@output, page)
158 | time = last_modified(parts.values)
159 |
160 | return if File.exist?(dest) && time < File.mtime(dest)
161 |
162 | html = Page.new(page, parts).to_html
163 |
164 | if noharm?
165 | puts "#{$0} #{dest}"
166 | else
167 | fs.mkdir_p(File.dirname(dest))
168 | File.open(dest,'w'){ |f| f << html }
169 | puts dest unless @silent
170 | end
171 | end
172 |
173 |
174 |
175 | # #
176 | #
177 | # def source_files(glob=nil)
178 | # glob ||= '**/*'
179 | # @source_files ||= {}
180 | # @source_files[glob] ||= (
181 | # files = nil
182 | # Dir.chdir(@source) do
183 | # files = Dir.glob(glob)
184 | # end
185 | # files
186 | # )
187 | # end
188 |
189 | #
190 |
191 | def fs
192 | @noharm ? FileUtils::DryRun : FileUtils
193 | end
194 |
195 | #
196 |
197 | # def link(src, dst)
198 | # unless File.exist?(dst) && File.mtime(dst) >= File.mtime(src)
199 | # fs.mkdir_p(File.dirname(dst))
200 | # fs.rm(dst) if File.exist?(dst)
201 | # fs.ln(src, dst)
202 | # puts dst unless @silent
203 | # end
204 | # end
205 |
206 | # Returns the most recent modified time from the
207 | # list of source files.
208 |
209 | def last_modified(parts)
210 | files = parts.select{ |f| File.file?(f) }
211 | times = files.collect do |part|
212 | file = File.join(part)
213 | File.mtime(file)
214 | end
215 | times.max
216 | end
217 |
218 | end
219 | end
220 |
221 |
222 |
223 |
224 | # # Straight install copy.
225 | # #
226 | # # example: !!install
227 | # # source: examples/**/*
228 | # # mode: 0444
229 | #
230 | # def handle_install(target, parts)
231 | # if Hash===parts
232 | # glob = parts['source']
233 | # mode = parts['mode']
234 | # else
235 | # glob = parts
236 | # end
237 | # files = source_files(glob)
238 | # files.each do |file|
239 | # src = File.join(@source, file)
240 | # dst = File.join(target, file)
241 | # fs.install(src, dst)
242 | # end
243 | # end
244 |
--------------------------------------------------------------------------------
/work/trash/template.rb:
--------------------------------------------------------------------------------
1 | raise 'here'
2 |
3 | #require 'tilt'
4 | require 'malt'
5 |
6 | module Brite
7 |
8 | #
9 | class Template
10 |
11 | def initialize(attributes)
12 | @attributes = attributes
13 | end
14 |
15 | #
16 | def render(stencil, format, text, attributes, &content)
17 | text = render_format(format, text)
18 | text = render_stencil(stencil, text, attributes, &content)
19 | text
20 | end
21 |
22 | #def render_format(format, text)
23 | # case format
24 | # when 'rdoc'
25 | # rdoc(text)
26 | # when 'markdown'
27 | # rdiscount(text)
28 | # when 'textile'
29 | # redcloth(text)
30 | # when 'haml'
31 | # haml(text)
32 | # else # html
33 | # text
34 | # end
35 | #end
36 |
37 | # Format Rendering
38 | # ----------------
39 |
40 | #
41 | def render_format(format, text)
42 | case format
43 | when /^coderay/
44 | coderay(text, format)
45 | when /^syntax/
46 | syntax(text, format)
47 | when /^pygments/
48 | pygments(text, format)
49 | #when 'rdoc' # TODO: Remove when next version of tilt is released.
50 | # rdoc(text)
51 | else
52 | #context = TemplateContext.new
53 | Malt.render(text, :to=>format) #, :data=>context)
54 | #if engine = Tilt[format]
55 | # engine.new{text}.render #(context)
56 | #else
57 | # text
58 | #end
59 | end
60 | end
61 |
62 | #
63 | def render_via_tilt(format, text)
64 | if engine = Tilt[format]
65 | engine.new{text}.render #(context)
66 | else
67 | text
68 | end
69 | end
70 |
71 | #
72 | #def redcloth(input)
73 | # RedCloth.new(input).to_html
74 | #end
75 |
76 | #def bluecloth(input)
77 | # BlueCloth.new(input).to_html
78 | #end
79 |
80 | #def rdiscount(input)
81 | # RDiscount.new(input).to_html
82 | #end
83 |
84 | def rdoc(input)
85 | markup = RDoc::Markup::ToHtml.new
86 | markup.convert(input)
87 | end
88 |
89 | #def haml(input)
90 | # Haml::Engine.new(input).render
91 | #end
92 |
93 | def coderay(input, format)
94 | require 'coderay'
95 | format = format.split('.')[1] || :ruby #:plaintext
96 | tokens = CodeRay.scan(input, format.to_sym) #:ruby
97 | tokens.div()
98 | end
99 |
100 | #
101 | def syntax(input, format)
102 | require 'syntax/convertors/html'
103 | format = format.split('.')[1] || 'ruby' #:plaintext
104 | lines = true
105 | conv = Syntax::Convertors::HTML.for_syntax(format)
106 | %q{} + conv.convert(input,lines) + %q{
}
107 | end
108 |
109 | #
110 | def pygments(input, format)
111 | require 'tmpdir'
112 | format = format.split('.')[1] || 'ruby' #:plaintext
113 | lines = true
114 | #%q{} + conv.convert(input,lines) + %q{
}
115 | file = File.join(Dir.tmpdir, 'brite-pygments.txt')
116 | File.open(file, 'w+'){ |f| f << input }
117 | `pygmentize -f html -l #{format} #{file}`
118 | end
119 |
120 | # Stencil Rendering
121 | # -----------------
122 |
123 | #
124 | #def render_stencil(stencil, text, attributes)
125 | # case stencil
126 | # when 'rhtml'
127 | # erb(text, attributes)
128 | # when 'liquid'
129 | # liquid(text, attributes)
130 | # else
131 | # text
132 | # end
133 | #end
134 |
135 | #
136 | def render_stencil(stencil, text, attributes, &content)
137 | p "OH NO TILT!!!!"
138 | #if Malt.support?(stencil)
139 | context = TemplateContext.new(attributes)
140 | Malt.render(text, :to=>format, :data=>context, &content)
141 | #else
142 | # text
143 | #end
144 |
145 | #if engine = Tilt[stencil]
146 | # engine.new{text}.render(nil, attributes, &content)
147 | #else
148 | # text
149 | #end
150 | end
151 |
152 | #
153 | #def erb(input, attributes)
154 | # template = ERB.new(input)
155 | # context = TemplateContext.new(attributes)
156 | # result = template.result(context.__binding__)
157 | # result
158 | #end
159 |
160 | #def liquid(input, attributes)
161 | # template = Liquid::Template.parse(input)
162 | # result = template.render(attributes, :filters => [TemplateFilters])
163 | # result
164 | #end
165 |
166 | # Require Dependencies
167 | # --------------------
168 |
169 | # TODO: Load engines only if used.
170 |
171 | begin ; require 'rubygems' ; rescue LoadError ; end
172 | begin ; require 'erb' ; rescue LoadError ; end
173 | begin ; require 'redcloth' ; rescue LoadError ; end
174 | begin ; require 'bluecloth' ; rescue LoadError ; end
175 | begin ; require 'rdiscount' ; rescue LoadError ; end
176 |
177 | begin
178 | require 'liquid'
179 | #Liquid::Template.register_filter(TemplateFilters)
180 | rescue LoadError
181 | end
182 |
183 | begin
184 | require 'haml'
185 | #Haml::Template.options[:format] = :html5
186 | rescue LoadError
187 | end
188 |
189 | begin
190 | require 'rdoc/markup'
191 | require 'rdoc/markup/to_html'
192 | rescue LoadError
193 | end
194 |
195 | end
196 |
197 | #
198 | #
199 | #
200 |
201 | #module TemplateFilters
202 |
203 | # NOTE: HTML truncate did not work well.
204 |
205 | # # HTML comment regular expression
206 | # REM_RE = %r{<\!--(.*?)-->}
207 | #
208 | # # HTML tag regular expression
209 | # TAG_RE = %r{?\w+((\s+\w+(\s*=\s*(?:"(.|\n)*?"|'(.|\n)*?'|[^'">\s]+))?)+\s*|\s*)/?>} #'
210 | #
211 | # #
212 | # def truncate_html(html, limit)
213 | # return html unless limit
214 | #
215 | # mask = html.gsub(REM_RE){ |m| "\0" * m.size }
216 | # mask = mask.gsub(TAG_RE){ |m| "\0" * m.size }
217 | #
218 | # i, x = 0, 0
219 | #
220 | # while i < mask.size && x < limit
221 | # x += 1 if mask[i] != "\0"
222 | # i += 1
223 | # end
224 | #
225 | # while x > 0 && mask[x,1] == "\0"
226 | # x -= 1
227 | # end
228 | #
229 | # return html[0..x]
230 | # end
231 |
232 | #end
233 |
234 | # TODO: Make this a configuration option.
235 | require 'gemdo'
236 |
237 | # = Clean Rendering Context
238 | #
239 | # The TemplateContext is used by Malt (eg. ERB).
240 |
241 | class TemplateContext
242 | #include TemplateFilters
243 |
244 | instance_methods(true).each{ |m| private m unless m =~ /^(__|inspect$)/ }
245 |
246 | def initialize(attributes={})
247 | @attributes = attributes
248 | end
249 |
250 | #
251 | def render(file)
252 | Malt.render(:file=>file)
253 | end
254 |
255 | #
256 | def to_binding
257 | binding
258 | end
259 |
260 | #
261 | def to_h
262 | @attributes
263 | end
264 |
265 | #
266 | def method_missing(s, *a)
267 | s = s.to_s
268 | @attributes.key?(s) ? @attributes[s] : super(s,*a)
269 | end
270 | end
271 |
272 | end
273 |
274 |
--------------------------------------------------------------------------------
/work/trash/page.rb:
--------------------------------------------------------------------------------
1 | require 'neapolitan'
2 | #require 'brite/part'
3 | require 'brite/context'
4 |
5 | module Brite
6 |
7 | # Page class
8 | class Page
9 |
10 | # TODO: I don't much care for how the fields are being handled.
11 |
12 | #
13 | def self.fields(anc=false)
14 | if anc
15 | f = []
16 | ancestors.reverse_each do |a|
17 | f.concat(a.fields) if a.respond_to?(:fields)
18 | end
19 | f
20 | else
21 | @fields ||= []
22 | end
23 | end
24 |
25 | #
26 | def self.field(*names)
27 | names.each do |name|
28 | fields << name.to_sym
29 | end
30 | end
31 |
32 | #
33 | #def self.field(name, &default)
34 | # name = name.to_sym
35 | # fields << name
36 | # if default
37 | # define_method(name) do
38 | # @attributes[name] ||= instance_eval(&default)
39 | # end
40 | # else
41 | # define_method(name) do
42 | # @attributes[name]
43 | # end
44 | # end
45 | # define_method("#{name}=") do |value|
46 | # @attributes[name] = value
47 | # end
48 | #end
49 |
50 | # New Page.
51 | def initialize(site, file)
52 | @attributes = {}
53 |
54 | self.site = site
55 |
56 | @file = file
57 | @output = nil
58 |
59 | @layout = default_layout
60 |
61 | parse
62 | end
63 |
64 | #
65 | def config
66 | site.config
67 | end
68 |
69 | # Path of page file.
70 | def file
71 | @file
72 | end
73 |
74 | # Template type (`rhtml` or `liquid` are good choices).
75 | def stencil
76 | @stencil
77 | end
78 |
79 | # Layout name (relative file name less extension).
80 | def layout
81 | @layout
82 | end
83 |
84 | #
85 | def layout=(layout)
86 | case layout
87 | when false, nil
88 | @layout = nil
89 | else
90 | @layout = layout
91 | end
92 | end
93 |
94 | # Returns an instance of Neapolitan::Template.
95 | def template
96 | @template
97 | end
98 |
99 | #
100 | attr :attributes
101 |
102 | #
103 | #attr :header
104 |
105 | # Returns a list of fields. Fields are the attributes/methods visible
106 | # to a template via the Scope class.
107 | def fields
108 | self.class.fields(true)
109 | end
110 |
111 | #
112 | def output
113 | @output ||= file.chomp(File.extname(file)) + extension
114 | end
115 |
116 | #
117 | def output=(fname)
118 | @output = File.join(File.dirname(file), fname) if fname
119 | @output
120 | end
121 |
122 | # Output extension (defualt is 'html')
123 | def extension
124 | @extension ||= '.html'
125 | end
126 |
127 | # Set output extension.
128 | def extension=(extname)
129 | @extension = (
130 | e = (extname || 'html').to_s
131 | e = '.' + e unless e.start_with?('.')
132 | e
133 | )
134 | end
135 |
136 | field :site, :author, :title, :date, :category, :tags, :url
137 | field :root, :work, :path, :summary
138 |
139 | # Instance of Site class to which this page belongs.
140 | attr_accessor :site
141 |
142 | # Author
143 | attr_accessor :author # 'Anonymous'
144 |
145 | # Title of page/post
146 | attr_accessor :title
147 |
148 | # Publish date
149 | def date
150 | @date ||= (date_from_filename(file) || Time.now)
151 | end
152 |
153 | def date=(date)
154 | @date = date
155 | end
156 |
157 | # Category ("a glorified tag")
158 | attr_accessor :category
159 |
160 | # Tags (labels)
161 | def tags
162 | @tags ||= []
163 | end
164 |
165 | #
166 | def tags=(entry)
167 | case entry
168 | when String, Symbol
169 | entry = entry.to_s.strip
170 | if entry.index(/[,;]/)
171 | entry = entry.split(/[,;]/)
172 | else
173 | entry = entry.split(/\s+/)
174 | end
175 | else
176 | entry = entry.to_a.flatten
177 | end
178 | @attributes[:tags] = entry.map{ |e| e.strip }
179 | end
180 |
181 | #
182 | def name
183 | @name ||= file.chomp(File.extname(file))
184 | end
185 |
186 | #
187 | def url
188 | File.join(site.url, name + extension)
189 | end
190 |
191 | #
192 | #def relative_url
193 | # output #File.join(root, output)
194 | #end
195 |
196 | #
197 | def path
198 | name + extension
199 | end
200 |
201 | # DEPRECATE: Get rid of this and use rack to test page instead of files.
202 | # OTOH, that may not alwasy be possible we may need to keep this.
203 | def root
204 | '../' * file.count('/')
205 | end
206 |
207 | # Working directory of file being rendering. (Why a field?)
208 | def work
209 | '/' + File.dirname(file)
210 | end
211 |
212 | # Summary is the rendering of the first part.
213 | attr_accessor :summary
214 |
215 | #
216 | def dryrun?
217 | site.dryrun
218 | end
219 |
220 | #
221 | def to_scope
222 | Scope.new(self, fields, attributes)
223 | end
224 |
225 | #
226 | def to_h
227 | scope.to_h.inject({}){ |h,(k,v)| h[k.to_s] = v; h }
228 | #prime_defaults
229 | #hash = {}
230 | #@attributes.each do |k,v|
231 | # hash[k.to_s] = v
232 | #end
233 | #hash
234 | end
235 |
236 | =begin
237 | # Convert pertinent information to a Hash to be used in rendering.
238 | def to_contextual_attributes
239 | prime_defaults
240 | hash = {}
241 | @attributes.each do |k,v|
242 | if v.respond_to?(:to_h)
243 | hash[k.to_s] = v.to_h
244 | else
245 | hash[k.to_s] = v
246 | end
247 | end
248 | hash['page'] = self
249 | #to_h.merge(
250 | # 'site'=>site.to_h, 'page'=>to_h, 'root'=>root, 'work'=>work, 'project'=>site.project
251 | #)
252 | hash
253 | end
254 |
255 | #
256 | def to_liquid
257 | to_contextual_attributes
258 | end
259 |
260 | #
261 | def prime_defaults
262 | self.class.fields(true).each do |field|
263 | __send__(field)
264 | end
265 | end
266 | =end
267 |
268 | #
269 | def save(dir=nil)
270 | dir = dir || Dir.pwd # TODO
271 | text = render{''}
272 | fname = output
273 | if dryrun?
274 | puts "[DRYRUN] write #{fname}"
275 | else
276 | if File.exist?(fname)
277 | current = File.read(fname)
278 | else
279 | current = nil
280 | end
281 | if current != text or $FORCE
282 | puts " write: #{fname}"
283 | File.open(fname, 'w'){ |f| f << text }
284 | else
285 | puts " kept: #{fname}"
286 | end
287 | end
288 | end
289 |
290 | #
291 | def render(scope=nil, &body)
292 | #attributes = to_contextual_attributes
293 | #attributes = attributes.merge(inherit)
294 |
295 | if scope
296 | scope.merge!(attributes)
297 | else
298 | scope = to_scope
299 | end
300 |
301 | render = template.render(scope, &body)
302 |
303 | self.summary = render.summary # TODO: make part of neapolitan?
304 |
305 | result = render.to_s
306 |
307 | if layout
308 | renout = site.lookup_layout(layout)
309 | raise "No such layout -- #{layout}" unless renout
310 | result = renout.render(scope){ result }
311 | end
312 |
313 | result.to_s.strip
314 | end
315 |
316 | # Default layout is different for pages vs. posts, so we
317 | # use this method to differntiation them.
318 | def default_layout
319 | site.config.page_layout
320 | end
321 |
322 | #
323 | def to_s
324 | file
325 | end
326 |
327 | #
328 | def inspect
329 | "<#{self.class}: #{file}>"
330 | end
331 |
332 | private
333 |
334 | #
335 | def parse
336 | @template = Neapolitan.file(file, :stencil=>site.config.stencil)
337 |
338 | header = @template.header
339 |
340 | self.output = header.delete('output')
341 | self.layout = header.delete('layout')
342 | #self.stencil = @attributes.delete('stencil') || site.defaults.stencil
343 | #self.extension = @attributes.delete('extension')
344 |
345 | @attributes = {}
346 |
347 | header.each do |k,v|
348 | if self.class.fields.include?(k.to_sym) && respond_to?("#{k}=")
349 | __send__("#{k}=",v)
350 | else
351 | @attributes[k.to_sym] = v
352 | end
353 | end
354 | end
355 |
356 | #
357 | def date_from_filename(file)
358 | if md = (/^\d\d\d\d-\d\d-\d\d/.match(file))
359 | md[1]
360 | else
361 | File.mtime(file)
362 | end
363 | end
364 |
365 | end
366 |
367 | end
368 |
--------------------------------------------------------------------------------
/.gemspec:
--------------------------------------------------------------------------------
1 | # encoding: utf-8
2 |
3 | require 'yaml'
4 | require 'pathname'
5 |
6 | module Indexer
7 |
8 | # Convert index data into a gemspec.
9 | #
10 | # Notes:
11 | # * Assumes all executables are in bin/.
12 | # * Does not yet handle default_executable setting.
13 | # * Does not yet handle platform setting.
14 | # * Does not yet handle required_ruby_version.
15 | # * Support for rdoc entries is weak.
16 | #
17 | class GemspecExporter
18 |
19 | # File globs to include in package --unless a manifest file exists.
20 | FILES = ".index .yardopts alt bin data demo ext features lib man spec test try* [A-Z]*.*" unless defined?(FILES)
21 |
22 | # File globs to omit from FILES.
23 | OMIT = "Config.rb" unless defined?(OMIT)
24 |
25 | # Standard file patterns.
26 | PATTERNS = {
27 | :root => '{.index,Gemfile}',
28 | :bin => 'bin/*',
29 | :lib => 'lib/{**/}*', #.rb',
30 | :ext => 'ext/{**/}extconf.rb',
31 | :doc => '*.{txt,rdoc,md,markdown,tt,textile}',
32 | :test => '{test,spec}/{**/}*.rb'
33 | } unless defined?(PATTERNS)
34 |
35 | # For which revision of indexer spec is this converter intended?
36 | REVISION = 2013 unless defined?(REVISION)
37 |
38 | #
39 | def self.gemspec
40 | new.to_gemspec
41 | end
42 |
43 | #
44 | attr :metadata
45 |
46 | #
47 | def initialize(metadata=nil)
48 | @root_check = false
49 |
50 | if metadata
51 | root_dir = metadata.delete(:root)
52 | if root_dir
53 | @root = root_dir
54 | @root_check = true
55 | end
56 | metadata = nil if metadata.empty?
57 | end
58 |
59 | @metadata = metadata || YAML.load_file(root + '.index')
60 |
61 | if @metadata['revision'].to_i != REVISION
62 | warn "This gemspec exporter was not designed for this revision of index metadata."
63 | end
64 | end
65 |
66 | #
67 | def has_root?
68 | root ? true : false
69 | end
70 |
71 | #
72 | def root
73 | return @root if @root || @root_check
74 | @root_check = true
75 | @root = find_root
76 | end
77 |
78 | #
79 | def manifest
80 | return nil unless root
81 | @manifest ||= Dir.glob(root + 'manifest{,.txt}', File::FNM_CASEFOLD).first
82 | end
83 |
84 | #
85 | def scm
86 | return nil unless root
87 | @scm ||= %w{git hg}.find{ |m| (root + ".#{m}").directory? }.to_sym
88 | end
89 |
90 | #
91 | def files
92 | return [] unless root
93 | @files ||= \
94 | if manifest
95 | File.readlines(manifest).
96 | map{ |line| line.strip }.
97 | reject{ |line| line.empty? || line[0,1] == '#' }
98 | else
99 | list = []
100 | Dir.chdir(root) do
101 | FILES.split(/\s+/).each do |pattern|
102 | list.concat(glob(pattern))
103 | end
104 | OMIT.split(/\s+/).each do |pattern|
105 | list = list - glob(pattern)
106 | end
107 | end
108 | list
109 | end.select{ |path| File.file?(path) }.uniq
110 | end
111 |
112 | #
113 | def glob_files(pattern)
114 | return [] unless root
115 | Dir.chdir(root) do
116 | Dir.glob(pattern).select do |path|
117 | File.file?(path) && files.include?(path)
118 | end
119 | end
120 | end
121 |
122 | def patterns
123 | PATTERNS
124 | end
125 |
126 | def executables
127 | @executables ||= \
128 | glob_files(patterns[:bin]).map do |path|
129 | File.basename(path)
130 | end
131 | end
132 |
133 | def extensions
134 | @extensions ||= \
135 | glob_files(patterns[:ext]).map do |path|
136 | File.basename(path)
137 | end
138 | end
139 |
140 | def name
141 | metadata['name'] || metadata['title'].downcase.gsub(/\W+/,'_')
142 | end
143 |
144 | def homepage
145 | page = (
146 | metadata['resources'].find{ |r| r['type'] =~ /^home/i } ||
147 | metadata['resources'].find{ |r| r['name'] =~ /^home/i } ||
148 | metadata['resources'].find{ |r| r['name'] =~ /^web/i }
149 | )
150 | page ? page['uri'] : false
151 | end
152 |
153 | def licenses
154 | metadata['copyrights'].map{ |c| c['license'] }.compact
155 | end
156 |
157 | def require_paths
158 | paths = metadata['paths'] || {}
159 | paths['load'] || ['lib']
160 | end
161 |
162 | #
163 | # Convert to gemnspec.
164 | #
165 | def to_gemspec
166 | if has_root?
167 | Gem::Specification.new do |gemspec|
168 | to_gemspec_data(gemspec)
169 | to_gemspec_paths(gemspec)
170 | end
171 | else
172 | Gem::Specification.new do |gemspec|
173 | to_gemspec_data(gemspec)
174 | to_gemspec_paths(gemspec)
175 | end
176 | end
177 | end
178 |
179 | #
180 | # Convert pure data settings.
181 | #
182 | def to_gemspec_data(gemspec)
183 | gemspec.name = name
184 | gemspec.version = metadata['version']
185 | gemspec.summary = metadata['summary']
186 | gemspec.description = metadata['description']
187 |
188 | metadata['authors'].each do |author|
189 | gemspec.authors << author['name']
190 |
191 | if author.has_key?('email')
192 | if gemspec.email
193 | gemspec.email << author['email']
194 | else
195 | gemspec.email = [author['email']]
196 | end
197 | end
198 | end
199 |
200 | gemspec.licenses = licenses
201 |
202 | requirements = metadata['requirements'] || []
203 | requirements.each do |req|
204 | next if req['optional']
205 | next if req['external']
206 |
207 | name = req['name']
208 | groups = req['groups'] || []
209 |
210 | version = gemify_version(req['version'])
211 |
212 | if groups.empty? or groups.include?('runtime')
213 | # populate runtime dependencies
214 | if gemspec.respond_to?(:add_runtime_dependency)
215 | gemspec.add_runtime_dependency(name,*version)
216 | else
217 | gemspec.add_dependency(name,*version)
218 | end
219 | else
220 | # populate development dependencies
221 | if gemspec.respond_to?(:add_development_dependency)
222 | gemspec.add_development_dependency(name,*version)
223 | else
224 | gemspec.add_dependency(name,*version)
225 | end
226 | end
227 | end
228 |
229 | # convert external dependencies into gemspec requirements
230 | requirements.each do |req|
231 | next unless req['external']
232 | gemspec.requirements << ("%s-%s" % req.values_at('name', 'version'))
233 | end
234 |
235 | gemspec.homepage = homepage
236 | gemspec.require_paths = require_paths
237 | gemspec.post_install_message = metadata['install_message']
238 | end
239 |
240 | #
241 | # Set gemspec settings that require a root directory path.
242 | #
243 | def to_gemspec_paths(gemspec)
244 | gemspec.files = files
245 | gemspec.extensions = extensions
246 | gemspec.executables = executables
247 |
248 | if Gem::VERSION < '1.7.'
249 | gemspec.default_executable = gemspec.executables.first
250 | end
251 |
252 | gemspec.test_files = glob_files(patterns[:test])
253 |
254 | unless gemspec.files.include?('.document')
255 | gemspec.extra_rdoc_files = glob_files(patterns[:doc])
256 | end
257 | end
258 |
259 | #
260 | # Return a copy of this file. This is used to generate a local
261 | # .gemspec file that can automatically read the index file.
262 | #
263 | def self.source_code
264 | File.read(__FILE__)
265 | end
266 |
267 | private
268 |
269 | def find_root
270 | root_files = patterns[:root]
271 | if Dir.glob(root_files).first
272 | Pathname.new(Dir.pwd)
273 | elsif Dir.glob("../#{root_files}").first
274 | Pathname.new(Dir.pwd).parent
275 | else
276 | #raise "Can't find root of project containing `#{root_files}'."
277 | warn "Can't find root of project containing `#{root_files}'."
278 | nil
279 | end
280 | end
281 |
282 | def glob(pattern)
283 | if File.directory?(pattern)
284 | Dir.glob(File.join(pattern, '**', '*'))
285 | else
286 | Dir.glob(pattern)
287 | end
288 | end
289 |
290 | def gemify_version(version)
291 | case version
292 | when /^(.*?)\+$/
293 | ">= #{$1}"
294 | when /^(.*?)\-$/
295 | "< #{$1}"
296 | when /^(.*?)\~$/
297 | "~> #{$1}"
298 | else
299 | version
300 | end
301 | end
302 |
303 | end
304 |
305 | end
306 |
307 | Indexer::GemspecExporter.gemspec
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/highlight.js:
--------------------------------------------------------------------------------
1 | var hljs=new function(){var p={};var a={};function n(c){return c.replace(/&/gm,"&").replace(//gm,">")}function k(s,r){if(!s){return false}for(var c=0;c'+n(N[0])+""}else{Q+=n(N[0])}T=S.lR.lastIndex;N=S.lR.exec(P)}Q+=n(P.substr(T,P.length-T));return Q}function M(r,O){if(O.subLanguage&&a[O.subLanguage]){var N=g(O.subLanguage,r);u+=N.keyword_count;C+=N.r;return N.value}else{return G(r,O)}}function J(O,r){var N=O.nM?"":'';if(O.rB){c+=N;O.buffer=""}else{if(O.eB){c+=n(r)+N;O.buffer=""}else{c+=N;O.buffer=r}}D[D.length]=O}function F(R,N,S){var T=D[D.length-1];if(S){c+=M(T.buffer+R,T);return false}var O=A(N,T);if(O){c+=M(T.buffer+R,T);J(O,N);C+=O.r;return O.rB}var r=x(D.length-1,N);if(r){var Q=T.nM?"":"";if(T.rE){c+=M(T.buffer+R,T)+Q}else{if(T.eE){c+=M(T.buffer+R,T)+Q+n(N)}else{c+=M(T.buffer+R+N,T)+Q}}while(r>1){Q=D[D.length-2].nM?"":"";c+=Q;r--;D.length--}D.length--;D[D.length-1].buffer="";if(T.starts){for(var P=0;P1){throw"Illegal"}return{r:C,keyword_count:u,value:c}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:n(E)}}else{throw H}}}function h(s){var r="";for(var c=0;c"}function B(C){return""+C.nodeName.toLowerCase()+">"}while(z.length||A.length){var w=v().splice(0,1)[0];x+=n(y.substr(s,w.offset-s));s=w.offset;if(w.event=="start"){x+=t(w.node);u.push(w.node)}else{if(w.event=="stop"){var r=u.length;do{r--;var c=u[r];x+=B(c)}while(c!=w.node);u.splice(r,1);while(rD){D=c;var B=t.value;v=E}}}if(B){if(C){B=B.replace(/^(\t+)/gm,function(r,I,H,G){return I.replace(/\t/g,C)})}var x=y.className;if(!x.match(v)){x+=" "+v}var s=d(y);if(s.length){var u=document.createElement("pre");u.innerHTML=B;B=m(s,d(u),F)}var A=document.createElement("div");A.innerHTML=''+B+"
";var w=y.parentNode.parentNode;w.replaceChild(A.firstChild,y.parentNode)}}function e(s,r,c){var t="m"+(s.cI?"i":"")+(c?"g":"");return new RegExp(r,t)}function j(){for(var r in p){if(!p.hasOwnProperty(r)){continue}var s=p[r];for(var c=0;c|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:["escape"],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:["escape"],r:0};this.BE={cN:"escape",b:"\\\\.",e:"^",nM:true,r:0};this.CLCM={cN:"comment",b:"//",e:"$",r:0};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.CNM={cN:"number",b:this.CNR,e:"^",r:0}}();var initHighlightingOnLoad=hljs.initHighlightingOnLoad;hljs.LANGUAGES.cs={dM:{l:[hljs.UIR],c:["comment","string","number"],k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1}},m:[{cN:"comment",b:"///",e:"$",rB:true,c:["xmlDocTag"]},{cN:"xmlDocTag",b:"///|",e:"^"},{cN:"xmlDocTag",b:"?",e:">"},{cN:"string",b:'@"',e:'"',c:["quoteQuote"]},{cN:"quoteQuote",b:'""',e:"^"},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,hljs.BE,hljs.CNM]};hljs.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1}};return{dM:{l:[hljs.UIR],i:"",c:["comment","string","number","preprocessor","stl_container"],k:a},m:[hljs.CLCM,hljs.CBLCLM,hljs.CNM,hljs.QSM,hljs.BE,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"preprocessor",b:"#",e:"$"},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap)\\s*<",e:">",c:["stl_container"],l:[hljs.UIR],k:a,r:10}]}}();hljs.LANGUAGES.diff={cI:true,dM:{c:["chunk","header","addition","deletion","change"]},m:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",e:"^",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",e:"^",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",e:"^",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]};hljs.XML_COMMENT={cN:"comment",b:""};hljs.XML_ATTR={cN:"attribute",b:"\\s[a-zA-Z\\:-]+=",e:"^",c:["value"]};hljs.XML_VALUE_QUOT={cN:"value",b:'"',e:'"'};hljs.XML_VALUE_APOS={cN:"value",b:"'",e:"'"};hljs.LANGUAGES.xml={dM:{c:["pi","comment","cdata","tag"]},cI:true,m:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},hljs.XML_COMMENT,{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>"},{cN:"tag",b:"?",e:">",c:["title","tag_internal"],r:1.5},{cN:"title",b:"[A-Za-z:_][A-Za-z0-9\\._:-]+",e:"^",r:0},{cN:"tag_internal",b:"^",eW:true,nM:true,c:["attribute"],r:0,i:"[\\+\\.]"},hljs.XML_ATTR,hljs.XML_VALUE_QUOT,hljs.XML_VALUE_APOS]};hljs.HTML_TAGS={code:1,kbd:1,font:1,noscript:1,style:1,img:1,title:1,menu:1,tt:1,tr:1,param:1,li:1,tfoot:1,th:1,input:1,td:1,dl:1,blockquote:1,fieldset:1,big:1,dd:1,abbr:1,optgroup:1,dt:1,button:1,isindex:1,p:1,small:1,div:1,dir:1,em:1,frame:1,meta:1,sub:1,bdo:1,label:1,acronym:1,sup:1,body:1,xml:1,basefont:1,base:1,br:1,address:1,strong:1,legend:1,ol:1,script:1,caption:1,s:1,col:1,h2:1,h3:1,h1:1,h6:1,h4:1,h5:1,table:1,select:1,noframes:1,span:1,area:1,dfn:1,strike:1,cite:1,thead:1,head:1,option:1,form:1,hr:1,"var":1,link:1,b:1,colgroup:1,ul:1,applet:1,del:1,iframe:1,pre:1,frameset:1,ins:1,tbody:1,html:1,samp:1,map:1,object:1,a:1,xmlns:1,center:1,textarea:1,i:1,q:1,u:1};hljs.HTML_DOCTYPE={cN:"doctype",b:"",r:10};hljs.HTML_ATTR={cN:"attribute",b:"\\s[a-zA-Z\\:-]+=",e:"^",c:["value"]};hljs.HTML_SHORT_ATTR={cN:"attribute",b:" [a-zA-Z]+",e:"^"};hljs.HTML_VALUE={cN:"value",b:"[a-zA-Z0-9]+",e:"^"};hljs.LANGUAGES.html={dM:{c:["tag","comment","doctype","vbscript"]},cI:true,m:[hljs.XML_COMMENT,hljs.HTML_DOCTYPE,{cN:"tag",l:[hljs.IR],k:hljs.HTML_TAGS,b:"",rE:true,subLanguage:"css"},{cN:"javascript",e:"<\/script>",rE:true,subLanguage:"javascript"},hljs.HTML_ATTR,hljs.HTML_SHORT_ATTR,hljs.XML_VALUE_QUOT,hljs.XML_VALUE_APOS,hljs.HTML_VALUE,{cN:"vbscript",b:"<%",e:"%>",subLanguage:"vbscript"}]};hljs.LANGUAGES.css={dM:{c:["at_rule","id","class","attr_selector","pseudo","rules","comment"],k:hljs.HTML_TAGS,l:[hljs.IR],i:"="},cI:true,m:[{cN:"at_rule",b:"@",e:"[{;]",eE:true,l:[hljs.IR],k:{"import":1,page:1,media:1,charset:1,"font-face":1},c:["function","string","number","pseudo"]},{cN:"id",b:"\\#[A-Za-z0-9_-]+",e:"^"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",e:"^",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+",e:"^"},{cN:"rules",b:"{",e:"}",c:["rule","comment"],i:"[^\\s]"},{cN:"rule",b:"[A-Z\\_\\.\\-]+\\s*:",e:";",eW:true,l:["[A-Za-z-]+"],k:{"play-during":1,"counter-reset":1,"counter-increment":1,"min-height":1,quotes:1,"border-top":1,pitch:1,font:1,pause:1,"list-style-image":1,"border-width":1,cue:1,"outline-width":1,"border-left":1,elevation:1,richness:1,"speech-rate":1,"border-bottom":1,"border-spacing":1,background:1,"list-style-type":1,"text-align":1,"page-break-inside":1,orphans:1,"page-break-before":1,"text-transform":1,"line-height":1,"padding-left":1,"font-size":1,right:1,"word-spacing":1,"padding-top":1,"outline-style":1,bottom:1,content:1,"border-right-style":1,"padding-right":1,"border-left-style":1,"voice-family":1,"background-color":1,"border-bottom-color":1,"outline-color":1,"unicode-bidi":1,"max-width":1,"font-family":1,"caption-side":1,"border-right-width":1,"pause-before":1,"border-top-style":1,color:1,"border-collapse":1,"border-bottom-width":1,"float":1,height:1,"max-height":1,"margin-right":1,"border-top-width":1,speak:1,"speak-header":1,top:1,"cue-before":1,"min-width":1,width:1,"font-variant":1,"border-top-color":1,"background-position":1,"empty-cells":1,direction:1,"border-right":1,visibility:1,padding:1,"border-style":1,"background-attachment":1,overflow:1,"border-bottom-style":1,cursor:1,margin:1,display:1,"border-left-width":1,"letter-spacing":1,"vertical-align":1,clip:1,"border-color":1,"list-style":1,"padding-bottom":1,"pause-after":1,"speak-numeral":1,"margin-left":1,widows:1,border:1,"font-style":1,"border-left-color":1,"pitch-range":1,"background-repeat":1,"table-layout":1,"margin-bottom":1,"speak-punctuation":1,"font-weight":1,"border-right-color":1,"page-break-after":1,position:1,"white-space":1,"text-indent":1,"background-image":1,volume:1,stress:1,outline:1,clear:1,"z-index":1,"text-decoration":1,"margin-top":1,azimuth:1,"cue-after":1,left:1,"list-style-position":1},c:["value"]},hljs.CBLCLM,{cN:"value",b:"^",eW:true,eE:true,c:["function","number","hexcolor","string"]},{cN:"number",b:hljs.NR,e:"^"},{cN:"hexcolor",b:"\\#[0-9A-F]+",e:"^"},{cN:"function",b:hljs.IR+"\\(",e:"\\)",c:["params"]},{cN:"params",b:"^",eW:true,eE:true,c:["number","string"]},hljs.ASM,hljs.QSM]};hljs.LANGUAGES.ini={cI:true,dM:{c:["comment","title","setting"],i:"[^\\s]"},m:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9_\\[\\]]+[ \\t]*=[ \\t]*",e:"$",c:["value"]},{cN:"value",b:"^",eW:true,c:["string","number"],l:[hljs.IR],k:{on:1,off:1,"true":1,"false":1,yes:1,no:1}},hljs.QSM,hljs.BE,{cN:"number",b:"\\d+",e:"^"}]};hljs.LANGUAGES.javascript={dM:{l:[hljs.UIR],c:["string","comment","number","regexp_container","function"],k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}}},m:[hljs.CLCM,hljs.CBLCLM,hljs.CNM,hljs.ASM,hljs.QSM,hljs.BE,{cN:"regexp_container",b:"("+hljs.RSR+"|case|return|throw)\\s*",e:"^",nM:true,l:[hljs.IR],k:{"return":1,"throw":1,"case":1},c:["comment","regexp"],r:0},{cN:"regexp",b:"/.*?[^\\\\/]/[gim]*",e:"^"},{cN:"function",b:"\\bfunction\\b",e:"{",l:[hljs.UIR],k:{"function":1},c:["title","params"]},{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*",e:"^"},{cN:"params",b:"\\(",e:"\\)",c:["string","comment"]}]};hljs.LANGUAGES.ruby=function(){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var b=["comment","string","char","class","function","module_name","symbol","number","variable","regexp_container"];var c={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};return{dM:{l:[a],c:b,k:c},m:[hljs.HCM,{cN:"comment",b:"^\\=begin",e:"^\\=end",r:10},{cN:"comment",b:"^__END__",e:"\\n$"},{cN:"params",b:"\\(",e:"\\)",l:[a],k:c,c:b},{cN:"function",b:"\\bdef\\b",e:"$|;",l:[a],k:c,c:["title","params","comment"]},{cN:"class",b:"\\b(class|module)\\b",e:"$",l:[hljs.UIR],k:c,c:["title","inheritance","comment"],k:{"class":1,module:1}},{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",e:"^",r:0},{cN:"inheritance",b:"<\\s*",e:"^",c:["parent"]},{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR,e:"^"},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",e:"^",r:0},{cN:"number",b:"\\?\\w",e:"^"},{cN:"string",b:"'",e:"'",c:["escape","subst"],r:0},{cN:"string",b:'"',e:'"',c:["escape","subst"],r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?{",e:"}",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?<",e:">",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?/",e:"/",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?%",e:"%",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?-",e:"-",c:["escape","subst"],r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:["escape","subst"],r:10},{cN:"module_name",b:":{2}"+a,e:"^",nM:true},{cN:"symbol",b:":"+a,e:"^"},{cN:"symbol",b:":",e:"^",c:["string"]},hljs.BE,{cN:"subst",b:"#\\{",e:"}",l:[a],k:c,c:b},{cN:"regexp_container",b:"("+hljs.RSR+")\\s*",e:"^",nM:true,c:["comment","regexp"],r:0},{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:["escape"]},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))",e:"^"}]}}();hljs.LANGUAGES.sql={cI:true,dM:{l:[hljs.IR],c:["string","number","comment"],k:{keyword:{all:1,partial:1,global:1,month:1,current_timestamp:1,using:1,go:1,revoke:1,smallint:1,indicator:1,"end-exec":1,disconnect:1,zone:1,"with":1,character:1,assertion:1,to:1,add:1,current_user:1,usage:1,input:1,local:1,alter:1,match:1,collate:1,real:1,then:1,rollback:1,get:1,read:1,timestamp:1,session_user:1,not:1,integer:1,bit:1,unique:1,day:1,minute:1,desc:1,insert:1,execute:1,like:1,ilike:2,level:1,decimal:1,drop:1,"continue":1,isolation:1,found:1,where:1,constraints:1,domain:1,right:1,national:1,some:1,module:1,transaction:1,relative:1,second:1,connect:1,escape:1,close:1,system_user:1,"for":1,deferred:1,section:1,cast:1,current:1,sqlstate:1,allocate:1,intersect:1,deallocate:1,numeric:1,"public":1,preserve:1,full:1,"goto":1,initially:1,asc:1,no:1,key:1,output:1,collation:1,group:1,by:1,union:1,session:1,both:1,last:1,language:1,constraint:1,column:1,of:1,space:1,foreign:1,deferrable:1,prior:1,connection:1,unknown:1,action:1,commit:1,view:1,or:1,first:1,into:1,"float":1,year:1,primary:1,cascaded:1,except:1,restrict:1,set:1,references:1,names:1,table:1,outer:1,open:1,select:1,size:1,are:1,rows:1,from:1,prepare:1,distinct:1,leading:1,create:1,only:1,next:1,inner:1,authorization:1,schema:1,corresponding:1,option:1,declare:1,precision:1,immediate:1,"else":1,timezone_minute:1,external:1,varying:1,translation:1,"true":1,"case":1,exception:1,join:1,hour:1,"default":1,"double":1,scroll:1,value:1,cursor:1,descriptor:1,values:1,dec:1,fetch:1,procedure:1,"delete":1,and:1,"false":1,"int":1,is:1,describe:1,"char":1,as:1,at:1,"in":1,varchar:1,"null":1,trailing:1,any:1,absolute:1,current_time:1,end:1,grant:1,privileges:1,when:1,cross:1,check:1,write:1,current_date:1,pad:1,begin:1,temporary:1,exec:1,time:1,update:1,catalog:1,user:1,sql:1,date:1,on:1,identity:1,timezone_hour:1,natural:1,whenever:1,interval:1,work:1,order:1,cascade:1,diagnostics:1,nchar:1,having:1,left:1},aggregate:{count:1,sum:1,min:1,max:1,avg:1}}},m:[hljs.CNM,hljs.CBLCLM,{cN:"comment",b:"--",e:"$"},{cN:"string",b:"'",e:"'",c:["escape","squote"],r:0},{cN:"squote",b:"''",e:"^",nM:true},{cN:"string",b:'"',e:'"',c:["escape","dquote"],r:0},{cN:"dquote",b:'""',e:"^",nM:true},{cN:"string",b:"`",e:"`",c:["escape"]},hljs.BE]};hljs.LANGUAGES.java={dM:{l:[hljs.UIR],c:["javadoc","comment","string","class","number","annotation"],k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1}},m:[{cN:"class",l:[hljs.UIR],b:"(class |interface )",e:"{",i:":",k:{"class":1,"interface":1},c:["inheritance","title"]},{cN:"inheritance",b:"(implements|extends)",e:"^",nM:true,l:[hljs.IR],k:{"extends":1,"implements":1},r:10},{cN:"title",b:hljs.UIR,e:"^"},{cN:"params",b:"\\(",e:"\\)",c:["string","annotation"]},hljs.CNM,hljs.ASM,hljs.QSM,hljs.BE,hljs.CLCM,{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:["javadoctag"],r:10},{cN:"javadoctag",b:"@[A-Za-z]+",e:"^"},hljs.CBLCLM,{cN:"annotation",b:"@[A-Za-z]+",e:"^"}]};hljs.LANGUAGES.bash=function(){var a={"true":1,"false":1};return{dM:{l:[hljs.IR],c:["string","shebang","comment","number","test_condition","string","variable"],k:{keyword:{"if":1,then:1,"else":1,fi:1,"for":1,"break":1,"continue":1,"while":1,"in":1,"do":1,done:1,echo:1,exit:1,"return":1,set:1,declare:1},literal:a}},cI:false,m:[{cN:"shebang",b:"(#!\\/bin\\/bash)|(#!\\/bin\\/sh)",e:"^",r:10},hljs.HCM,{cN:"test_condition",b:"\\[ ",e:" \\]",c:["string","variable","number"],l:[hljs.IR],k:{literal:a},r:0},{cN:"test_condition",b:"\\[\\[ ",e:" \\]\\]",c:["string","variable","number"],l:[hljs.IR],k:{literal:a}},{cN:"variable",b:"\\$([a-zA-Z0-9_]+)\\b",e:"^"},{cN:"variable",b:"\\$\\{(([^}])|(\\\\}))+\\}",e:"^",c:["number"]},{cN:"string",b:'"',e:'"',i:"\\n",c:["escape","variable"],r:0},{cN:"string",b:'"',e:'"',i:"\\n",c:["escape","variable"],r:0},hljs.BE,hljs.CNM,{cN:"comment",b:"\\/\\/",e:"$",i:"."}]}}();
--------------------------------------------------------------------------------
/work/deprecated/plugins/sow/brite/awesome/assets/jquery.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery JavaScript Library v1.3.2
3 | * http://jquery.com/
4 | *
5 | * Copyright (c) 2009 John Resig
6 | * Dual licensed under the MIT and GPL licenses.
7 | * http://docs.jquery.com/License
8 | *
9 | * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
10 | * Revision: 6246
11 | */
12 | (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,""]||!O.indexOf("
",""]||(!O.indexOf(" | ","
"]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
13 | /*
14 | * Sizzle CSS Selector Engine - v0.9.3
15 | * Copyright 2009, The Dojo Foundation
16 | * Released under the MIT, BSD, and GPL Licenses.
17 | * More information: http://sizzlejs.com/
18 | */
19 | (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(Fa';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("").append(M.responseText.replace(/