markitdown 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,7 +12,7 @@ Markitdown is a Ruby library that converts HTML to Markdown. It's powered by Nok
12
12
  * Definition lists
13
13
  * Tables
14
14
  * Underlines
15
- * Strikethroughs (strike tag)
15
+ * Strikethroughs (strike or del tags)
16
16
  * Highlights (mark tag)
17
17
  * Superscripts (sup tag)
18
18
 
@@ -89,6 +89,9 @@ module Markitdown
89
89
  when "strike"
90
90
  results << " ~~"
91
91
  after = "END_TAG(~~) "
92
+ when "del"
93
+ results << " ~~"
94
+ after = "END_TAG(~~) "
92
95
  when "mark"
93
96
  results << " =="
94
97
  after = "END_TAG(==) "
@@ -138,7 +141,7 @@ module Markitdown
138
141
  results << node.text.strip.gsub("\n","").gsub(/ {2,}/," ")
139
142
  when "code"
140
143
  if node.text.include?("\n")
141
- results << "\n\n #{node.text.gsub("\n","\n ")}\n\n"
144
+ results << "\n\n```\n#{node.text.gsub(/^\n/,"").gsub(/\n\s*$/,"")}\n```\n\n"
142
145
  else
143
146
  results << " `#{node.text}` "
144
147
  end
@@ -1,3 +1,3 @@
1
1
  module Markitdown
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -25,12 +25,14 @@ This is some free text
25
25
 
26
26
  This is some more free text
27
27
 
28
- This
29
- is
30
- a
31
- block
32
- of
33
- code
28
+ ```
29
+ This
30
+ is
31
+ a
32
+ block
33
+ of
34
+ code
35
+ ```
34
36
 
35
37
  This is a definition list
36
38
 
@@ -137,6 +137,14 @@ describe Markitdown do
137
137
  end
138
138
  end
139
139
 
140
+ context "When parsing an delete element that's followed by a punctuation" do
141
+ let(:html) { "<html><del>delete added</del>.</html>" }
142
+
143
+ it "should return valid markdown without a space" do
144
+ Markitdown.from_html(html).should == " ~~delete added~~."
145
+ end
146
+ end
147
+
140
148
  context "When parsing an highlight element that's followed by a punctuation" do
141
149
  let(:html) { "<html><mark>highlight added</mark>.</html>" }
142
150
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markitdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-31 00:00:00.000000000 Z
12
+ date: 2013-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: 4208653128680196527
106
+ hash: -2638333383769331236
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: 4208653128680196527
115
+ hash: -2638333383769331236
116
116
  requirements: []
117
117
  rubyforge_project:
118
118
  rubygems_version: 1.8.23