documentation/index.html.erb in table_fu-0.3.0 vs documentation/index.html.erb in table_fu-0.3.1

- old
+ new

@@ -1,10 +1,9 @@ <% $:.unshift File.expand_path(File.dirname(__FILE__), "/../lib/table_fu") - +require 'rubygems' require 'uv' -require 'FasterCSV' require 'table_fu' def code_for(file, output=true) return '' unless File.exists?("examples/#{file}.rb") file = File.open("examples/#{file}.rb").read @@ -33,14 +32,14 @@ <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <title>TableFu</title> <link rel="stylesheet" type="text/css" href="documentation/css/styles.css" /> <link rel="stylesheet" type="text/css" href="documentation/css/dawn.css" /> </head> - + <body> <a href="http://www.propublica.org" class="propublica">&nbsp;</a> - <h1>TableFu <small>&ndash; Version: <%= + <h1>TableFu <small>&ndash; Version: <%= config = YAML.load(File.read('VERSION.yml')) "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" %></small></h1> <p><a href="http://github.com/propublica/table-fu">TableFu</a> is a ruby gem for spreadsheet-style handling of arrays (e.g. filtering, formatting, and sorting by "column" or "row"). In addition, it has the ability to <a href="#facet">facet</a> &mdash; or group &mdash; rows according to cell value. It was developed as a backend for its companion project <a href="http://www.github.com/propublica/table-setter">TableSetter</a>.</p> @@ -83,24 +82,24 @@ <p><strong>columns:</strong> the columns to include in the table, useful when reordering and filtering extraneous columns. If no arguments are provided, <strong>TableFu</strong> will include all columns by default. <%= code_for "columns" %> Note that the columns are still accessible directly even if they're not in the columns array. <%= code_for "columns_hidden" %> </p> - + <h2><a id="macros" href="#toc">Macros / Formatting</a></h2> <p><strong>TableFu</strong> allows you to format columns of cells through the use of macros. See <a href="http://github.com/propublica/table-fu/blob/master/lib/table_fu/formatting.rb"><strong>TableFu::Formatting</strong></a> for the predefined macros available. </p> - <p>The <strong>formatting</strong> attribute should be a hash of the form: + <p>The <strong>formatting</strong> attribute should be a hash of the form: <%= code_for "formatting_options", false %> which will call the macro on the column name with the arguments if specified. </p> <p>For example, you can use the <strong>last_name</strong> formatter to extract the last name of a cell containing a person's name: <%= code_for "last_name" %> </p> <p>Of course, you can provide your own macros by patching <a href="http://github.com/propublica/table-fu/blob/master/lib/table_fu/formatting.rb">TableFu::Formatting</a>. <a href="http://www.github.com/propublica/table-setter">TableSetter</a> includes rails view helpers directly in <strong>TableFu::Formatting</strong>. <%= code_for "rails_helpers", false %> </p> - + <h2><a id="faceting" href="#toc">Faceting</a></h2> <p>Faceting provides a way to group rows together using a cell value they share in common. Calling <strong>TableFu#faceted_by</strong> returns an array of table fu instances each with a <strong>faceted_on</strong> attribute and with only the rows where that value appears. </p> <p>In this example there are 2 rows where "Modernism" appears in the style column, so calling <strong>faceted_on</strong> with the argument <strong>"Style"</strong> returns a <strong>TableFu</strong> instance with those rows grouped together: <%= code_for "faceting" do |s|