<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,6 +16,13 @@ Synopsis
     &gt;&gt; puts Markdown.new('_Hello World!_', :smart, :filter_html).to_html
     &lt;p&gt;&lt;em&gt;Hello World!&lt;/em&gt;&lt;/p&gt;
 
+    &gt;&gt; puts Markdown.new('_Hello World!_').to_latex
+    \emph{Hello World!}
+
+    &gt;&gt; puts Markdown.new('_Hello World!_').to_groff_mm
+    .P
+    \fIHello world!\fR
+
     &gt;&gt; PEGMarkdown.new('Hello! World!')
 
 Installation / Hacking</diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
 task :default =&gt; :test
 
 DLEXT = Config::CONFIG['DLEXT']
-VERS = '1.0'
+VERS = '1.1'
 
 spec =
   Gem::Specification.new do |s|</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -29,10 +29,58 @@ rb_markdown_to_html(int argc, VALUE *argv, VALUE self)
     return result;
 }
 
+static VALUE
+rb_markdown_to_latex(int argc, VALUE *argv, VALUE self)
+{
+    /* grab char pointer to markdown input text */
+    VALUE text = rb_funcall(self, rb_intern(&quot;text&quot;), 0);
+    Check_Type(text, T_STRING);
+    char * ptext = StringValuePtr(text);
+
+    /* flip extension bits - note that defaults are different than
+     * for HTML */
+    int extensions = EXT_SMART | EXT_NOTES | EXT_FILTER_HTML | EXT_FILTER_STYLES;
+    if ( rb_funcall(self, rb_intern(&quot;smart&quot;), 0) == Qfalse )
+        extensions = extensions &amp; ~ EXT_SMART ;
+    if ( rb_funcall(self, rb_intern(&quot;notes&quot;), 0) == Qfalse )
+        extensions = extensions &amp; ~ EXT_NOTES ;
+
+    char *latex = markdown_to_string(ptext, extensions, LATEX_FORMAT);
+    VALUE result = rb_str_new2(latex);
+    free(latex);
+
+    return result;
+}
+
+static VALUE
+rb_markdown_to_groff_mm(int argc, VALUE *argv, VALUE self)
+{
+    /* grab char pointer to markdown input text */
+    VALUE text = rb_funcall(self, rb_intern(&quot;text&quot;), 0);
+    Check_Type(text, T_STRING);
+    char * ptext = StringValuePtr(text);
+
+    /* flip extension bits - note that defaults are different than
+     * for HTML */
+    int extensions = EXT_SMART | EXT_NOTES | EXT_FILTER_HTML | EXT_FILTER_STYLES;
+    if ( rb_funcall(self, rb_intern(&quot;smart&quot;), 0) == Qfalse )
+        extensions = extensions &amp; ~ EXT_SMART ;
+    if ( rb_funcall(self, rb_intern(&quot;notes&quot;), 0) == Qfalse )
+        extensions = extensions &amp; ~ EXT_NOTES ;
+
+    char *groff = markdown_to_string(ptext, extensions, GROFF_MM_FORMAT);
+    VALUE result = rb_str_new2(groff);
+    free(groff);
+
+    return result;
+}
+
 void Init_peg_markdown()
 {
     rb_cMarkdown = rb_define_class(&quot;PEGMarkdown&quot;, rb_cObject);
     rb_define_method(rb_cMarkdown, &quot;to_html&quot;, rb_markdown_to_html, -1);
+    rb_define_method(rb_cMarkdown, &quot;to_latex&quot;, rb_markdown_to_latex, -1);
+    rb_define_method(rb_cMarkdown, &quot;to_groff_mm&quot;, rb_markdown_to_groff_mm, -1);
 }
 
 // vim: ts=4 sw=4</diff>
      <filename>ext/markdown.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>16858b57173c7c492d06cb61e75d4bba532ef1f6</id>
    </parent>
  </parents>
  <author>
    <name>John MacFarlane</name>
    <email>jgm@berkeley.edu</email>
  </author>
  <url>http://github.com/rtomayko/rpeg-markdown/commit/26578d3ed070f12d2986ee4b229073770ade21b6</url>
  <id>26578d3ed070f12d2986ee4b229073770ade21b6</id>
  <committed-date>2008-08-08T15:27:28-07:00</committed-date>
  <authored-date>2008-08-08T13:55:26-07:00</authored-date>
  <message>Added to_latex and to_groff_mm methods to PEGMarkdown class.
Documented in README.markdown.
Bumped version to 1.1 in Rakefile.</message>
  <tree>2d9a9fc65ebf1caed2fffca7ea1417fc15a985cd</tree>
  <committer>
    <name>John MacFarlane</name>
    <email>jgm@berkeley.edu</email>
  </committer>
</commit>
