website/content/tips_and_tricks.txt in webby-0.3.0 vs website/content/tips_and_tricks.txt in webby-0.4.0

- old
+ new

@@ -1,54 +1,56 @@ --- title: Tips & Tricks created_at: Wed Aug 29 08:57:11 -0600 2007 +filter: textile +--- +<div class="toc push-1"> + +h4. Table of Contents + +* "CodeRay":#toc_cr + +</div> + +h3(#toc_cr){clear:none}. CodeRay + +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. + +Note how the @coderay@ block is enclosed by a @notextile@ block. This ensures that the Textile filter does not clobber the generated syntax highlighting. + +<pre class="code"> +--- +title: CodeRay Example filter: - erb - coderay - textile --- -h2. To-Do +h3. <%= h(@page.title) %> -The Webby tips & tricks page goes here. +This is the @render_page@ function from the Webby static website generation +system. It is used to render a page by applying the specified filters in +succession to the page contents. -<notextile> -<coderay line_numbers="inline"> +<notextile>&lt;notextile&gt; +&lt;coderay lang="ruby" line_numbers="inline"&gt; # call-seq: # render_page => string # # Apply the desired filters to the page. The filters to apply are # determined from the page's meta-data. # def render_page ary = [] str = ::Webby::File.read(@page.path) - str << "and some more text" - @page.filter.to_a.each do |filter| str = self.send(filter + '_filter', str) end str end -</coderay> -</notextile> - -And some more text. - -<pre class="code"> ---- -title: Home Page -filter: - - erb - - textile ---- -h2. <%= @page.title %> - -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum -vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est -eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at -metus. - -h3. Litora Sociis -... +&lt;/coderay&gt; +&lt;/notextile&gt;</notextile> </pre> + +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 "CodeRayFilter":http://webby.rubyforge.org/rdoc/classes/Webby/CodeRayFilter.html class for more information.