reverse_markdown 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +0 -2
- data/README.md +4 -2
- data/lib/reverse_markdown/mapper.rb +2 -2
- data/lib/reverse_markdown/version.rb +1 -1
- data/spec/assets/anchors.html +1 -0
- data/spec/components/anchors_spec.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac5927d92e320be20035fe28b809cf87aacae36a
|
4
|
+
data.tar.gz: 1bead226f4eaf6687c88244c912638a258642c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 807f78fcb2367cbb513b05ae6c60e775ef8efcb2af77dd8f654c7e5c1f127b5d7227d5f14f0d3ae491e626caba63ce1c5f2ace8a86699624747bdb58e7b46770
|
7
|
+
data.tar.gz: 9475e2ce04205f619b5fc9f670a42d1e091b586b469f4185fc290f0415bfeef35102d11b7920e38f9272d5cbfe71a16337610c9cdad5a5f62476f26620f021c6
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
Transform existing html into markdown in a simple way, for example if you want to import existings tags into your markdown based application.
|
4
4
|
|
5
|
-
[![Build Status](https://secure.travis-ci.org/xijo/reverse_markdown.png?branch=master)](https://travis-ci.org/xijo/reverse_markdown)
|
5
|
+
[![Build Status](https://secure.travis-ci.org/xijo/reverse_markdown.png?branch=master)](https://travis-ci.org/xijo/reverse_markdown) [![Gem Version](https://badge.fury.io/rb/reverse_markdown.png)](http://badge.fury.io/rb/reverse_markdown)
|
6
6
|
|
7
|
-
|
7
|
+
# Requirements
|
8
|
+
|
9
|
+
Depends on [Nokogiri](http://nokogiri.org/).
|
8
10
|
|
9
11
|
# Installation
|
10
12
|
|
@@ -126,7 +126,7 @@ module ReverseMarkdown
|
|
126
126
|
" `"
|
127
127
|
end
|
128
128
|
when :a
|
129
|
-
if !element.text.strip.empty? && element['href'] && !element['href'].start_with?('#')
|
129
|
+
if (!element.text.strip.empty? || element.children.map(&:name).include?('img')) && element['href'] && !element['href'].start_with?('#')
|
130
130
|
" ["
|
131
131
|
else
|
132
132
|
" "
|
@@ -167,7 +167,7 @@ module ReverseMarkdown
|
|
167
167
|
'` '
|
168
168
|
end
|
169
169
|
when :a
|
170
|
-
if !element.text.strip.empty? && element['href'] && !element['href'].start_with?('#')
|
170
|
+
if (!element.text.strip.empty? || element.children.map(&:name).include?('img')) && element['href'] && !element['href'].start_with?('#')
|
171
171
|
"](#{element['href']}#{title_markdown(element)})"
|
172
172
|
else
|
173
173
|
""
|
data/spec/assets/anchors.html
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
Period after the anchor: there shouldn't be an extra space after the <a href="http://foobar.com">anchor</a>. But inline, <a href="http://foobar.com">there</a> should be a space.
|
8
8
|
|
9
9
|
ignore <a href="foo.html"> </a> anchor tags with no link text
|
10
|
+
not ignore <a href="foo.html"><img src="image.png" alt="An Image" /></a> anchor tags with images
|
10
11
|
pass through the text of <a href="#content">internal jumplinks</a> without treating them as links
|
11
12
|
pass through the text of <a id="content">anchor tags with no href</a> without treating them as links
|
12
13
|
|
@@ -18,6 +18,7 @@ describe ReverseMarkdown::Mapper do
|
|
18
18
|
|
19
19
|
context "links to ignore" do
|
20
20
|
it { should include ' ignore anchor tags with no link text ' }
|
21
|
+
it { should include ' not ignore [ ![An Image](image.png) ](foo.html) anchor tags with images' }
|
21
22
|
it { should include ' pass through the text of internal jumplinks without treating them as links ' }
|
22
23
|
it { should include ' pass through the text of anchor tags with no href without treating them as links ' }
|
23
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reverse_markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Opper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project: reverse_markdown
|
147
|
-
rubygems_version: 2.0.
|
147
|
+
rubygems_version: 2.0.3
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Transform html code into markdown.
|