Skip to content

Commit

Permalink
Changed lesstile formatting over to use Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhoad committed Aug 12, 2009
1 parent 2dc1267 commit 41a1736
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/models/comment.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def validate
end

def apply_filter
self.body_html = Lesstile.format_as_xhtml(self.body, :code_formatter => Lesstile::CodeRayFormatter)
self.body_html = EnkiFormatter.format_as_xhtml(self.body)
end

def blank_openid_fields
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/comments/show.html.erb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= form.input :author %>
<%= form.input :author_url, :required => false %>
<%= form.input :author_email, :required => false %>
<%= form.input :body, :hint => "<a href='http://lesstile.rubyforge.org'>Lesstile enabled</a>." %>
<%= form.input :body, :hint => "<a href='http://daringfireball.net/projects/markdown/syntax'>Markdown enabled</a>." %>
<% end %>
<% form.button_field_set do -%>
<%= form.commit_button("Save") %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/posts/_form.html.erb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% form.input_field_set do -%>
<%= form.input :title -%>
<%= form.input :body, :hint => "<a href='http://hobix.com/textile/quick.html'>Textile enabled</a>. Use Ctrl+E to switch between preview and edit mode." -%>
<%= form.input :body, :hint => "<a href='http://daringfireball.net/projects/markdown/syntax'>Markdown enabled</a>. Use Ctrl+E to switch between preview and edit mode." -%>
<%= form.input :tag_list, :as => 'string', :required => false, :hint => 'Comma separated: ruby, rails&hellip;' -%>
<% end -%>
<% form.input_field_set do -%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/show.html.erb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<% form_for([@post, @comment]) do |form| -%>
<div>
<p><%= form.text_field 'author' %><label for="comment_author"><small>Name or <a href="http://openidexplained.com/">OpenID</a> (required)</small></label></p>
<p><%= form.text_area 'body' %><br /><small>(<a href="http://lesstile.rubyforge.org">lesstile enabled</a> - surround code blocks with ---)</small></p>
<p><%= form.text_area 'body' %><br /><small><a href="http://daringfireball.net/projects/markdown/syntax">Markdown enabled</a></small></p>
<p><%= submit_tag "Add Comment" %></p>
</div>
<% end -%>
4 changes: 1 addition & 3 deletions config/environment.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
# config.load_paths += %W( #{RAILS_ROOT}/extras )

# Specify gems that this application depends on and have them installed with rake gems:install
config.gem "RedCloth", :lib => "redcloth", :version => "~> 4.0"
config.gem "bluecloth", :version => ">= 2.0.1"
config.gem "ruby-openid", :lib => "openid", :version => "~> 2.1.0"
config.gem "chronic", :version => "~> 0.2.0"
config.gem "coderay", :version => "~> 0.8.0"
config.gem "lesstile", :version => "~> 0.3"
config.gem "mislav-will_paginate", :lib => "will_paginate", :version => "~> 2.3", :source => 'http://gems.github.com'

# Only load the plugins named here, in the order given (default is alphabetical).
Expand Down
6 changes: 1 addition & 5 deletions lib/enki_formatter.rb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
class EnkiFormatter
class << self
def format_as_xhtml(text)
Lesstile.format_as_xhtml(
text,
:text_formatter => lambda {|text| RedCloth.new(CGI::unescapeHTML(text)).to_html},
:code_formatter => Lesstile::CodeRayFormatter
)
BlueCloth.new(text).to_html
end
end
end

0 comments on commit 41a1736

Please sign in to comment.