ZMediumToMarkdown 2.1.5 → 2.1.7

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: 94a7ba6ab1c472f3aa523a43e9759a7b6a679c6c96885a64385bd182ea1a9f11
4
- data.tar.gz: e0a26ed5df87ad811c6045d7a7dff7128c00c39039e905eada185dcaede0df9f
3
+ metadata.gz: bb51b2e2b79015a9435e17913928e528af1f03a450211913307da00b0d996b96
4
+ data.tar.gz: 179de5ebddf33ae1e1758563ec24cccf3601afd5b6ce87a0c3a18aa5e6823ddd
5
5
  SHA512:
6
- metadata.gz: 867ac5286ef4a8ccd43b11380a2da119dc89d80411f456c83040f500db55a741c72bc4319838ab851cbe5523763d68a40eb7173a8a20598c202ac6e77b3f8fea
7
- data.tar.gz: 3643376b627e46802f058271512baa01c2b233222c256cfb948b637302085b1b0d4dadb052e322322286ea401438d870826b15a7bf2a80f29bb1cebdbc4c663a
6
+ metadata.gz: 4b118c821db74a2fed2da4cc6b422fa3b01a4e100a0894c5a0b605fcdb18c2a25e9c2018de885b1cf81a5fbb07b894af25ebfe528db6339d749136511ab0d78c
7
+ data.tar.gz: 70d7929c1c0556319b9bb35d35915d1ef10380ad73f37b165642d506355175c0751daaffeabfbf0dc1fcb47df2f04ac621306d8465fb5e9d275aecaf50353929
@@ -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
data/lib/Post.rb CHANGED
@@ -61,8 +61,8 @@ class Post
61
61
 
62
62
  def self.parsePostInfoFromPostContent(content, postID, pathPolicy)
63
63
  postInfo = PostInfo.new()
64
- postInfo.description = content&.dig("Post:#{postID}", "previewContent", "subtitle")
65
- postInfo.title = content&.dig("Post:#{postID}", "title")
64
+ postInfo.description = content&.dig("Post:#{postID}", "previewContent", "subtitle")&.gsub(/[^[:print:]]/ , '')
65
+ postInfo.title = content&.dig("Post:#{postID}", "title")&.gsub(/[^[:print:]]/ , '')
66
66
  postInfo.tags = content&.dig("Post:#{postID}", "tags").map{ |tag| tag["__ref"].gsub! 'Tag:', '' }
67
67
 
68
68
  previewImage = content&.dig("Post:#{postID}", "previewImage", "__ref")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZMediumToMarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi