ZMediumToMarkdown 2.1.6 → 2.1.8

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
  SHA256:
3
- metadata.gz: 86e5929087cc7fbd4567db3c7e5c54735208388d92673453070e93b585788f33
4
- data.tar.gz: 0353e4a182eb2470162b314b431f7381f9ed6dff8b99cf930532297bf3b96a82
3
+ metadata.gz: e8f852c73a60ac2d43c28c9fed9b7c217df4b1afc34e77e14f73b9b949ba7530
4
+ data.tar.gz: cd7aae4e3b23d662fed1f89d7c078b141e947a06c816f6e53e954f2752b726e4
5
5
  SHA512:
6
- metadata.gz: 3a12c25f931886137c601ab7e840d6acecc654d3c3bc405272ee1d0d78d8fba14d1aa8948ef46c3462ff13907fcb0a6a19bff44c7012122fb846c0797bf50bd9
7
- data.tar.gz: 2dda8f8bf3e82dcb8a5a59c2fb01ae24e91dd6c292bdf31cb22a0f65ab3ada6dcee2a1647f24f72ca04dac6011e2d816f87f71082e1e5be883c7f98dbcab0701
6
+ metadata.gz: 25b1b6aa357c4cca7cb588da0668d181ade6ab89cee7556ad8dd1190c4c98a9e08d3ed88ff9354fe885da65a582bb97d1df0f1a753bf68f33ecbc64c6a0f10dc
7
+ data.tar.gz: 80dc1d96a5af95aa3940d77f7e166fe1d113ff5b729c428658101629518827f46312dbdc216a1343e1eada0d5162931f66ef563e81b5c8a42ec7a67a218fcaa7
data/lib/Helper.rb CHANGED
@@ -117,7 +117,7 @@ class Helper
117
117
  result += "description: \"#{postInfo.description&.gsub("\"", "\\\"")}\"\n"
118
118
  if !postInfo.previewImage.nil?
119
119
  result += "image:\r\n"
120
- result += " path: #{postInfo.previewImage}\r\n"
120
+ result += " path: /#{postInfo.previewImage}\r\n"
121
121
  end
122
122
  if isForJekyll
123
123
  result += "render_with_liquid: false\n"
@@ -197,28 +197,30 @@ class MarkupStyleRender
197
197
  elsif markup.anchorType == "USER"
198
198
  url = "https://medium.com/u/#{markup.userId}"
199
199
  end
200
-
201
- lastPath = url.split("/").last
202
- lastQuery = nil
203
- if !lastPath.nil?
204
- lastQuery = lastPath.split("-").last
205
- end
206
-
207
- if !usersPostURLs.nil? && !usersPostURLs.find { |usersPostURL| usersPostURL.split("/").last.split("-").last == lastQuery }.nil?
208
- if isForJekyll
209
- url = "(../#{lastQuery}/)"
210
- else
211
- url = "(#{lastPath})"
200
+
201
+ if url =~ /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}(:[0-9]{1,5})?(\/.*)?$/ix
202
+ lastPath = url.split("/").last
203
+ lastQuery = nil
204
+ if !lastPath.nil?
205
+ lastQuery = lastPath.split("-").last
212
206
  end
213
- else
214
- if isForJekyll
215
- url = "(#{url}){:target=\"_blank\"}"
207
+
208
+ if !usersPostURLs.nil? && !usersPostURLs.find { |usersPostURL| usersPostURL.split("/").last.split("-").last == lastQuery }.nil?
209
+ if isForJekyll
210
+ url = "(../#{lastQuery}/)"
211
+ else
212
+ url = "(#{lastPath})"
213
+ end
216
214
  else
217
- url = "(#{url})"
215
+ if isForJekyll
216
+ url = "(#{url}){:target=\"_blank\"}"
217
+ else
218
+ url = "(#{url})"
219
+ end
218
220
  end
221
+
222
+ tag = TagChar.new(1, markup.start, markup.end, "[", "]#{url}")
219
223
  end
220
-
221
- tag = TagChar.new(1, markup.start, markup.end, "[", "]#{url}")
222
224
  else
223
225
  Helper.makeWarningText("Undefined Markup Type: #{markup.type}.")
224
226
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZMediumToMarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-18 00:00:00.000000000 Z
11
+ date: 2023-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri