devcenter-parser 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ require File.expand_path("./lib/devcenter-parser")
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "devcenter-parser"
6
6
  gem.version = DevcenterParser::VERSION
7
- gem.authors = ["Raul Murciano"]
7
+ gem.authors = ["Heroku"]
8
8
  gem.email = ["raul@heroku.com"]
9
9
  gem.homepage = "https://devcenter.heroku.com"
10
10
  gem.summary = "Parser for Heroku Dev Center's content"
@@ -6,7 +6,7 @@ require 'sanitize'
6
6
 
7
7
  module DevcenterParser
8
8
 
9
- VERSION = '1.0.0'
9
+ VERSION = '1.1.0'
10
10
 
11
11
  AVAILABLE_FLAVOURS = [:github, :maruku]
12
12
 
@@ -14,6 +14,10 @@ module DevcenterParser
14
14
  class InvalidRawHTMLError < Exception; end
15
15
  class UnknownFlavourError < Exception; end
16
16
 
17
+ class HTMLWithPantsRenderer < Redcarpet::Render::HTML
18
+ include Redcarpet::Render::SmartyPants
19
+ end
20
+
17
21
  def self.to_html(markdown, flavour)
18
22
  html = to_unsanitized_html(markdown, flavour.to_sym)
19
23
  sanitize(html)
@@ -50,7 +54,7 @@ module DevcenterParser
50
54
  private
51
55
 
52
56
  def self.github_parser
53
- @@github_parser ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, fenced_code_blocks: true)
57
+ @@github_parser ||= Redcarpet::Markdown.new(HTMLWithPantsRenderer, fenced_code_blocks: true)
54
58
  end
55
59
 
56
60
  def self.sanitize_config
@@ -1,7 +1,7 @@
1
+ # encoding: utf-8
1
2
  require 'minitest/autorun'
2
3
  require_relative '../lib/devcenter-parser'
3
4
 
4
-
5
5
  describe 'DevcenterParser' do
6
6
 
7
7
  describe '.to_unsanitized_html' do
@@ -178,8 +178,15 @@ And that's it.
178
178
  end
179
179
  end
180
180
 
181
+ it "does emdashes both in all flavours" do
182
+ md = "foo -- bar"
183
+ html = '<p>foo – bar</p>'
184
+ assert_all_flavours_result(md, html)
185
+ end
186
+
181
187
  end
182
188
 
189
+
183
190
  # helpers
184
191
 
185
192
  def assert_all_flavours_result(md, expected)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devcenter-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Raul Murciano
8
+ - Heroku
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-21 00:00:00.000000000 Z
12
+ date: 2013-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: maruku
@@ -130,3 +130,4 @@ specification_version: 3
130
130
  summary: Parser for Heroku Dev Center's content
131
131
  test_files:
132
132
  - test/devcenter-parser_test.rb
133
+ has_rdoc: