Module: Webby

Defined in:
lib/webby/filters.rb,
lib/webby.rb,
lib/webby/file.rb,
lib/webby/main.rb,
lib/webby/builder.rb,
lib/webby/pages_db.rb,
lib/webby/renderer.rb,
lib/webby/resource.rb,
lib/webby/auto_builder.rb,
lib/webby/filters/tidy.rb,
lib/webby/filters/coderay.rb,
lib/webby/filters/outline.rb,
lib/webby/filters/basepath.rb,
lib/webby/filters/graphviz.rb,
lib/webby/stelan/paginator.rb,
lib/webby/helpers/tag_helper.rb,
lib/webby/helpers/url_helper.rb

Overview

$Id: url_helper.rb 103 2008-01-20 23:58:14Z tim_pease $

Defined Under Namespace

Modules: Filters, Helpers Classes: AutoBuilder, Builder, Error, File, Main, PagesDB, Paginator, Renderer, Resource

Constant Summary collapse

VERSION =

:nodoc:

'0.7.2'
PATH =

Path to the Webby package

::File.expand_path(::File.join(::File.dirname(__FILE__), '..'))

Class Method Summary collapse

Class Method Details

.cairnObject

call-seq:

cairn    => filename

The Webby cairn file is used to mark the last time the content was built into the output directory. It is an empty file; only the modification time of the file is important.



108
109
110
# File 'lib/webby.rb', line 108

def self.cairn
  @cairn ||= File.join(site.output_dir, '.cairn')
end

.excludeObject

call-seq

Webby.exclude    => regexp

Returns a regular expression used to exclude resources from the content directory from being processed by Webby. This same regular expression is also used to exclude layouts.



97
98
99
# File 'lib/webby.rb', line 97

def self.exclude
  @exclude ||= Regexp.new(site.exclude.join('|'))
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object

call-seq:

Webby.require_all_libs_relative_to( filename, directory = nil )

Utility method used to rquire all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



32
33
34
35
36
37
38
# File 'lib/webby.rb', line 32

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= File.basename(fname, '.*')
  search_me = File.expand_path(
      File.join(File.dirname(fname), dir, '**', '*.rb'))

  Dir.glob(search_me).sort.each {|rb| require rb}
end

.siteObject

call-seq:

Webby.site    => struct

Returns a struct containing the configuration parameters for the Webby site. These defaults should be overridden as needed in the site specific Rakefile.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/webby.rb', line 47

def self.site
  return @site if defined? @site
  @site = OpenStruct.new(
    :output_dir    => 'output',
    :content_dir   => 'content',
    :layout_dir    => 'layouts',
    :template_dir  => 'templates',
    :exclude       => %w(tmp$ bak$ ~$ CVS \.svn),
    :page_defaults => {
      'layout'     => 'default'
    },
    :find_by       => 'title',
    :base          => nil,
    :create_mode   => 'page',

    # Items used to deploy the webiste
    :host       => '[email protected]',
    :remote_dir => '/not/a/valid/dir',
    :rsync_args => %w(-av --delete),

    # Options passed to the 'tidy' program when the tidy filter is used
    :tidy_options => '-indent -wrap 80',

    # XPath identifiers used by the basepath filter
    :xpaths => %w(
        /html/head//base[@href]
        /html/head//link[@href]
        //script[@src]
        /html/body[@background]
        /html/body//a[@href]
        /html/body//object[@data]
        /html/body//img[@src]
        /html/body//area[@href]
        /html/body//form[@action]
        /html/body//input[@src]
    )
    # other possible XPaths to include for base path substitution
    #   /html/body//object[@usemap]
    #   /html/body//img[@usemap]
    #   /html/body//input[@usemap]
  )
end