downr 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.yardopts +1 -0
- data/README.md +20 -6
- data/Rakefile +4 -8
- data/downr.gemspec +2 -0
- data/lib/downr.rb +14 -6
- data/lib/downr/action_view/helpers.rb +12 -3
- data/lib/downr/configuration.rb +6 -1
- data/lib/downr/markdown.rb +14 -3
- data/lib/downr/railtie.rb +4 -1
- data/lib/downr/render.rb +74 -6
- data/lib/downr/version.rb +1 -1
- data/lib/generators/downr/install/install_generator.rb +7 -1
- data/lib/generators/templates/downr.rb +119 -23
- data/spec/lib/downr/action_view/helpers_spec.rb +17 -0
- data/spec/lib/downr/configuration_spec.rb +5 -0
- data/spec/lib/downr/markdown_spec.rb +15 -0
- data/spec/lib/downr/render_spec.rb +6 -0
- data/spec/lib/downr/version_spec.rb +7 -0
- data/spec/lib/downr_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- metadata +73 -21
- checksums.yaml +0 -7
- data/test/lib/downr/configuration_test.rb +0 -11
- data/test/lib/downr/markdown_test.rb +0 -24
- data/test/lib/downr/render_test.rb +0 -19
- data/test/lib/downr/version_test.rb +0 -8
- data/test/test_helper.rb +0 -4
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--no-private --title "Downr Documentation" --markup markdown --quiet
|
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
# Downr
|
2
|
-
|
1
|
+
# Downr
|
2
|
+
[![Build Status](https://travis-ci.org/davidrivera/Downr.svg?branch=master)](https://travis-ci.org/davidrivera/Downr) [![Code Climate](https://codeclimate.com/github/davidrivera/Downr.png)](https://codeclimate.com/github/davidrivera/Downr) [![Gem Version](https://badge.fury.io/rb/downr.svg)](http://badge.fury.io/rb/downr) [![Dependency Status](https://gemnasium.com/davidrivera/Downr.svg)](https://gemnasium.com/davidrivera/Downr)
|
3
|
+
|
4
|
+
Downr is an easy to use rails wrapper around a couple of different notable gems
|
5
|
+
* [Redcarpet](https://github.com/vmg/redcarpet)
|
6
|
+
* [Pygmentize](https://github.com/djanowski/pygmentize)
|
7
|
+
* [Emoji](https://github.com/jsw0528/rails_emoji)
|
8
|
+
|
9
|
+
## So why use Downr
|
10
|
+
Good question, the best I can come up with is that if you're working on a rails project, this library provides a really easy way to add markdown parsing to it quickly with all the nice Github Flavored Markdown you know and love. It also allows you to edit all of the base options for Redcarpet through initializers, and finally gives you a nice view helper.
|
3
11
|
|
4
12
|
## Installation
|
5
13
|
|
@@ -25,19 +33,25 @@ this will create an initializer in
|
|
25
33
|
|
26
34
|
## Usage
|
27
35
|
|
28
|
-
Crack open the initializer `config/initializers/downr.rb` and add/change any configuration options for the markdown rendering process. These options are passed straight to
|
36
|
+
Crack open the initializer `config/initializers/downr.rb` and add/change any configuration options for the markdown rendering process. These options are passed straight to Redcarpet so you can head over [there](https://github.com/vmg/redcarpet) to check out all of the possible options.
|
29
37
|
|
30
38
|
### View Helpers
|
31
39
|
|
32
|
-
|
40
|
+
I know what those are!
|
41
|
+
|
42
|
+
```haml
|
43
|
+
render_markdown "# Hello World"
|
44
|
+
```
|
33
45
|
|
34
46
|
### Or use directly
|
35
47
|
|
36
|
-
|
48
|
+
```ruby
|
49
|
+
Downr::Markdown.render("# Hello World")
|
50
|
+
```
|
37
51
|
|
38
52
|
## Tests
|
39
53
|
|
40
|
-
|
54
|
+
Tests are run through the wonderful RSpec so just clone the library run `bundle` then `rake`
|
41
55
|
|
42
56
|
## Contributing
|
43
57
|
|
data/Rakefile
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
2
3
|
|
3
|
-
|
4
|
+
RSpec::Core::RakeTask.new
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
t.test_files = FileList['test/lib/downr/*_test.rb']
|
8
|
-
t.verbose = true
|
9
|
-
end
|
10
|
-
|
11
|
-
task :default => :test
|
6
|
+
task :default => :spec
|
7
|
+
task :test => :spec
|
data/downr.gemspec
CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
24
|
+
spec.add_development_dependency "yard"
|
23
25
|
|
24
26
|
spec.add_dependency 'rails', '>= 3.1.0'
|
25
27
|
spec.add_dependency "rails_emoji", "~> 1.7.1"
|
data/lib/downr.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'downr/configuration'
|
4
|
-
require 'downr/markdown'
|
5
|
-
|
1
|
+
# Don't include the view helpers if not
|
2
|
+
# being used with rails
|
6
3
|
if defined?(::Rails)
|
7
4
|
require 'downr/action_view/helpers'
|
8
5
|
require 'downr/railtie'
|
9
6
|
end
|
10
7
|
|
8
|
+
# Namespace for classes and modules that handle markdown parsing
|
11
9
|
module Downr
|
12
|
-
|
10
|
+
|
11
|
+
autoload :Pygmentize, 'pygmentize'
|
12
|
+
autoload :Redcarpet, 'redcarpet'
|
13
|
+
autoload :Render, 'downr/render'
|
14
|
+
autoload :Configuration, 'downr/configuration'
|
15
|
+
autoload :Markdown, 'downr/markdown'
|
16
|
+
|
17
|
+
# @attr [Configuration] configuration the configuration used for initializing the parser
|
18
|
+
# @attr [Markdown] markdown the markdown object created from the configuration
|
13
19
|
class << self
|
14
20
|
attr_accessor :configuration, :markdown
|
15
21
|
end
|
16
22
|
|
23
|
+
# static method to define a Configuration
|
24
|
+
# object with the given initialized data
|
17
25
|
def self.configure
|
18
26
|
self.configuration ||= Configuration.new
|
19
27
|
yield(configuration)
|
@@ -1,7 +1,16 @@
|
|
1
1
|
module Downr
|
2
|
+
|
3
|
+
# Helper namespace for views
|
2
4
|
module Helpers
|
3
|
-
|
4
|
-
|
5
|
+
|
6
|
+
# View helper to render a variable containing
|
7
|
+
# markdown in the view, calls html_safe on it!
|
8
|
+
#
|
9
|
+
# @param [String] markdown the markdown to render
|
10
|
+
#
|
11
|
+
# @return [String] html safe string
|
12
|
+
def render_markdown(markdown)
|
13
|
+
Downr::Markdown.render(markdown).html_safe
|
5
14
|
end
|
6
15
|
end
|
7
|
-
end
|
16
|
+
end
|
data/lib/downr/configuration.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
module Downr
|
2
2
|
|
3
|
+
# Container object for options
|
4
|
+
# parsed by initializer
|
5
|
+
#
|
6
|
+
# @attr [hash] options
|
3
7
|
class Configuration
|
4
8
|
@@options
|
5
9
|
|
6
10
|
attr_accessor :options
|
7
11
|
|
12
|
+
# Creates a Configuration object with blank options
|
8
13
|
def initialize
|
9
14
|
@@options = {}
|
10
15
|
end
|
11
16
|
end
|
12
|
-
end
|
17
|
+
end
|
data/lib/downr/markdown.rb
CHANGED
@@ -2,19 +2,30 @@ require 'redcarpet'
|
|
2
2
|
|
3
3
|
module Downr
|
4
4
|
|
5
|
+
# This class is a wrapper for the
|
6
|
+
# render method on Redcarpet
|
7
|
+
#
|
8
|
+
# @attr [Redcarpet::Markdown] renderer
|
5
9
|
class Markdown
|
6
10
|
@@renderer
|
7
11
|
|
8
12
|
attr_accessor :renderer
|
9
|
-
|
13
|
+
|
14
|
+
# Creates a new Markdown object
|
10
15
|
def initialize
|
11
16
|
options = Downr.configuration.options
|
12
|
-
|
17
|
+
|
18
|
+
render = Render.new(options)
|
13
19
|
|
14
20
|
@@renderer = Redcarpet::Markdown.new(render, options)
|
15
21
|
end
|
22
|
+
|
23
|
+
# Renders markdown
|
24
|
+
# @param [String] text
|
25
|
+
#
|
26
|
+
# @return [String] html
|
16
27
|
def self.render text
|
17
28
|
@@renderer.render(text)
|
18
29
|
end
|
19
30
|
end
|
20
|
-
end
|
31
|
+
end
|
data/lib/downr/railtie.rb
CHANGED
data/lib/downr/render.rb
CHANGED
@@ -1,25 +1,93 @@
|
|
1
|
-
require 'pygmentize'
|
2
|
-
require 'redcarpet'
|
3
|
-
|
4
1
|
module Downr
|
5
2
|
# This class wraps both pygmentize and
|
6
3
|
# RailsEmoji gems to create a custom renderer
|
7
4
|
class Render < Redcarpet::Render::HTML
|
5
|
+
|
6
|
+
# Initializes the Render object
|
7
|
+
#
|
8
|
+
# @option opts [Boolean] :pygmentize Code colors
|
9
|
+
# @option opts [Boolean] :emojify Icons
|
10
|
+
def initializer(opt)
|
11
|
+
opt = clean_options
|
12
|
+
@options = opt
|
13
|
+
end
|
14
|
+
|
15
|
+
# Hook for Redcarpet render
|
16
|
+
#
|
17
|
+
# @param [String] code the code snippet to parse
|
18
|
+
# @param [String] language the coding language
|
19
|
+
#
|
20
|
+
# @return [String] html
|
8
21
|
def block_code(code, language)
|
9
|
-
|
22
|
+
if(@options.pygmentize)
|
23
|
+
pygmentize(code, language)
|
24
|
+
else
|
25
|
+
return code
|
26
|
+
end
|
10
27
|
end
|
11
28
|
|
29
|
+
# Hook for Redcarpet render
|
30
|
+
#
|
31
|
+
# @param [String] text the p block
|
32
|
+
#
|
33
|
+
# @return [String] html
|
12
34
|
def paragraph(text)
|
13
|
-
emojify
|
35
|
+
if(@options.emojify)
|
36
|
+
return emojify(text)
|
37
|
+
else
|
38
|
+
return text
|
39
|
+
end
|
14
40
|
end
|
15
41
|
|
16
42
|
private
|
43
|
+
# Ensures we have options defined
|
44
|
+
#
|
45
|
+
# @private
|
46
|
+
#
|
47
|
+
# @option opts [Boolean] :pygmentize Code colors
|
48
|
+
# @option opts [Boolean] :emojify Icons
|
49
|
+
#
|
50
|
+
# @return [options] the new hash
|
51
|
+
def clean_options opts
|
52
|
+
a = {}
|
53
|
+
|
54
|
+
if(opts.has_key?(pygmentize))
|
55
|
+
a[:pygmentize] = opts.pygmentize
|
56
|
+
else
|
57
|
+
a[:pygmentize] = false
|
58
|
+
end
|
59
|
+
|
60
|
+
if(opts.has_key?(emojify))
|
61
|
+
a[:emojify] = opts.emojify
|
62
|
+
else
|
63
|
+
a[:emojify] = false
|
64
|
+
end
|
65
|
+
|
66
|
+
return opts
|
67
|
+
end
|
68
|
+
|
69
|
+
# Uses RailsEmoji to insert icons
|
70
|
+
#
|
71
|
+
# @private
|
72
|
+
#
|
73
|
+
# @param [String] content the string to parse
|
74
|
+
#
|
75
|
+
# @return [String] with icons
|
17
76
|
def emojify(content)
|
18
77
|
content.to_str.gsub(/:([a-z0-9\+\-_]+):/) do |match|
|
19
78
|
RailsEmoji.render match, size: '20x20'
|
20
79
|
end.html_safe if content.present?
|
21
80
|
end
|
22
|
-
|
81
|
+
|
82
|
+
#Uses Pygmentize to color code
|
83
|
+
#
|
84
|
+
# @private
|
85
|
+
#
|
86
|
+
# @param [String] code the code snippet to parse
|
87
|
+
# @param [String] language the coding language
|
88
|
+
#
|
89
|
+
# @return [String] html
|
90
|
+
def pygmentize(code, language)
|
23
91
|
language = language.nil? ? :sh : language
|
24
92
|
Pygmentize.process(code, language)
|
25
93
|
end
|
data/lib/downr/version.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
module Downr
|
2
|
-
|
2
|
+
|
3
|
+
# Generator for rails projects
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
3
5
|
source_root File.expand_path('../../../templates', __FILE__)
|
4
6
|
|
7
|
+
# Copies the default config
|
8
|
+
#
|
9
|
+
# @example Install
|
10
|
+
# rails g downr:install
|
5
11
|
def copy_files
|
6
12
|
copy_file 'downr.rb', 'config/initializers/downr.rb'
|
7
13
|
end
|
@@ -1,27 +1,123 @@
|
|
1
1
|
Downr.configure do |config|
|
2
2
|
config.options = {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
3
|
+
|
4
|
+
########################################################
|
5
|
+
#
|
6
|
+
# Downr options
|
7
|
+
#
|
8
|
+
########################################################
|
9
|
+
# use pygmentize to colorize code segments
|
10
|
+
pygmentize: true,
|
11
|
+
|
12
|
+
# use emojify for icons
|
13
|
+
emojify: true,
|
14
|
+
|
15
|
+
########################################################
|
16
|
+
# The following options are for Redcarpet and can be found at
|
17
|
+
# https://github.com/vmg/redcarpet
|
18
|
+
########################################################
|
19
|
+
#
|
20
|
+
########################################################
|
21
|
+
#
|
22
|
+
# Extensions
|
23
|
+
#
|
24
|
+
########################################################
|
25
|
+
# do not parse emphasis inside of words.
|
26
|
+
# Strings such as foo_bar_baz will not generate <em> tags.
|
27
|
+
no_intra_emphasis: true,
|
28
|
+
|
29
|
+
# parse tables, PHP-Markdown style.
|
30
|
+
tables: true,
|
31
|
+
|
32
|
+
# parse fenced code blocks, PHP-Markdown style.
|
33
|
+
# Blocks delimited with 3 or more ~ or backticks will be considered as code,
|
34
|
+
# without the need to be indented. An optional language name may be
|
35
|
+
# added at the end of the opening fence for the code block.
|
36
|
+
fenced_code_blocks: true,
|
37
|
+
|
38
|
+
# parse links even when they are not enclosed in <> characters.
|
39
|
+
# Autolinks for the http, https and ftp protocols will be
|
40
|
+
# automatically detected. Email addresses are also handled,
|
41
|
+
# and http links without protocol, but starting with www.
|
42
|
+
autolink: true,
|
43
|
+
|
44
|
+
# do not parse usual markdown code blocks. Markdown converts
|
45
|
+
# text with four spaces at the front of each line to code blocks.
|
46
|
+
# This options prevents it from doing so. Recommended to use with
|
47
|
+
# fenced_code_blocks: true.
|
48
|
+
disable_indented_code_blocks: false,
|
49
|
+
|
50
|
+
# parse strikethrough, PHP-Markdown style. Two ~ characters
|
51
|
+
# mark the start of a strikethrough, e.g. this is ~~good~~ bad.
|
52
|
+
strikethrough: true,
|
53
|
+
|
54
|
+
# HTML blocks do not require to be surrounded by an empty line
|
55
|
+
# as in the Markdown standard.
|
56
|
+
lax_spacing: true,
|
57
|
+
|
58
|
+
# A space is always required between the hash at the beginning
|
59
|
+
# of a header and its name, e.g. #this is my header would not be a valid header.
|
60
|
+
space_after_headers: false,
|
61
|
+
|
62
|
+
# parse superscripts after the ^ character; contiguous superscripts are nested
|
63
|
+
# together, and complex values can be enclosed in parenthesis, e.g. this is
|
64
|
+
# the 2^(nd) time.
|
65
|
+
superscript: true,
|
66
|
+
|
67
|
+
# parse underscored emphasis as underlines. This is _underlined_ but this
|
68
|
+
# is still *italic*.
|
69
|
+
underline: true,
|
70
|
+
|
71
|
+
# parse highlights. This is ==highlighted==. It looks like this:
|
72
|
+
# <mark>highlighted</mark>
|
73
|
+
highlight: true,
|
74
|
+
|
75
|
+
# parse quotes. This is a "quote". It looks like this: <q>quote</q>
|
76
|
+
quote: true,
|
77
|
+
|
78
|
+
# parse footnotes, PHP-Markdown style. A footnote works very much like a
|
79
|
+
# reference-style link: it consists of a marker next to the text (e.g.
|
80
|
+
# This is a sentence.[^1]) and a footnote definition on its own line
|
81
|
+
# anywhere within the document (e.g. [^1]: This is a footnote.).
|
82
|
+
footnotes: true,
|
83
|
+
|
84
|
+
########################################################
|
85
|
+
#
|
86
|
+
# Renderers
|
87
|
+
#
|
88
|
+
########################################################
|
89
|
+
#do not allow any user-inputted HTML in the output.
|
90
|
+
filter_html: false,
|
91
|
+
|
92
|
+
# do not generate any <img> tags.
|
93
|
+
no_images: false,
|
94
|
+
|
95
|
+
# do not generate any <a> tags.
|
96
|
+
no_links: false,
|
97
|
+
|
98
|
+
# do not generate any <style> tags.
|
99
|
+
no_styles: true,
|
100
|
+
|
101
|
+
# only generate links for protocols which are considered safe.
|
102
|
+
safe_links_only: false,
|
103
|
+
|
104
|
+
# add HTML anchors to each header in the output HTML,
|
105
|
+
# to allow linking to each section.
|
106
|
+
with_toc_data: true,
|
107
|
+
|
108
|
+
# insert HTML <br> tags inside on paragraphs where the origin
|
109
|
+
# Markdown document had newlines (by default,
|
110
|
+
# Markdown ignores these newlines).
|
111
|
+
hard_wrap: false,
|
112
|
+
|
113
|
+
# output XHTML-conformant tags. This option is always enabled
|
114
|
+
# in the Render::XHTML renderer.
|
115
|
+
xhtml: false,
|
116
|
+
|
117
|
+
# add prettyprint classes to <code> tags for google-code-prettify.
|
118
|
+
prettify: true,
|
119
|
+
|
120
|
+
# hash of extra attributes to add to links.
|
121
|
+
link_attributes: true,
|
26
122
|
}
|
27
123
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Downr::Helpers do
|
4
|
+
class DummyClass
|
5
|
+
end
|
6
|
+
before(:all) do
|
7
|
+
@dummy = DummyClass.new
|
8
|
+
@dummy.extend Downr::Helpers
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "helpers" do
|
12
|
+
it "renders markdown" do
|
13
|
+
@dummy.should respond_to(:render_markdown)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Downr::Markdown do
|
4
|
+
before(:each) do
|
5
|
+
Downr.configuration.stub(:options).and_return({})
|
6
|
+
Downr::Render.any_instance.stub(:new).and_return(Object)
|
7
|
+
Redcarpet::Markdown.any_instance.stub(:new).and_return(Object)
|
8
|
+
end
|
9
|
+
|
10
|
+
it { should respond_to(:renderer) }
|
11
|
+
|
12
|
+
it "should have a render method" do
|
13
|
+
Downr::Markdown.should respond_to(:render)
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: downr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- David Rivera
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-15 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,34 +30,71 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.14'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.14'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: yard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
39
76
|
- !ruby/object:Gem::Version
|
40
77
|
version: '0'
|
41
78
|
- !ruby/object:Gem::Dependency
|
42
79
|
name: rails
|
43
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
44
82
|
requirements:
|
45
|
-
- - '>='
|
83
|
+
- - ! '>='
|
46
84
|
- !ruby/object:Gem::Version
|
47
85
|
version: 3.1.0
|
48
86
|
type: :runtime
|
49
87
|
prerelease: false
|
50
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
51
90
|
requirements:
|
52
|
-
- - '>='
|
91
|
+
- - ! '>='
|
53
92
|
- !ruby/object:Gem::Version
|
54
93
|
version: 3.1.0
|
55
94
|
- !ruby/object:Gem::Dependency
|
56
95
|
name: rails_emoji
|
57
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
58
98
|
requirements:
|
59
99
|
- - ~>
|
60
100
|
- !ruby/object:Gem::Version
|
@@ -62,6 +102,7 @@ dependencies:
|
|
62
102
|
type: :runtime
|
63
103
|
prerelease: false
|
64
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
65
106
|
requirements:
|
66
107
|
- - ~>
|
67
108
|
- !ruby/object:Gem::Version
|
@@ -69,6 +110,7 @@ dependencies:
|
|
69
110
|
- !ruby/object:Gem::Dependency
|
70
111
|
name: pygmentize
|
71
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
72
114
|
requirements:
|
73
115
|
- - ~>
|
74
116
|
- !ruby/object:Gem::Version
|
@@ -76,6 +118,7 @@ dependencies:
|
|
76
118
|
type: :runtime
|
77
119
|
prerelease: false
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
79
122
|
requirements:
|
80
123
|
- - ~>
|
81
124
|
- !ruby/object:Gem::Version
|
@@ -83,6 +126,7 @@ dependencies:
|
|
83
126
|
- !ruby/object:Gem::Dependency
|
84
127
|
name: redcarpet
|
85
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
86
130
|
requirements:
|
87
131
|
- - ~>
|
88
132
|
- !ruby/object:Gem::Version
|
@@ -90,6 +134,7 @@ dependencies:
|
|
90
134
|
type: :runtime
|
91
135
|
prerelease: false
|
92
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
93
138
|
requirements:
|
94
139
|
- - ~>
|
95
140
|
- !ruby/object:Gem::Version
|
@@ -102,7 +147,9 @@ extensions: []
|
|
102
147
|
extra_rdoc_files: []
|
103
148
|
files:
|
104
149
|
- .gitignore
|
150
|
+
- .rspec
|
105
151
|
- .travis.yml
|
152
|
+
- .yardopts
|
106
153
|
- Gemfile
|
107
154
|
- LICENSE.txt
|
108
155
|
- README.md
|
@@ -117,38 +164,43 @@ files:
|
|
117
164
|
- lib/downr/version.rb
|
118
165
|
- lib/generators/downr/install/install_generator.rb
|
119
166
|
- lib/generators/templates/downr.rb
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
123
|
-
-
|
124
|
-
-
|
167
|
+
- spec/lib/downr/action_view/helpers_spec.rb
|
168
|
+
- spec/lib/downr/configuration_spec.rb
|
169
|
+
- spec/lib/downr/markdown_spec.rb
|
170
|
+
- spec/lib/downr/render_spec.rb
|
171
|
+
- spec/lib/downr/version_spec.rb
|
172
|
+
- spec/lib/downr_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
125
174
|
homepage: https://github.com/davidrivera/Downr
|
126
175
|
licenses:
|
127
176
|
- MIT
|
128
|
-
metadata: {}
|
129
177
|
post_install_message:
|
130
178
|
rdoc_options: []
|
131
179
|
require_paths:
|
132
180
|
- lib
|
133
181
|
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
134
183
|
requirements:
|
135
|
-
- - '>='
|
184
|
+
- - ! '>='
|
136
185
|
- !ruby/object:Gem::Version
|
137
186
|
version: '0'
|
138
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
139
189
|
requirements:
|
140
|
-
- - '>='
|
190
|
+
- - ! '>='
|
141
191
|
- !ruby/object:Gem::Version
|
142
192
|
version: '0'
|
143
193
|
requirements: []
|
144
194
|
rubyforge_project:
|
145
|
-
rubygems_version:
|
195
|
+
rubygems_version: 1.8.23
|
146
196
|
signing_key:
|
147
|
-
specification_version:
|
197
|
+
specification_version: 3
|
148
198
|
summary: Custom wrapper for RedCarpet
|
149
199
|
test_files:
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
153
|
-
-
|
154
|
-
-
|
200
|
+
- spec/lib/downr/action_view/helpers_spec.rb
|
201
|
+
- spec/lib/downr/configuration_spec.rb
|
202
|
+
- spec/lib/downr/markdown_spec.rb
|
203
|
+
- spec/lib/downr/render_spec.rb
|
204
|
+
- spec/lib/downr/version_spec.rb
|
205
|
+
- spec/lib/downr_spec.rb
|
206
|
+
- spec/spec_helper.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 47a1548672b69a130d1bb41662828bf269fd2616
|
4
|
-
data.tar.gz: 67261c8eb08efbe1fd396293763976dd96007928
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 24abd6a022e98213f8f1b6abb196b5cee51ed79b9405f9ada7cc994f14b20e9fe671438e281ad2a2b932c42b049e8131e47098abd55e53c18ffc0af78e7018b1
|
7
|
-
data.tar.gz: b7045e0c5f3f71fe01c8b4d79a4b7260198ac714c7b43b580d96bbb146ce5e144a628f6f0285400fbba04b53c353ef65180f860d57716da1ea7565a70a9476bb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
|
3
|
-
describe Downr::Markdown do
|
4
|
-
subject { Downr::Markdown }
|
5
|
-
|
6
|
-
describe "Object itself" do
|
7
|
-
it "must be initialized" do
|
8
|
-
a = Downr::Markdown.new
|
9
|
-
a.wont_be_nil
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "render" do
|
14
|
-
|
15
|
-
it "must have a render" do
|
16
|
-
subject.must_respond_to(:render)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "must render markdown" do
|
20
|
-
a = Downr::Markdown.render("# hello")
|
21
|
-
assert_equal "<h1>hello</h1>\n", a
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
|
3
|
-
describe Downr::Render do
|
4
|
-
subject { Downr::Render }
|
5
|
-
|
6
|
-
describe "functions" do
|
7
|
-
before do
|
8
|
-
@a = Downr::Render.new
|
9
|
-
end
|
10
|
-
|
11
|
-
it "must have block_code" do
|
12
|
-
@a.must_respond_to(:block_code)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "must have paragrah" do
|
16
|
-
@a.must_respond_to(:paragraph)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/test/test_helper.rb
DELETED