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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45f219ceeb5b8f6b5335a59a703acb94a6c8399b
4
- data.tar.gz: 55a5c829500c1a5ed25c207c089f882845213111
3
+ metadata.gz: ac5927d92e320be20035fe28b809cf87aacae36a
4
+ data.tar.gz: 1bead226f4eaf6687c88244c912638a258642c45
5
5
  SHA512:
6
- metadata.gz: 47fa3fa3174686440999f840455753231fddb4cf64f420badf55c754d646544da6629325bdb772ea3d3ac6daf03cb088543ec2240968ccee26b1d52fbc85e1e3
7
- data.tar.gz: f1d33bd66029bfe9297c4ce590e53eb6935ce0126977cab38534ecd10bc96d89dcad727b36a36bd414a1886a827d17c42505a1bd98065950bcaf3eccf6664893
6
+ metadata.gz: 807f78fcb2367cbb513b05ae6c60e775ef8efcb2af77dd8f654c7e5c1f127b5d7227d5f14f0d3ae491e626caba63ce1c5f2ace8a86699624747bdb58e7b46770
7
+ data.tar.gz: 9475e2ce04205f619b5fc9f670a42d1e091b586b469f4185fc290f0415bfeef35102d11b7920e38f9272d5cbfe71a16337610c9cdad5a5f62476f26620f021c6
data/.gitignore CHANGED
@@ -1,6 +1,8 @@
1
1
  *.gem
2
2
  .bundle
3
3
  .rvmrc
4
+ .ruby-version
5
+ .ruby-gemset
4
6
  Gemfile.lock
5
7
  pkg/*
6
8
  coverage/*
data/.travis.yml CHANGED
@@ -1,9 +1,7 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.2
4
3
  - 1.9.3
5
4
  - 2.0.0
6
- - ree
7
5
 
8
6
  script: "bundle exec rake spec"
9
7
 
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
- [![Gem Version](https://badge.fury.io/rb/reverse_markdown.png)](http://badge.fury.io/rb/reverse_markdown)
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
  ""
@@ -1,3 +1,3 @@
1
1
  module ReverseMarkdown
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
@@ -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
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-03-18 00:00:00.000000000 Z
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.0
147
+ rubygems_version: 2.0.3
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Transform html code into markdown.