[ANN] Webby 0.7.2

T

Tim Pease

== Webby
by Tim Pease
http://webby.rubyforge.org

== Description

Webby builds websites. It's not a framework. It's not a webserver.
It's not a content management system.

Webby builds websites very, very well.

Webby will take text files written in your favorite markup language,
combine them with some fancy layouts, and output HTML files. You can
upload these HTML files to a webserver, and PRESTO!!! There's your
website!

Webby makes it dead simple to do all this.

Webby has documentation (in progress).

Webby has friends:

http://www.codefluency.com/
http://lug.boulder.co.us/
http://webby.rubyforge.org/
http://www.pea53.com/ <-- my personal site that is still just
Lorem Ipsum right now <sigh />

Webby needs to be installed on your computer right now!

sudo gem install -y webby

== Changes

* 4 minor enhancements
- Created a URI base path rewriter filter
- Create an outline filter for generating table of contents
- Pages can be created as files or as directories
- The @pages find method now recurses into sub-directories
* 3 bug fixes
- Fixed a bug in the graphviz filter where the wrong map ID was
being generated
- Now passing the binding of the Renderer to the HAML filter
(this makes the @page, @pages availabe in HAML pages)
- The created_at attribute was not being created as a YAML
time object

== Enjoy

== Fun Fact

American Airlines saved $40,000 in 1987 by eliminating 1 olive from
each salad served in first-class.

== Post Script

Blessings,
TwP
 
L

Leslie Viljoen


Is there a forum or wiki for Webby? I have some more questions:

1. Is there a directory in the webby structure where I can put files
to be copied into
output during a build? I currently put images directly under
output/img, which seems wrong.
2. How do you create links to other content pages without specifying
the URL directly?
3. How do I add file dependencies to the build? ie. I have created a
scripts directory so
that in my default.rhtml I can 'require "scripts/utils.rb"' and use
those methods, but
'rake autobuild' doesn't pick up changes to them.
 
L

Leslie Viljoen

Is there a forum or wiki for Webby? I have some more questions:

Ok, I figured out all the answers by looking at the example, except for:
2. How do you create links to other content pages without specifying
the URL directly?

I see there is an @pages variable but not quite sure how to access an
individual page (and then page.url) therein.
 
L

Leslie Viljoen

Ok, I figured out all the answers by looking at the example, except for:

Oh, read the source for url_helper.rb and figured that out too:

<%= link_to_page("click here", :title => "Management") %>

It sure is great when everything is written in Ruby.

Thanks Tim, and I am looking forward to Webby's manual being complete!
(maybe I can add to it a bit and send diffs?)
 
T

Tim Pease

Is there a forum or wiki for Webby? I have some more questions:

I should probably make one.
1. Is there a directory in the webby structure where I can put files
to be copied into
output during a build? I currently put images directly under
output/img, which seems wrong.

Put them in the content folder. The files will be copied to the output
folder when the website is built.
2. How do you create links to other content pages without specifying
the URL directly?

<%= link_to_page( :title => "Your Page Title" ) %>

That will find the page that has "Your Page Title" as the value for
the "title" meta-data attribute. It will use the title as the name for
the anchor tag. However, you can also specify your own name to use as
you discovered and replied in one of your response e-mails.
3. How do I add file dependencies to the build? ie. I have created a
scripts directory so
that in my default.rhtml I can 'require "scripts/utils.rb"' and use
those methods, but
'rake autobuild' doesn't pick up changes to them.

Custom extensions go in the "lib" folder. Any .rb files in there will
be loaded when the rake tasks are run (build, rebuild, autobuild). I
put things in there like code to create breadcrumb links or monkey
patches to the webby source code.

Thanks for enjoying webby :) It's been fun to write and fun to use.
If you want to add updates to the manual, grab the latest version from
the RubyForge svn and shoot me a diff file.

Blessings,
TwP
 
L

Leslie Viljoen

<%= link_to_page( :title => "Your Page Title" ) %>

Because the "url_for" function produces url's that start with a "/",
I cannot open my generated index.html as a file on my harddrive -
all the links are absolute. I changed the url_for function to leave
out the leading slash and now everything seems to work locally
and through a server. Can you think of a problem this may cause?
Thanks for enjoying webby :) It's been fun to write and fun to use.
If you want to add updates to the manual, grab the latest version from
the RubyForge svn and shoot me a diff file.

I hope I can contribute once I have made some progress myself. There's
a lot more that can be put in there.

Webby is quite a bit of fun so far! I'll post a link when my site is up.
 
L

Leslie Viljoen

Because the "url_for" function produces url's that start with a "/",
I cannot open my generated index.html as a file on my harddrive -
all the links are absolute. I changed the url_for function to leave
out the leading slash and now everything seems to work locally
and through a server. Can you think of a problem this may cause?

Here's the code:
def url_for( *args )
opts = Hash === args.last ? args.pop : {}
obj = args.first

anchor = opts.delete:)anchor)
escape = opts.has_key?:)escape) ? opts.delte:)escape) : true

url = Webby::Resource === obj ? obj.url : obj.to_s
url = escape_once(url) if escape
url << "#" << anchor if anchor

url = url[1..-1] if url.length > 1
return url
end

.. I just added the third-last line. Perhaps better would be to change
obj.url for each object.
 
T

Tim Pease

Because the "url_for" function produces url's that start with a "/",
I cannot open my generated index.html as a file on my harddrive -
all the links are absolute. I changed the url_for function to leave
out the leading slash and now everything seems to work locally
and through a server. Can you think of a problem this may cause?

I can't think of a problem that it will cause, but I also can't think
of a problem it will solve, either. Your fix will work for pages
located at the root of the website. But for pages that are nested in
some directory structure, they will not have access to the CSS files
or other resources. The reason for this is that the layout contains
the HTML head tag, and that will be the same for all the pages. When
it is configured to work for one directory level, it will not work for
any other directory levels.

Webby has a "basepath" filter that allows you to rewrite the base path
for any URL in the system. I use this filter for websites that are not
hosted at the root of the web server. This filter looks at all the
URLs in a page and replaces that leading slash "/" character with the
new base path.

In your situation, you could rewrite the base URL to "."

rake rebuild BASE="."

That will work for viewing pages directly from the disk. However, you
will run into the problem where pages nested in some directory won't
be able to load the CSS files, etc.

Blessings,
TwP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top