ZMediumToMarkdown 2.3.6 → 2.3.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: 406b61ab4281249d58e3eb2ad4ac02ffd5988d96d9da37037682d83e68a6a188
4
- data.tar.gz: 18e1fd9c5bbc8ea78447852af060ec97418c0ececf50574214a7e8a4a0b3482b
3
+ metadata.gz: 6aa04febbe53fb63849ed9bc0fdd83c1e30b67e808f42899e9ec2d4772db57bd
4
+ data.tar.gz: '09fb6a627ecb9c320b114113713464871d60fe1e2c32810ecba4c77ea11e5381'
5
5
  SHA512:
6
- metadata.gz: 86fcdb86f57b78737ce465c5ee447a126cf59bd1e2d3f9280bd797f2b18f96efc3c0c7d792a9b4d93c7cd736dc6714843287f9c3273dffe69ba581cd0c34f219
7
- data.tar.gz: f6ef68d1737f2a14b6ec6b8ea7385fec7bce06234f091f2b72eebe74892d11bd03be5850c7b5cce7fa12e7a425fefd98db4c9290aad96129bd7838b63d50aee6
6
+ metadata.gz: 3e58ac4d9c2f00113e9446594f75067c2f9a48a3c8c35f2ef752da024c19e18c77eb3f03f816b53a7c0c8fd6603b2790d08cd5986e6de7d858c555f0d17c9e91
7
+ data.tar.gz: eab3c050b0fdc2cfc0c85518cabdc4d9d3a1eda6de220046639fb76ccdb133540e9408640a1dec9b48574933f465d130b988fe072af6b40e79a78cd719b065db
data/lib/Helper.rb CHANGED
@@ -23,9 +23,14 @@ class Helper
23
23
  text.gsub(/(\*|_|`|\||\\|\{|\}|\[|\]|\(|\)|#|\+|\-|\.|\!)/){ |x| "\\#{x}" }
24
24
  end
25
25
 
26
- def self.escapeHTML(text)
27
- text = text.gsub(/(<)/, '&lt;')
28
- text = text.gsub(/(>)/, '&gt;')
26
+ def self.escapeHTML(text, toHTMLEntity = true)
27
+ if toHTMLEntity
28
+ text = text.gsub(/(<)/, '&lt;')
29
+ text = text.gsub(/(>)/, '&gt;')
30
+ else
31
+ text = text.gsub(/(<)/, '\<')
32
+ text = text.gsub(/(>)/, '\>')
33
+ end
29
34
  text
30
35
  end
31
36
 
@@ -8,6 +8,10 @@ class ImageDownloader
8
8
  dir.pop()
9
9
  Helper.createDirIfNotExist(dir.join("/"))
10
10
 
11
+ if File.exist?(path)
12
+ return true
13
+ end
14
+
11
15
  begin
12
16
  imageResponse = URI.open(url)
13
17
  File.write(path, imageResponse.read)
@@ -26,10 +26,6 @@ class MarkupParser
26
26
  Helper.makeWarningText("Error occurred during render markup text, please help to open an issue on github.")
27
27
  end
28
28
  end
29
-
30
- if isForJekyll
31
- result = Helper.escapeHTML(result)
32
- end
33
29
 
34
30
  result
35
31
  end
@@ -267,11 +267,13 @@ class MarkupStyleRender
267
267
  end
268
268
 
269
269
  if char.chars.join() != "\n"
270
- if !stack.select { |tag| tag.startChars.chars.join() == "`" }.nil?
270
+ if stack.select { |tag| tag.startChars.chars.join() == "`" }.length > 0
271
271
  # is in code block
272
272
  response.append(char)
273
273
  else
274
- resultChar = Helper.escapeMarkdown(char.chars.join())
274
+ resultChar = char.chars.join()
275
+ resultChar = Helper.escapeHTML(resultChar, isForJekyll)
276
+
275
277
  response.append(TextChar.new(resultChar.chars, "Text"))
276
278
  end
277
279
  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.3.6
4
+ version: 2.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-15 00:00:00.000000000 Z
11
+ date: 2024-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri