diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2008-09-21 00:59:43 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2008-09-21 00:59:43 +0200 |
commit | 439f675c5e9cc61c5a41667b9051889accc74949 (patch) | |
tree | b1733c54f3fb8718db11877e3a08885cbc6c1b35 | |
parent | a613e52c8cc33475242ab508438e967b3a447f4a (diff) | |
download | trivium-439f675c5e9cc61c5a41667b9051889accc74949.tar.gz trivium-439f675c5e9cc61c5a41667b9051889accc74949.tar.xz trivium-439f675c5e9cc61c5a41667b9051889accc74949.zip |
Substitute leading whitespace in quotes with en-spaces
-rw-r--r-- | trivium.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/trivium.rb b/trivium.rb index 77d7fcf..2680a6e 100644 --- a/trivium.rb +++ b/trivium.rb @@ -69,7 +69,9 @@ class Dots < String else src = %{<span class="source">— #{args.strip}</span>} end - %{<div class="quote">#{BlueCloth.new((body + src).gsub(/^.*$/, '> \& ')).to_html}</div>} + text = (body + src).gsub(/^ +/) { " " * $&.size }. + gsub(/^.*$/, '> \& ') + %{<div class="quote">#{BlueCloth.new(text).to_html}</div>} when "math" body << "\\eqno{#{args.strip}}" unless args.strip.empty? %{<div class="math"><img alt="#{CGI.escapeHTML body}" src="#{MATH_TEX}#{CGI.escape(body).gsub('+', '%20')}"></div>} |