Sha256: a918f88bf0cc9d71fde4acabcebadffc86c362ddc92c3078b5eda6d9ae6ca73c
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
--- 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> h2(#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. <%= h(@page.title) %> 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><notextile> <coderay lang="ruby" line_numbers="inline"> # 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) @page.filter.to_a.each do |filter| str = self.send(filter + '_filter', str) end str end </coderay> </notextile></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.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webby-0.5.1 | website/content/tips_and_tricks.txt |
webby-0.5.0 | website/content/tips_and_tricks.txt |