webby 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -0
- data/Manifest.txt +5 -1
- data/Rakefile +19 -7
- data/data/tasks/deploy.rake +3 -3
- data/data/tasks/growl.rake +1 -1
- data/data/tasks/heel.rake +2 -2
- data/data/tasks/setup.rb +0 -19
- data/data/tasks/validate.rake +19 -0
- data/examples/webby/Rakefile +3 -0
- data/examples/webby/content/css/site.css +7 -0
- data/examples/webby/content/index.txt +4 -3
- data/examples/webby/content/manual/index.txt +25 -17
- data/examples/webby/content/reference/index.txt +57 -0
- data/examples/webby/content/tips_and_tricks/index.txt +56 -14
- data/examples/webby/content/tutorial/index.txt +6 -5
- data/examples/webby/layouts/default.rhtml +2 -2
- data/examples/webby/tasks/deploy.rake +3 -3
- data/examples/webby/tasks/growl.rake +1 -1
- data/examples/webby/tasks/heel.rake +2 -2
- data/examples/webby/tasks/validate.rake +19 -0
- data/lib/webby/builder.rb +1 -23
- data/lib/webby/filters/outline.rb +2 -6
- data/lib/webby/filters/tidy.rb +1 -5
- data/lib/webby/helpers/coderay_helper.rb +6 -4
- data/lib/webby/helpers/graphviz_helper.rb +6 -15
- data/lib/webby/helpers/tex_img_helper.rb +31 -64
- data/lib/webby/helpers/ultraviolet_helper.rb +74 -0
- data/lib/webby/helpers/url_helper.rb +8 -5
- data/lib/webby/link_validator.rb +154 -0
- data/lib/webby/renderer.rb +51 -40
- data/lib/webby/resources/page.rb +2 -2
- data/lib/webby/stelan/paginator.rb +4 -3
- data/lib/webby/webby_task.rb +7 -7
- data/lib/webby.rb +38 -6
- metadata +7 -3
- data/examples/webby/content/download.txt +0 -14
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== 0.8.1 / 2008-03-09
|
2
|
+
|
3
|
+
* 2 major enhancement
|
4
|
+
- Added support for UltraViolet syntax highlighting
|
5
|
+
(code provided by Guillaume Carbonneau)
|
6
|
+
- Added rake tasks to validate the hyperlinks for the HTML files
|
7
|
+
in the output directory
|
8
|
+
* 2 minor enhancements
|
9
|
+
- Improved error handling and reporting during the build process
|
10
|
+
- Added site defaults for the helpers (coderay, graphviv, latex,
|
11
|
+
etc.)
|
12
|
+
* 1 bug fix
|
13
|
+
- Fixed an error with the prev / next calls in the paginator and
|
14
|
+
rendering links to those pages
|
15
|
+
|
1
16
|
== 0.8.0 / 2008-02-28
|
2
17
|
|
3
18
|
* 3 major enhancements
|
data/Manifest.txt
CHANGED
@@ -36,6 +36,7 @@ data/tasks/deploy.rake
|
|
36
36
|
data/tasks/growl.rake
|
37
37
|
data/tasks/heel.rake
|
38
38
|
data/tasks/setup.rb
|
39
|
+
data/tasks/validate.rake
|
39
40
|
data/templates/_partial.erb
|
40
41
|
data/templates/atom_feed.erb
|
41
42
|
data/templates/page.erb
|
@@ -44,9 +45,9 @@ examples/webby/content/css/blueprint/print.css
|
|
44
45
|
examples/webby/content/css/blueprint/screen.css
|
45
46
|
examples/webby/content/css/coderay.css
|
46
47
|
examples/webby/content/css/site.css
|
47
|
-
examples/webby/content/download.txt
|
48
48
|
examples/webby/content/index.txt
|
49
49
|
examples/webby/content/manual/index.txt
|
50
|
+
examples/webby/content/reference/index.txt
|
50
51
|
examples/webby/content/robots.txt
|
51
52
|
examples/webby/content/script/jquery.corner.js
|
52
53
|
examples/webby/content/script/jquery.js
|
@@ -58,6 +59,7 @@ examples/webby/tasks/deploy.rake
|
|
58
59
|
examples/webby/tasks/growl.rake
|
59
60
|
examples/webby/tasks/heel.rake
|
60
61
|
examples/webby/tasks/setup.rb
|
62
|
+
examples/webby/tasks/validate.rake
|
61
63
|
examples/webby/templates/page.erb
|
62
64
|
lib/webby.rb
|
63
65
|
lib/webby/auto_builder.rb
|
@@ -76,7 +78,9 @@ lib/webby/helpers/coderay_helper.rb
|
|
76
78
|
lib/webby/helpers/graphviz_helper.rb
|
77
79
|
lib/webby/helpers/tag_helper.rb
|
78
80
|
lib/webby/helpers/tex_img_helper.rb
|
81
|
+
lib/webby/helpers/ultraviolet_helper.rb
|
79
82
|
lib/webby/helpers/url_helper.rb
|
83
|
+
lib/webby/link_validator.rb
|
80
84
|
lib/webby/main.rb
|
81
85
|
lib/webby/renderer.rb
|
82
86
|
lib/webby/resources.rb
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: Rakefile
|
1
|
+
# $Id: Rakefile 196 2008-03-09 23:03:30Z tim_pease $
|
2
2
|
|
3
3
|
load 'tasks/setup.rb'
|
4
4
|
|
@@ -17,17 +17,29 @@ PROJ.rubyforge_name = 'webby'
|
|
17
17
|
PROJ.rdoc_dir = 'doc/rdoc'
|
18
18
|
PROJ.rdoc_remote_dir = 'rdoc'
|
19
19
|
PROJ.version = Webby::VERSION
|
20
|
+
PROJ.release_name = 'Wandering Wookie'
|
20
21
|
|
21
|
-
PROJ.exclude <<
|
22
|
-
PROJ.
|
23
|
-
PROJ.exclude << '^tags$'
|
24
|
-
|
25
|
-
PROJ.rdoc_exclude << '^data'
|
26
|
-
PROJ.rdoc_exclude << '^examples'
|
22
|
+
PROJ.exclude << %w(^examples/[^/]+/output ^tasks/archive ^tags$)
|
23
|
+
PROJ.rdoc_exclude << %w(^data ^examples)
|
27
24
|
|
28
25
|
PROJ.svn = true
|
29
26
|
PROJ.spec_opts << '--color'
|
30
27
|
|
28
|
+
PROJ.ann_email[:to] << 'webby-forum@googlegroups.com'
|
29
|
+
PROJ.ann_email[:server] = 'smtp.gmail.com'
|
30
|
+
PROJ.ann_email[:port] = 587
|
31
|
+
|
32
|
+
PROJ.ann_text = <<-ANN
|
33
|
+
== FUN FACT
|
34
|
+
|
35
|
+
A Boeing 747's wingspan is longer than the Wright brothers first flight.
|
36
|
+
|
37
|
+
== POST SCRIPT
|
38
|
+
|
39
|
+
Blessings,
|
40
|
+
TwP
|
41
|
+
ANN
|
42
|
+
|
31
43
|
depend_on 'directory_watcher'
|
32
44
|
depend_on 'heel'
|
33
45
|
depend_on 'hpricot'
|
data/data/tasks/deploy.rake
CHANGED
@@ -3,15 +3,15 @@ require 'rake/contrib/sshpublisher'
|
|
3
3
|
|
4
4
|
namespace :deploy do
|
5
5
|
|
6
|
-
desc '
|
6
|
+
desc 'Deploy to the server using rsync'
|
7
7
|
task :rsync do
|
8
8
|
cmd = "rsync #{SITE.rsync_args.join(' ')} "
|
9
9
|
cmd << "#{SITE.output_dir}/ #{SITE.host}:#{SITE.remote_dir}"
|
10
10
|
sh cmd
|
11
11
|
end
|
12
12
|
|
13
|
-
desc '
|
14
|
-
task
|
13
|
+
desc 'Deploy to the server using ssh'
|
14
|
+
task :ssh do
|
15
15
|
Rake::SshDirPublisher.new(
|
16
16
|
SITE.host, SITE.remote_dir, SITE.output_dir
|
17
17
|
).upload
|
data/data/tasks/growl.rake
CHANGED
data/data/tasks/heel.rake
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
namespace :heel do
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'Start the heel server to view website (not for Windows)'
|
5
5
|
task :start do
|
6
6
|
sh "heel --root #{SITE.output_dir} --port #{SITE.heel_port} --daemonize"
|
7
7
|
end
|
8
8
|
|
9
|
-
desc '
|
9
|
+
desc 'Stop the heel server'
|
10
10
|
task :stop do
|
11
11
|
sh "heel --kill"
|
12
12
|
end
|
data/data/tasks/setup.rb
CHANGED
@@ -8,25 +8,6 @@ end
|
|
8
8
|
|
9
9
|
SITE = Webby.site
|
10
10
|
|
11
|
-
# Webby defaults
|
12
|
-
SITE.content_dir = 'content'
|
13
|
-
SITE.output_dir = 'output'
|
14
|
-
SITE.layout_dir = 'layouts'
|
15
|
-
SITE.template_dir = 'templates'
|
16
|
-
SITE.exclude = %w[tmp$ bak$ ~$ CVS \.svn]
|
17
|
-
|
18
|
-
SITE.page_defaults = {
|
19
|
-
'layout' => 'default'
|
20
|
-
}
|
21
|
-
|
22
|
-
# Items used to deploy the webiste
|
23
|
-
SITE.host = 'user@hostname.tld'
|
24
|
-
SITE.remote_dir = '/not/a/valid/dir'
|
25
|
-
SITE.rsync_args = %w(-av --delete)
|
26
|
-
|
27
|
-
# Options passed to the 'tidy' program when the tidy filter is used
|
28
|
-
SITE.tidy_options = '-indent -wrap 80'
|
29
|
-
|
30
11
|
# Load the other rake files in the tasks folder
|
31
12
|
Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
|
32
13
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
namespace :validate do
|
3
|
+
|
4
|
+
desc 'Validate hyperlinks (exclude exteranl sites)'
|
5
|
+
task :internal => :build do
|
6
|
+
Webby::LinkValidator.validate(:external => false)
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Validate hyperlinks (include external sites)'
|
10
|
+
task :external => :build do
|
11
|
+
Webby::LinkValidator.validate(:external => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
end # validate
|
15
|
+
|
16
|
+
desc 'Alias to validate:internal'
|
17
|
+
task :validate => 'validate:internal'
|
18
|
+
|
19
|
+
# EOF
|
data/examples/webby/Rakefile
CHANGED
@@ -15,9 +15,10 @@ sudo gem install -y webby
|
|
15
15
|
|
16
16
|
h2. Features
|
17
17
|
|
18
|
-
* choose your templating language: *
|
19
|
-
* support for "CodeRay":http://coderay.rubychan.de/ syntax highlighting
|
18
|
+
* choose your templating language: *ERB*, *Textile*, *Markdown*, *HAML*, *SASS*
|
19
|
+
* support for "UltraViolet":http://ultraviolet.rubyforge.org/ and "CodeRay":http://coderay.rubychan.de/ syntax highlighting
|
20
20
|
* embeddable DOT scripts for "Graphviz":http://www.graphviz.org/ graphs
|
21
|
+
* "LaTeX":http://www.latex-project.org/ snippets for mathematical formulas
|
21
22
|
* automatically clean up generated content using "Tidy":http://tidy.sourceforge.net/
|
22
23
|
* quick and speedy - only builds pages that have changed
|
23
24
|
* deploy anywhere - it's just HTML, no special server stuff required
|
@@ -38,4 +39,4 @@ heel --root output --daemonize
|
|
38
39
|
|
39
40
|
Webby is not limited to producing HTML. By no means! Do you ever get tired of repeating the same color code *#D3C4A2* in your CSS files? Webby can help. Need some customized JavaScript for your website. Webby can help. Anytime you find yourself repeating the same bit of text over and over, then you should be using Webby.
|
40
41
|
|
41
|
-
Read the "tutorial"
|
42
|
+
Read the "tutorial":/tutorial section for a quick introduction to Webby, and enjoy the wonders of *ASCII Alchemy*.
|
@@ -13,7 +13,7 @@ p(title). Table of Contents
|
|
13
13
|
<toc />
|
14
14
|
</div>
|
15
15
|
|
16
|
-
h2
|
16
|
+
h2. Introduction
|
17
17
|
|
18
18
|
Webby was created out of the need for a simple way to build and manage small websites. The desire was for a system that could take files written in plain text, combine them with a layout file and produce web pages. In this system, a single page can be written quickly without the need for HTML markup; the look and feel of the entire site can be changed by modifying the site layout file.
|
19
19
|
|
@@ -41,16 +41,16 @@ The diagram above shows the basic concept of how Webby works. Changing the layou
|
|
41
41
|
|
42
42
|
Webby does not limit the output to HTML. Webby can be used to generate XML files for RSS or Atom news feeds, CSS files for styling web pages, or any other type of text file that you can think of.
|
43
43
|
|
44
|
-
h3
|
44
|
+
h3. Requirements
|
45
45
|
|
46
46
|
Webby is written in the Ruby programming language. To install and run Webby you will need the following applications installed on your system:
|
47
47
|
|
48
48
|
* "Ruby":http://ruby-lang.org
|
49
49
|
* "RubyGems":http://rubygems.org/read/chapter/3
|
50
50
|
|
51
|
-
h3
|
51
|
+
h3. Installation
|
52
52
|
|
53
|
-
Webby is easily installed as a Ruby gem. From a command prompt
|
53
|
+
Webby is easily installed as a Ruby gem. From a command prompt type in the following:
|
54
54
|
|
55
55
|
<pre>
|
56
56
|
sudo gem install -y webby
|
@@ -63,16 +63,18 @@ bq. For those users installing Webby on the Windows platform, please omit the @s
|
|
63
63
|
To make use of all the features Webby has to offer, the following gems should also be installed. These gems provide different ways to transform text into HTML or CSS.
|
64
64
|
|
65
65
|
<pre>
|
66
|
+
sudo gem install -y RedCloth
|
66
67
|
sudo gem install -y BlueCloth
|
67
68
|
sudo gem install -y haml
|
68
69
|
sudo gem install -y coderay
|
70
|
+
sudo gem install -y ultraviolet
|
69
71
|
</pre>
|
70
72
|
|
71
|
-
Webby can also use a few other programs to clean up generated HTML and to created pretty graphs
|
73
|
+
Webby can also use a few other programs to clean up generated HTML and to created pretty graphs and pictures. Where external programs are required, they will be duly noted in the manual.
|
72
74
|
|
73
75
|
h3. Running Webby
|
74
76
|
|
75
|
-
When the Webby gem is installed it also installs a @webby@ executable program. This program is used to create a new website and to update the associated rake tasks when a new version of Webby is released. Typing in @webby --help@ will show you the options this program supports. After you create a
|
77
|
+
When the Webby gem is installed it also installs a @webby@ executable program. This program is used to create a new website and to update the associated rake tasks when a new version of Webby is released. Typing in @webby --help@ will show you the options this program supports. After you create a website, though, the webby command will not be needed.
|
76
78
|
|
77
79
|
<pre>
|
78
80
|
$ webby --help
|
@@ -86,21 +88,27 @@ common options:
|
|
86
88
|
--version show version
|
87
89
|
</pre>
|
88
90
|
|
89
|
-
|
91
|
+
|
92
|
+
The day to day tasks of working with a webiste - creating pages, building the website, deploying changes to the server - are handled by the "Rake":http://docs.rubyrake.org/ application, a Ruby version of the more famous *make* program. Several rake tasks are provided by default. You are free to create others to make developing and deploying your website easier. To see the current list of rake tasks type in @rake -T@.
|
90
93
|
|
91
94
|
<pre>
|
92
95
|
$ rake -T
|
93
96
|
|
94
|
-
rake autobuild
|
95
|
-
rake build
|
96
|
-
rake clobber
|
97
|
-
rake create:page
|
98
|
-
rake
|
99
|
-
rake deploy
|
100
|
-
rake deploy:
|
101
|
-
rake
|
102
|
-
rake
|
103
|
-
rake
|
97
|
+
rake autobuild # Continuously build the website
|
98
|
+
rake build # Build the website
|
99
|
+
rake clobber # Delete the website
|
100
|
+
rake create:page # Create a new page
|
101
|
+
rake create:partial # Create a new partial
|
102
|
+
rake deploy # deploy the website to Rubyforge
|
103
|
+
rake deploy:rsync # Deploy to the server using rsync
|
104
|
+
rake deploy:ssh # Deploy to the server using ssh
|
105
|
+
rake growl # Send log events to Growl (Mac OS X only)
|
106
|
+
rake heel:start # Start the heel server to view website (not for Windows)
|
107
|
+
rake heel:stop # Stop the heel server
|
108
|
+
rake rebuild # Rebuild the website
|
109
|
+
rake validate # Alias to validate:internal
|
110
|
+
rake validate:external # Validate hyperlinks (include external sites)
|
111
|
+
rake validate:internal # Validate hyperlinks (exclude exteranl sites)
|
104
112
|
</pre>
|
105
113
|
|
106
114
|
h2. Working With Resources
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
title: Reference
|
3
|
+
created_at: 2008-03-04 22:00:08.439182 -07:00
|
4
|
+
filter:
|
5
|
+
- erb
|
6
|
+
- textile
|
7
|
+
- outline
|
8
|
+
---
|
9
|
+
<div class="toc push-1">
|
10
|
+
|
11
|
+
p(title). Table of Contents
|
12
|
+
|
13
|
+
<toc />
|
14
|
+
</div>
|
15
|
+
|
16
|
+
h3. Resources
|
17
|
+
|
18
|
+
Resources are the files that are found in the _content_ and _layouts_ folders of a webby site. They come in the following four flavors:
|
19
|
+
|
20
|
+
* *Pages* -- contain meta-data at the top of the file, are found in the content folder, and are processed by the Webby filter engine
|
21
|
+
* *Files* -- are found in the content folder and copied "as is" to the output folder
|
22
|
+
* *Partials* -- contain snippets of text that can be used in multiple locations; partial filenames begin with an underscore are are _not_ copied to the output folder
|
23
|
+
* *Layouts* -- are found in the layout folder and provide the basic framework of the webpage - the header, the footer, the navigation
|
24
|
+
|
25
|
+
h3. Attributes
|
26
|
+
|
27
|
+
Attributes are defined in the meta-data section of pages and layouts.
|
28
|
+
|
29
|
+
table(reference).
|
30
|
+
| *destination* | Defines the path in the output directory where the rendered page should be stored. |
|
31
|
+
| *dirty* | The dirty flag is used to determine whether the page should rendered or not. Normally this is automatically determined by the filter engine, but it can be overridden by setting this attribute. If the dirty flag is set to _true_ then the page will always be rendered. If the dirty flag is set to _false_ then the page will never be rendered. |
|
32
|
+
| *extension* | Defines the extension that will be appended to the filename of the rendered page in the output folder. The extension is determined by looking at the following:
|
33
|
+
* the meta-data of the current page for an @extension@ attribute
|
34
|
+
* the meta-data of layout file of the current page for an @extension@ attribute
|
35
|
+
* the extension of this page file in the _content_ folder |
|
36
|
+
| *filter* | Defines the list of filters that will be applied to the contents of this page. If left blank, then the default filter will be applied to the page contents. |
|
37
|
+
| *layout* | Defines the layout that the page contents will be rendered into. The default layout will be used if this attribute is not defined. The value of @nil@ should be specified if the page should not be rendered into any layout. |
|
38
|
+
|
39
|
+
The following attributes are defined for each page in the content folder. These attributes cannot be changed in the page's meta-data section. However, they are available to the ERB filter when rendering the contents of a page.
|
40
|
+
|
41
|
+
table(reference).
|
42
|
+
| *path* | The full path to the file in the _content_ folder |
|
43
|
+
| *dir* | The relative directory in the output folder where the page will be rendered |
|
44
|
+
| *filename* | The name of the file in the _content_ folder excluding any path information |
|
45
|
+
| *ext* | The extension of the file in the _content_ folder |
|
46
|
+
| *mtime* | The modification time of the file in the _content_ folder |
|
47
|
+
| *number* | Reserved variable used for multi-page content |
|
48
|
+
| *url* | A URL suitable for creating a link to the page |
|
49
|
+
| *render* | Returns the contents of the page as rendered by the Webby filter engine |
|
50
|
+
|
51
|
+
h3. Filters
|
52
|
+
|
53
|
+
h3. ERB Variables & Methods
|
54
|
+
|
55
|
+
h3. Rake Tasks
|
56
|
+
|
57
|
+
h3. Site Defaults
|
@@ -1,35 +1,77 @@
|
|
1
1
|
---
|
2
2
|
title: Tips & Tricks
|
3
3
|
created_at: Wed Aug 29 08:57:11 -0600 2007
|
4
|
-
filter:
|
4
|
+
filter:
|
5
|
+
- textile
|
6
|
+
- outline
|
5
7
|
---
|
6
8
|
<div class="toc push-1">
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
* "CodeRay":#toc_cr
|
10
|
+
p(title). Table of Contents
|
11
11
|
|
12
|
+
<toc />
|
12
13
|
</div>
|
13
14
|
|
14
|
-
h2
|
15
|
+
h2. Pagination
|
16
|
+
|
17
|
+
Pagination is the process of organizing information onto a page such that a fixed number of items appear on each page. Webby provides some methods for paginating information.
|
18
|
+
|
19
|
+
Let's assume that your website has a collection of articles in a folder called "articles" in the content directory. The goal is to display these articles ten at a time in reverse chronological order.
|
20
|
+
|
21
|
+
<pre>
|
22
|
+
---
|
23
|
+
title: Articles
|
24
|
+
filter: erb
|
25
|
+
---
|
26
|
+
h2. <%= h(@page.title) %>
|
27
|
+
|
28
|
+
<%
|
29
|
+
articles = @pages.find(:limit => :all, :in_directory => "articles",
|
30
|
+
:sort_by => "mtime", :reverse => true)
|
31
|
+
paginate(articles, 10) do |page|
|
32
|
+
%>
|
33
|
+
<%= page.render %>
|
34
|
+
<hr />
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<%= link_to("Prev", @pager.prev) if @pager.prev? %>
|
38
|
+
<%= link_to("Next", @pager.next) if @pager.next? %>
|
39
|
+
</pre>
|
40
|
+
|
41
|
+
In the example page above, the first step is get the collection of articles we are interested in the paginating. This is done using the <code>@pages.find</code> method to retrieve all the pages from the articles folder sorted in reverse order by modification time. When we have the collection of articles, we pass them to the @paginate@ method along with the desired number of articles per page. The @paginate@ method will pass each page in the @articles@ collection to the supplied block of code, but for each ten pages passed to the block, a new webpage will be created.
|
42
|
+
|
43
|
+
Inside the block of code we simple render each page and separate the rendered pages using a horizontal rule. Finally, at the end of each page we generate _Prev_ and _Next_ links to supply navigation.
|
44
|
+
|
45
|
+
The <code>@pager</code> object provides a few other useful methods:
|
46
|
+
|
47
|
+
* *number* -- the current page number
|
48
|
+
* *number_of_pages* -- the total number of pages that will be generated
|
49
|
+
* *first_item_number* -- the "item number" of the first item on this page
|
50
|
+
* *last_item_number* -- the "item number" of the last item on this page
|
51
|
+
* *first* -- a reference to the first pager (useful for @link_to@ methods)
|
52
|
+
* *last* -- a reference to the last pager (useful for @link_to@ methods)
|
53
|
+
* *page( number )* -- a reference to the pager for page _number_ (useful for @link_to@ methods)
|
54
|
+
|
55
|
+
bq. *NOTE*: the <code>@pager</code> is not instantiated until _after_ the @paginate@ method has been called. Therefore, references to other pages and item numbers cannot be made before the @paginate@ method is called in the page.
|
56
|
+
|
57
|
+
h2. CodeRay
|
15
58
|
|
16
59
|
To include "CodeRay":http://coderay.rubychan.de/ syntax highlighting support in a page you need to have the @coderay@ gem installed, and you need to include the CodeRay stylesheet in your layout. The following example shows a page that uses CodeRay syntax highlighting combined with Textile markup.
|
17
60
|
|
18
|
-
<pre
|
61
|
+
<pre>
|
19
62
|
---
|
20
63
|
title: CodeRay Example
|
21
64
|
filter:
|
22
|
-
|
23
|
-
|
24
|
-
- textile
|
65
|
+
- erb
|
66
|
+
- textile
|
25
67
|
---
|
26
68
|
h2. <%= h(@page.title) %>
|
27
69
|
|
28
70
|
This is the @render_page@ function from the Webby static website generation
|
29
71
|
system. It is used to render a page by applying the specified filters in
|
30
72
|
succession to the page contents.
|
31
|
-
|
32
|
-
|
73
|
+
|
74
|
+
<% coderay(:lang => "ruby", :line_numbers => "inline") do -%>
|
33
75
|
# call-seq:
|
34
76
|
# render_page => string
|
35
77
|
#
|
@@ -46,7 +88,7 @@ def render_page
|
|
46
88
|
|
47
89
|
str
|
48
90
|
end
|
49
|
-
|
50
|
-
</
|
91
|
+
<% end -%>
|
92
|
+
</pre>
|
51
93
|
|
52
|
-
There are more options that can be passed to the CodeRay syntax highlighter than those shown in the example above. Take a look at the RDoc documentation for the "CodeRay
|
94
|
+
There are more options that can be passed to the CodeRay syntax highlighter than those shown in the example above. Take a look at the RDoc documentation for the "CodeRay Helper":/rdoc/classes/Webby/Helpers/CodeRayHelper.html class for more information.
|
@@ -25,7 +25,7 @@ content/
|
|
25
25
|
layouts/
|
26
26
|
lib/
|
27
27
|
output/
|
28
|
-
|
28
|
+
tasks/
|
29
29
|
templates/
|
30
30
|
</pre>
|
31
31
|
|
@@ -49,7 +49,8 @@ Of course "Lorem Ipsum" is some great content, but if everyone posted their site
|
|
49
49
|
|
50
50
|
<pre class="code">
|
51
51
|
---
|
52
|
-
title:
|
52
|
+
title: Home Page
|
53
|
+
created_at: Tue Aug 21 17:02:40 -0600 2007
|
53
54
|
filter:
|
54
55
|
- erb
|
55
56
|
- textile
|
@@ -97,7 +98,7 @@ The output from the command tells you that a new file has been created - @conten
|
|
97
98
|
|
98
99
|
h2. Change the Layout
|
99
100
|
|
100
|
-
The next step is to change how the page looks. In fact, we want to change the appearance of all the pages in our website. This is easily
|
101
|
+
The next step is to change how the page looks. In fact, we want to change the appearance of all the pages in our website. This is easily done by changing the website layout file in the _layouts_ folder. Open the *layouts/default.rhtml* file in your favorite editor.
|
101
102
|
|
102
103
|
<pre class="code">
|
103
104
|
---
|
@@ -121,10 +122,10 @@ You'll notice that the layout file has meta-data just like the content files we'
|
|
121
122
|
|
122
123
|
The meta-data of the layout is not made available in the layout itself - just the meta-data of the content file being rendered.
|
123
124
|
|
124
|
-
Let's change the layout by removing the sidebar from every page. Find the sidebar div
|
125
|
+
Let's change the layout by removing the sidebar from every page. Find the sidebar div <notextile><code><div class="column span-5 append-2 last"></code></notextile>. Delete that div, run rake to build the website again, and take a look at the site in your browser. You'll notice that both pages have been updated since both depend upon the default layout.
|
125
126
|
|
126
127
|
h2. What Now?
|
127
128
|
|
128
129
|
Let your creativity run wild!
|
129
130
|
|
130
|
-
You can read more about the features of Webby in the "manual"
|
131
|
+
You can read more about the features of Webby in the "manual":/manual. There you'll discover how to reference layouts other than the default, how to create page templates for simplifying blog posts. Take a look at the "tips & tricks":/tips_and_tricks for more ideas on simplifying your web development work cycle.
|
@@ -38,14 +38,14 @@ filter:
|
|
38
38
|
<div class="column span-4 prepend-1 first" id="navigation">
|
39
39
|
<ul
|
40
40
|
><li><%= link_to_page_unless_current 'Home' %></li
|
41
|
-
><li><%= link_to_page_unless_current 'Download' %></li
|
42
41
|
><li><%= link_to_page_unless_current 'Tutorial' %></li
|
43
42
|
><li><%= link_to_page_unless_current 'Manual' %></li
|
43
|
+
><li><%= link_to_page_unless_current 'Reference' %></li
|
44
44
|
><li><%= link_to_page_unless_current 'Tips & Tricks' %></li
|
45
|
+
><li><a href="http://groups.google.com/group/webby-forum">Forum</a></li
|
45
46
|
></ul>
|
46
47
|
</div>
|
47
48
|
|
48
|
-
|
49
49
|
<div class="column span-16 append-3 last">
|
50
50
|
<%= @content %>
|
51
51
|
</div>
|
@@ -3,15 +3,15 @@ require 'rake/contrib/sshpublisher'
|
|
3
3
|
|
4
4
|
namespace :deploy do
|
5
5
|
|
6
|
-
desc '
|
6
|
+
desc 'Deploy to the server using rsync'
|
7
7
|
task :rsync do
|
8
8
|
cmd = "rsync #{SITE.rsync_args.join(' ')} "
|
9
9
|
cmd << "#{SITE.output_dir}/ #{SITE.host}:#{SITE.remote_dir}"
|
10
10
|
sh cmd
|
11
11
|
end
|
12
12
|
|
13
|
-
desc '
|
14
|
-
task
|
13
|
+
desc 'Deploy to the server using ssh'
|
14
|
+
task :ssh do
|
15
15
|
Rake::SshDirPublisher.new(
|
16
16
|
SITE.host, SITE.remote_dir, SITE.output_dir
|
17
17
|
).upload
|
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
namespace :heel do
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'Start the heel server to view website (not for Windows)'
|
5
5
|
task :start do
|
6
6
|
sh "heel --root #{SITE.output_dir} --port #{SITE.heel_port} --daemonize"
|
7
7
|
end
|
8
8
|
|
9
|
-
desc '
|
9
|
+
desc 'Stop the heel server'
|
10
10
|
task :stop do
|
11
11
|
sh "heel --kill"
|
12
12
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
namespace :validate do
|
3
|
+
|
4
|
+
desc 'Validate hyperlinks (exclude exteranl sites)'
|
5
|
+
task :internal => :build do
|
6
|
+
Webby::LinkValidator.validate(:external => false)
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Validate hyperlinks (include external sites)'
|
10
|
+
task :external => :build do
|
11
|
+
Webby::LinkValidator.validate(:external => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
end # validate
|
15
|
+
|
16
|
+
desc 'Alias to validate:internal'
|
17
|
+
task :validate => 'validate:internal'
|
18
|
+
|
19
|
+
# EOF
|
data/lib/webby/builder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: builder.rb
|
1
|
+
# $Id: builder.rb 192 2008-03-08 16:27:29Z tim_pease $
|
2
2
|
|
3
3
|
require 'find'
|
4
4
|
require 'fileutils'
|
@@ -88,7 +88,6 @@ class Builder
|
|
88
88
|
end
|
89
89
|
|
90
90
|
load_files if opts[:load_files]
|
91
|
-
loop_check
|
92
91
|
|
93
92
|
Resources.pages.each do |page|
|
94
93
|
next unless page.dirty? or opts[:rebuild]
|
@@ -128,27 +127,6 @@ class Builder
|
|
128
127
|
end
|
129
128
|
end
|
130
129
|
|
131
|
-
# Loop over all the layout resources looking for circular reference -- a
|
132
|
-
# layout that eventually refers back to itself. These are bad. Raise an
|
133
|
-
# error if one is detected.
|
134
|
-
#
|
135
|
-
def loop_check
|
136
|
-
layouts = Resources.layouts
|
137
|
-
|
138
|
-
layouts.each do |lyt|
|
139
|
-
stack = []
|
140
|
-
while lyt
|
141
|
-
if stack.include? lyt.filename
|
142
|
-
stack << lyt.filename
|
143
|
-
raise Error,
|
144
|
-
"loop detected in layout references: #{stack.join(' > ')}"
|
145
|
-
end
|
146
|
-
stack << lyt.filename
|
147
|
-
lyt = layouts.find :filename => lyt.layout
|
148
|
-
end # while
|
149
|
-
end # each
|
150
|
-
end
|
151
|
-
|
152
130
|
%w(output_dir layout_dir content_dir).each do |key|
|
153
131
|
self.class_eval <<-CODE
|
154
132
|
def #{key}( ) ::Webby.site.#{key} end
|