<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/redcloth/parser_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -2,4 +2,15 @@ require &quot;rubygems&quot;
 gem 'treetop', &quot;&gt; 1.2.5&quot;
 require &quot;treetop&quot;
 
-require &quot;redcloth/parser&quot;
\ No newline at end of file
+require &quot;redcloth/parser&quot;
+require &quot;redcloth/ast&quot;
+require &quot;redcloth/formatter/html&quot;
+
+module RedCloth
+  # A convenience method for creating a new TextileDoc. See
+  # RedCloth::TextileDoc.
+  def self.new( string, &amp;block )
+    RedCloth::Parser::TextileDocParser.new.parse_or_fail( string, &amp;block )
+  end
+  
+end
\ No newline at end of file</diff>
      <filename>lib/redcloth.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 require 'redcloth/ast/textile_doc'
 require 'redcloth/ast/list'
 require 'redcloth/ast/list_item'
-require 'redcloth/ast/inline'
 require 'redcloth/ast/element'
 require 'redcloth/ast/visitor'
 
@@ -23,4 +22,4 @@ class String
   def to_sexp
     self
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/redcloth/ast.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,10 @@ module RedCloth
       def strong(element)
         accept_contents(element)
       end
+
+      def bold(element)
+        accept_contents(element)
+      end
       
       def accept_contents(element)
         element.contained_elements.map {|e| e.is_a?(String) ? e : e.accept(self) }.join</diff>
      <filename>lib/redcloth/ast/visitor.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,27 +9,38 @@ module RedCloth
   module Formatter
     class Html &lt; Ast::Visitor
       
-      def initialize(io, options={})
+      def initialize(textile_doc=nil, options={})
         @options = options
-        @builder = create_builder(io)
+        format(textile_doc) if textile_doc
       end
       
-      def create_builder(io)
-        Builder::XmlMarkup.new(:target =&gt; io, :indent =&gt; 0)
+      def format(textile_doc)
+        textile_doc.accept(self)
+      end
+      
+      def builder
+        @builder ||= Builder::XmlMarkup.new(:indent =&gt; 0)
       end
       
       def block_element(element)
         p(element)
       end
       
+      # FIXME: Yeah, these aren't DRY, but you know what they say about premature optimization
       def p(element)
-        @builder.p do |p|
+        builder.p do
           accept_contents(element)
         end
       end
       
       def strong(element)
-        @builder.strong do |p|
+        builder.strong do
+          accept_contents(element)
+        end
+      end
+      
+      def b(element)
+        builder.b do
           accept_contents(element)
         end
       end
@@ -39,14 +50,23 @@ module RedCloth
       def accept_contents(element)
         element.contained_elements.each do |e|
           if e.is_a?(String)
-            @builder.text! e
+            builder.text! e
           else
             e.accept(self)
           end
         end
       end
       
-      
+    end
+  end
+end
+
+module RedCloth
+  module Ast
+    class TextileDoc
+      def to_html
+        RedCloth::Formatter::Html.new(self)
+      end
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/redcloth/formatter/html.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ module RedCloth
   module Formatter
     describe Html do
       before(:each) do
-        @formatter = Html.new(&quot;&quot;)
+        @formatter = Html.new
       end
       
       describe &quot;#block_element&quot; do
@@ -43,6 +43,13 @@ module RedCloth
         end
       end
       
+      describe &quot;#bold&quot; do
+        it &quot;should format a bold phrase&quot; do
+          @bold = Ast::Element.new({:type =&gt; 'bold'}, ['Bold phrase.'])
+          @formatter.b(@bold).should == &quot;&lt;b&gt;Bold phrase.&lt;/b&gt;&quot;
+        end
+      end
+      
     end
   end
 end</diff>
      <filename>spec/redcloth/formatter/html_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -61,7 +61,7 @@ module RedCloth
       
       describe &quot;InlineParser integration&quot; do
 
-        it &quot;should parse a paragraph with inline strong&quot; do
+        it &quot;should parse a paragraph containing inline elements&quot; do
           parse(&quot;p. This is *my* paragraph&quot;).to_sexp.should ==
             [[:p, {}, [
               &quot;This is &quot;,</diff>
      <filename>spec/redcloth/parser/textile_doc_parser_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>678c92b9c86ef7be0a703d4921f85c158ed791b9</id>
    </parent>
  </parents>
  <author>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </author>
  <url>http://github.com/jgarber/redcloth-treetop/commit/f5328d48e2e84a5dc9cf7cbe5b1fef0a6123027b</url>
  <id>f5328d48e2e84a5dc9cf7cbe5b1fef0a6123027b</id>
  <committed-date>2009-07-02T06:31:41-07:00</committed-date>
  <authored-date>2009-07-02T06:31:41-07:00</authored-date>
  <message>End-to-end textile parsing and HTML formatting.</message>
  <tree>342e9cf503a0132fa7bbfb53e19ed70c27663cf3</tree>
  <committer>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </committer>
</commit>
