reverse_markdown 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -0
- data/README.md +9 -1
- data/lib/reverse_markdown/mapper.rb +2 -2
- data/lib/reverse_markdown/version.rb +1 -1
- data/spec/assets/basic.html +2 -0
- data/spec/components/basic_spec.rb +2 -0
- metadata +17 -35
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 45f219ceeb5b8f6b5335a59a703acb94a6c8399b
|
4
|
+
data.tar.gz: 55a5c829500c1a5ed25c207c089f882845213111
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 47fa3fa3174686440999f840455753231fddb4cf64f420badf55c754d646544da6629325bdb772ea3d3ac6daf03cb088543ec2240968ccee26b1d52fbc85e1e3
|
7
|
+
data.tar.gz: f1d33bd66029bfe9297c4ce590e53eb6935ce0126977cab38534ecd10bc96d89dcad727b36a36bd414a1886a827d17c42505a1bd98065950bcaf3eccf6664893
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Transform existing html into markdown in a simple way, for example if you want t
|
|
4
4
|
|
5
5
|
[![Build Status](https://secure.travis-ci.org/xijo/reverse_markdown.png?branch=master)](https://travis-ci.org/xijo/reverse_markdown)
|
6
6
|
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/reverse_markdown.png)](http://badge.fury.io/rb/reverse_markdown)
|
8
|
+
|
7
9
|
# Installation
|
8
10
|
|
9
11
|
Install the gem:
|
@@ -38,11 +40,17 @@ $ reverse_markdown file.html > file.markdown
|
|
38
40
|
$ cat file.html | reverse_markdown > file.markdown
|
39
41
|
````
|
40
42
|
|
43
|
+
Additionally there is a support for github-like multiline code which is indented with "`":
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
ReverseMarkdown.parse_string(input, github_style_code_blocks: true)
|
47
|
+
````
|
48
|
+
|
41
49
|
# Tag support
|
42
50
|
|
43
51
|
Only basic html tags are supported right now. However, it should not be to difficult to add some. Feel free to contribute or notify me about missing stuff.
|
44
52
|
|
45
|
-
- supported tags: h1
|
53
|
+
- supported tags: `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `p`, `em`, `strong`, `i`, `b`, `blockquote`, `code`, `img`, `a`, `hr`, `li`, `ol`, `ul`
|
46
54
|
- nested lists
|
47
55
|
- inline and block code
|
48
56
|
|
@@ -110,7 +110,7 @@ module ReverseMarkdown
|
|
110
110
|
else
|
111
111
|
"\n\n"
|
112
112
|
end
|
113
|
-
when :h1, :h2, :h3, :h4 # /h(\d)/ for 1.9
|
113
|
+
when :h1, :h2, :h3, :h4, :h5, :h6 # /h(\d)/ for 1.9
|
114
114
|
element.name =~ /h(\d)/
|
115
115
|
"\n" + ('#' * $1.to_i) + ' '
|
116
116
|
when :em, :i
|
@@ -152,7 +152,7 @@ module ReverseMarkdown
|
|
152
152
|
"\n\n"
|
153
153
|
when :div
|
154
154
|
"\n"
|
155
|
-
when :h1, :h2, :h3, :h4 # /h(\d)/ for 1.9
|
155
|
+
when :h1, :h2, :h3, :h4, :h5, :h6 # /h(\d)/ for 1.9
|
156
156
|
"\n"
|
157
157
|
when :em, :i
|
158
158
|
element.text.strip.empty? ? '' : '_' if (element.ancestors('em') + element.ancestors('i')).empty?
|
data/spec/assets/basic.html
CHANGED
@@ -11,6 +11,8 @@ describe ReverseMarkdown::Mapper do
|
|
11
11
|
it { should match /## h2\n/ }
|
12
12
|
it { should match /### h3\n/ }
|
13
13
|
it { should match /#### h4\n/ }
|
14
|
+
it { should match /##### h5\n/ }
|
15
|
+
it { should match /###### h6\n/ }
|
14
16
|
|
15
17
|
it { should match /_em tag content_/ }
|
16
18
|
it { should match /before and after empty em tags/ }
|
metadata
CHANGED
@@ -1,94 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reverse_markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Johannes Opper
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: simplecov
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: redcarpet
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
description: Map simple html back into markdown, e.g. if you want to import existing
|
@@ -138,33 +127,26 @@ files:
|
|
138
127
|
- spec/spec_helper.rb
|
139
128
|
homepage: http://github.com/xijo/reverse_markdown
|
140
129
|
licenses: []
|
130
|
+
metadata: {}
|
141
131
|
post_install_message:
|
142
132
|
rdoc_options: []
|
143
133
|
require_paths:
|
144
134
|
- lib
|
145
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
136
|
requirements:
|
148
|
-
- -
|
137
|
+
- - '>='
|
149
138
|
- !ruby/object:Gem::Version
|
150
139
|
version: '0'
|
151
|
-
segments:
|
152
|
-
- 0
|
153
|
-
hash: 1284712434240265235
|
154
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
141
|
requirements:
|
157
|
-
- -
|
142
|
+
- - '>='
|
158
143
|
- !ruby/object:Gem::Version
|
159
144
|
version: '0'
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
hash: 1284712434240265235
|
163
145
|
requirements: []
|
164
146
|
rubyforge_project: reverse_markdown
|
165
|
-
rubygems_version:
|
147
|
+
rubygems_version: 2.0.0
|
166
148
|
signing_key:
|
167
|
-
specification_version:
|
149
|
+
specification_version: 4
|
168
150
|
summary: Transform html code into markdown.
|
169
151
|
test_files:
|
170
152
|
- spec/assets/anchors.html
|