<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/headerize/link_and_indent_helpers.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,21 @@
+require File.dirname(__FILE__) + '/link_and_indent_helpers'
+
 module Headerize
+  # Includes helpers for placing javascript in the head of a page while still
+  # allowing the addition of scripts in any template file.
+  #
+  # See the main README for more information. +add_javascript+ is the main
+  # interface, used to add scripts to the list of includes anywhere. Then,
+  # +javascript_includes+ can be used to retrieve the full list of links to
+  # place in the head of the page (probably in a layout file).
   module JavascriptHelper
+    include LinkAndIndentHelpers
+
+    # Adds all given javascript files to the list of javascript include tags
+    # that will be returned by +javascript_includes+. See the
+    # +javascript_include_tag+ documentation for more on what arguments can be
+    # passed (an invocation to +add_javascript+ can be exactly the same as one
+    # to +javascript_include_tag+).
     def add_javascript(*args)
       @javascripts ||= []
       @javascripts &lt;&lt; args
@@ -7,22 +23,13 @@ module Headerize
       nil
     end
 
+    # Returns all Javascript includes added by +add_javascript+. These includes
+    # are indented by 4 spaces by default. Pass the &lt;tt&gt;:indent&lt;/tt&gt; option with
+    # a different number for a different indentation level.
     def javascript_includes(opts = {})
-      return '' if @javascripts.nil?
-
-      includes = @javascripts.inject('') do |str, files_and_opts|
-        str &lt;&lt; javascript_include_tag(*files_and_opts)
-      end
-
-      indent(includes, opts[:indent] || 4)
+      collect_and_indent @javascripts, :javascript_include_tag,
+                         opts[:indent] || 4
     end
-
-    private
-      # Indents the given string by the given amount. Does not indent the first
-      # line.
-      def indent(string, amt)
-        string.gsub /\n *([^\n]+)/m, &quot;\n#{' ' * amt}\\1&quot;
-      end
   end
 end
 </diff>
      <filename>lib/headerize/javascript_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,20 @@
+require File.dirname(__FILE__) + '/link_and_indent_helpers'
+
 module Headerize
+  # Includes helpers for placing stylesheets in the head of a page while still
+  # allowing the addition of stylesheets in any template file.
+  #
+  # See the main README for more information. +add_stylesheet+ is the main
+  # interface, used to add stylesheets to the list of links anywhere. Then,
+  # +stylesheet_links+ can be used to retrieve the full list of links to place
+  # in the head of the page (probably in a layout file).
   module StylesheetHelper
+    include LinkAndIndentHelpers
+
+    # Adds all given stylesheets to the list of stylesheet link tags that will
+    # be returned by +stylesheet_links+. See the +stylesheet_link_tag+
+    # documentation for more on what arguments can be passed (an invocation to
+    # +add_stylesheet+ can be exactly the same as one to +stylesheet_link_tag+).
     def add_stylesheet(*args)
       @stylesheets ||= []
       @stylesheets &lt;&lt; args
@@ -7,22 +22,13 @@ module Headerize
       nil
     end
 
+    # Returns all stylesheet links added by +add_stylesheet+. These links are
+    # indented by 4 spaces by default. Pass the &lt;tt&gt;:indent&lt;/tt&gt; option with a
+    # different number for a different indentation level.
     def stylesheet_links(opts = {})
-      return '' if @stylesheets.nil?
-
-      links = @stylesheets.inject('') do |str, files_and_opts|
-        str &lt;&lt; stylesheet_link_tag(*files_and_opts)
-      end
-
-      indent(links, opts[:indent] || 4)
+      collect_and_indent @stylesheets, :stylesheet_link_tag,
+                         opts[:indent] || 4
     end
-
-    private
-      # Indents the given string by the given amount. Does not indent the first
-      # line.
-      def indent(string, amt)
-        string.gsub /\n *([^\n]+)/m, &quot;\n#{' ' * amt}\\1&quot;
-      end
   end
 end
 </diff>
      <filename>lib/headerize/stylesheet_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>491e068f573954116ba8b83d021d7160ff3680ac</id>
    </parent>
  </parents>
  <author>
    <name>shadowfiend</name>
    <email>shadowfiend@ubuntu.Belkin</email>
  </author>
  <url>http://github.com/Shadowfiend/headerize/commit/067804b4f8c778ab1c7d81ccb4cb825ad2b6e618</url>
  <id>067804b4f8c778ab1c7d81ccb4cb825ad2b6e618</id>
  <committed-date>2008-06-07T17:17:29-07:00</committed-date>
  <authored-date>2008-06-07T17:17:29-07:00</authored-date>
  <message>Refactored common code into LinkAndIndentHelpers module, added documentation to
the files.</message>
  <tree>a85d2433b9380519f5962f927261673d1c36db01</tree>
  <committer>
    <name>shadowfiend</name>
    <email>shadowfiend@ubuntu.Belkin</email>
  </committer>
</commit>
