Table of Contents
Resources are the files that are found in the content and layouts folders of a webby site. They come in the following four flavors:
Attributes are defined in the meta-data section of pages and layouts.
extension
attributeextension attributenil 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.
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
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 -%>
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 -%>
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