ZMediumToMarkdown 2.3.6 → 2.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 406b61ab4281249d58e3eb2ad4ac02ffd5988d96d9da37037682d83e68a6a188
4
- data.tar.gz: 18e1fd9c5bbc8ea78447852af060ec97418c0ececf50574214a7e8a4a0b3482b
3
+ metadata.gz: a97b61290289e8989c8bd6283be69f1e8167636b0489d7af46b66a5ec7307936
4
+ data.tar.gz: 9d270ec137cf4cae7438f9038ec79fa7bd09748e891d82aeda47d0ed4fd4f1dd
5
5
  SHA512:
6
- metadata.gz: 86fcdb86f57b78737ce465c5ee447a126cf59bd1e2d3f9280bd797f2b18f96efc3c0c7d792a9b4d93c7cd736dc6714843287f9c3273dffe69ba581cd0c34f219
7
- data.tar.gz: f6ef68d1737f2a14b6ec6b8ea7385fec7bce06234f091f2b72eebe74892d11bd03be5850c7b5cce7fa12e7a425fefd98db4c9290aad96129bd7838b63d50aee6
6
+ metadata.gz: 16767e5244986c9ece667ce4c6f26a2a676253b1421a202a4a2820225dd248b249d6df424474ae400c851f6c30c7011c0379384d2e3f7bd52060809cfde807e4
7
+ data.tar.gz: 9616218726f4dcea5d00cbbb5ad75fe15ae9c6aa2eae1f29232fc9c27eef5bccc7da3ca056caef791098ff044f2262ee4946e613212a22d431011e1f712bbb17
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
 
@@ -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.7
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