summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2008-09-25 16:12:40 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2008-09-25 16:12:40 +0200
commitf298b96b345b4dff2fabf5dc789ae44a99deb444 (patch)
treeb22c20401d6b45a3654552ddb9d39eaf4c6b3fa4
parentc3bb52e4479e43700ef0a90755904c92351d046d (diff)
downloadtrivium-f298b96b345b4dff2fabf5dc789ae44a99deb444.tar.gz
trivium-f298b96b345b4dff2fabf5dc789ae44a99deb444.tar.xz
trivium-f298b96b345b4dff2fabf5dc789ae44a99deb444.zip
Use inject instead of nested calls for formatting
-rw-r--r--trivium.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/trivium.rb b/trivium.rb
index fc5d652..2470a00 100644
--- a/trivium.rb
+++ b/trivium.rb
@@ -91,12 +91,9 @@ class Dots < String
 end
 
 def format(e)
-  RubyPants.new(
-  BlueCloth.new(
-  Dots.new(
-  InlineMath.new(
-    e[:body]
-  ).to_html).to_html).to_html).to_html
+  [InlineMath, Dots, BlueCloth, RubyPants].inject(e[:body]) { |a,e|
+    e.new(a).to_html
+  }
 end
 
 def template(template, data)