forem-markdown_formatter 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Nicholas Rutherford"]
9
9
  s.email = ["nick.rutherford@gmail.com"]
10
10
  s.homepage = "https://github.com/nruth/forem-markdown_formatter"
11
- s.summary = %q{Markdown formatting for forem posts}
12
- s.description = %q{Replaces the forem Rails engine's default formatting with Markdown}
11
+ s.summary = %q{Redcarpet Markdown formatting for forem posts}
12
+ s.description = %q{Replaces the forem Rails engine's default formatting with Redcarpet Markdown}
13
13
 
14
14
  s.rubyforge_project = "forem-markdown_formatter"
15
15
 
@@ -1,12 +1,4 @@
1
1
  require "forem-markdown_formatter/version"
2
- require 'redcarpet'
2
+ require 'forem/formatters/redcarpet'
3
3
 
4
- module Forem
5
- module FormattingHelper
6
- def as_formatted_html(text)
7
- return text if text.blank?
8
- formatter = ::Redcarpet::Markdown.new(Redcarpet::Render::HTML)
9
- formatter.render(text).html_safe
10
- end
11
- end
12
- end
4
+ Forem.formatter = Forem::Formatters::Redcarpet
@@ -1,5 +1,5 @@
1
1
  module Forem
2
2
  module MarkdownFormatter
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,12 @@
1
+ require 'redcarpet'
2
+
3
+ module Forem
4
+ module Formatters
5
+ class Redcarpet
6
+ def self.format(text)
7
+ formatter = ::Redcarpet::Markdown.new(::Redcarpet::Render::HTML)
8
+ formatter.render(ERB::Util.h(text)).html_safe
9
+ end
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forem-markdown_formatter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nicholas Rutherford
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-14 00:00:00 Z
18
+ date: 2011-10-27 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: "0"
64
64
  type: :runtime
65
65
  version_requirements: *id003
66
- description: Replaces the forem Rails engine's default formatting with Markdown
66
+ description: Replaces the forem Rails engine's default formatting with Redcarpet Markdown
67
67
  email:
68
68
  - nick.rutherford@gmail.com
69
69
  executables: []
@@ -80,6 +80,7 @@ files:
80
80
  - forem-markdown_formatter.gemspec
81
81
  - lib/forem-markdown_formatter.rb
82
82
  - lib/forem-markdown_formatter/version.rb
83
+ - lib/forem/formatters/redcarpet.rb
83
84
  homepage: https://github.com/nruth/forem-markdown_formatter
84
85
  licenses: []
85
86
 
@@ -112,6 +113,6 @@ rubyforge_project: forem-markdown_formatter
112
113
  rubygems_version: 1.8.10
113
114
  signing_key:
114
115
  specification_version: 3
115
- summary: Markdown formatting for forem posts
116
+ summary: Redcarpet Markdown formatting for forem posts
116
117
  test_files: []
117
118