# Reference

### 1Resources

Resources are the files that are found in the content and layouts folders of a webby site. They come in the following four flavors:

• Pages — contain meta-data at the top of the file, are found in the content folder, and are processed by the Webby filter engine
• Files — are found in the content folder and copied “as is” to the output folder
• 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
• Layouts — are found in the layout folder and provide the basic framework of the webpage – the header, the footer, the navigation

### 2Attributes

Attributes are defined in the meta-data section of pages and layouts.

destination

Defines the path in the output directory where the rendered page should be stored.

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.

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:

• the meta-data of the current page for an extension attribute
• the meta-data of layout file of the current page for an extension attribute
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.

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.

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.

path

The full path to the file in the content folder

dir

The relative directory in the output folder where the page will be rendered

filename

The name of the file in the content folder excluding any path information and extension

ext

The extension of the file in the content folder

mtime

The modification time of the file in the content folder

number

Reserved variable used for multi-page content

url

A URL suitable for creating a link to the page

render

Returns the contents of the page as rendered by the Webby filter engine

### 4ERB Variables & Methods

#### 4.1coderay

The coderay method is used to generate syntax highlighting on a block of code. You will need to have the coderay gem installed on your system, and you will need to include the coderay CSS stylesheet in your pages for the syntax highlighting markup to take effect.

The full list of coderay options can be found in the source documentation.

<% coderay :lang => 'ruby', :line_numbers => 'inline' do -%>
class Object
def returning( r )
yield r if block_given?
r
end
end
<% end -%>

1 class Object
2   def returning( r )
3     yield r if block_given?
4     r
5   end
6 end


#### 4.2graphviz

The graphviz method is used to convert a DOT script into an image and insert the image into the page. If the DOT script contains URL references, then an image map will also be generated. The resulting image will then have “clickable” regions that link to the URLs specified.

Graphviz needs to be installed on your system in order to use the graphviz method. The full list of graphviz options can be found in the source documentation.

<% graphviz :path => 'images', :alt => 'hello world graph' do -%>
digraph hello_world {
rankdir = LR;
Hello -> World;
}
<% end -%>


#### 4.3tex2img

The tex2img method is used to convert a LaTeX script into an image and insert the image into the page. LaTeX and ImageMagick need to be instaled on your system in order to use the tex2img maethod.

The full list of tex2img options can be found in the source documentation.

<% tex2img 'wave_eq', :path => 'images', :alt => 'wave equation' do -%>
$\psi_{tot}(x,-t_0,r) = \frac{1}{(2\pi)^2} \int\!\!\!\int \tilde\Psi_{tot}\left(k_x,\frac{c}{2}\sqrt{k_x^2 + k_r^2},r=0\right)$
<% end -%>


#### 4.4uv

The uv method is used to generate syntax highlighting on a block of code. You will need to have the Ultraviolet gem installed on your system, and you will need to include the desired CSS stylesheet in your pages for the syntax highlighting markup to take effect.

The full list of ultraviolet options can be found in the source documentation.

<% uv :lang => "ruby", :line_numbers => true do -%>
# Initializer for the class.
def initialize( string )
@str = string
end
<% end -%>

   1  # Initializer for the class.
2  def initialize( string )
3    @str = string
4  end