ZMediumToMarkdown 1.9.5 → 1.9.6

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: d96b986a3f8f82236b20c8db706b3a6b4451b5822ab4c940e855ee6e819a0087
4
- data.tar.gz: 6cb9b1e76ba0486d4f96394c9153850185ddd9397f5b99ce29d896ad2f638e42
3
+ metadata.gz: acc5589c92b8dd859f91b98fe7c2f1073a39af102ee8ebce27f1351824ffcab7
4
+ data.tar.gz: b14f257296741edd700bf484c37da6b2e386ddfb96dffca540b60cea8c04fecc
5
5
  SHA512:
6
- metadata.gz: bdfdfc9d261bfc62114b799b657af0635f8c72415c040cd08934fd0fd84c7bcf73855f3204f5c6ce9248245d95e159ce4fda715f2460167f57ba53169d3b7f90
7
- data.tar.gz: e7555c35a30e63794f00be2503d345d44ea90d432da99ed2769fb6b348825eec4663ee74ccc21831d218ac26501268a3dbfb1cf70800c0839699cd8e280fdc18
6
+ metadata.gz: da41323a9b967724f758535d4ad8bb191cc1c015929b8af49e94851c7ff83b8a45d0ee8eb25298e2712b4acfbe1d3263cf4d327609cfc9f170e16cffadd347a9
7
+ data.tar.gz: c8a491d922669dd8ac947e658367fcbc093a007bda351ed9f7627213ad635c0d4246d36d09862ae597312147d4627f0314f12547df2c37d95a8bc400064c0897
@@ -65,7 +65,6 @@ class Main
65
65
 
66
66
  opts.on('-v', '--version', 'Print current ZMediumToMarkdown Version & Output Path') do
67
67
  puts "Version:#{Helper.getLocalVersion().to_s}"
68
- puts "Output Path:#{outputFilePath.getAbsolutePath(nil)}"
69
68
 
70
69
  Helper.printNewVersionMessageIfExists()
71
70
  end
@@ -4,7 +4,11 @@ require "Parsers/Parser"
4
4
  require 'Models/Paragraph'
5
5
 
6
6
  class CodeBlockParser < Parser
7
- attr_accessor :nextParser
7
+ attr_accessor :nextParser, :isForJekyll
8
+
9
+ def initialize(isForJekyll)
10
+ @isForJekyll = isForJekyll
11
+ end
8
12
 
9
13
  def self.getTypeString()
10
14
  'CODE_BLOCK'
@@ -20,7 +24,17 @@ class CodeBlockParser < Parser
20
24
 
21
25
  def parse(paragraph)
22
26
  if CodeBlockParser.isCodeBlock(paragraph)
23
- "```\n#{paragraph.text}\n```"
27
+ result = "```\n"
28
+ if isForJekyll
29
+ result += "{% raw %}\n"
30
+ end
31
+
32
+ result += paragraph.text
33
+
34
+ if isForJekyll
35
+ result += "\n{% endraw %}"
36
+ end
37
+ result += "\n```"
24
38
  else
25
39
  if !nextParser.nil?
26
40
  nextParser.parse(paragraph)
@@ -74,7 +74,18 @@ class IframeParser < Parser
74
74
  gistHTML.search('a').each do |a|
75
75
  if a.text == 'view raw'
76
76
  gistRAW = Request.body(Request.URL(a['href']))
77
- result = "```#{lang}\n#{gistRAW}\n```"
77
+
78
+ result = "```#{lang}\n"
79
+ if isForJekyll
80
+ result += "{% raw %}\n"
81
+ end
82
+
83
+ result += gistRAW
84
+
85
+ if isForJekyll
86
+ result += "\n{% endraw %}"
87
+ end
88
+ result += "\n```"
78
89
  end
79
90
  end
80
91
  else
@@ -4,7 +4,11 @@ require "Parsers/Parser"
4
4
  require 'Models/Paragraph'
5
5
 
6
6
  class PREParser < Parser
7
- attr_accessor :nextParser
7
+ attr_accessor :nextParser, :isForJekyll
8
+
9
+ def initialize(isForJekyll)
10
+ @isForJekyll = isForJekyll
11
+ end
8
12
 
9
13
  def self.isPRE(paragraph)
10
14
  if paragraph.nil?
@@ -17,10 +21,19 @@ class PREParser < Parser
17
21
  def parse(paragraph)
18
22
  if PREParser.isPRE(paragraph)
19
23
  result = "```\n"
24
+ if isForJekyll
25
+ result += "{% raw %}\n"
26
+ end
27
+
20
28
  paragraph.text.each_line do |p|
21
29
  result += p
22
30
  end
31
+
32
+ if isForJekyll
33
+ result += "\n{% endraw %}"
34
+ end
23
35
  result += "\n```"
36
+
24
37
  result
25
38
  else
26
39
  if !nextParser.nil?
@@ -101,9 +101,9 @@ class ZMediumFetcher
101
101
  iframeParser.setNext(imgParser)
102
102
  bqParser = BQParser.new()
103
103
  imgParser.setNext(bqParser)
104
- preParser = PREParser.new()
104
+ preParser = PREParser.new(isForJekyll)
105
105
  bqParser.setNext(preParser)
106
- codeBlockParser = CodeBlockParser.new()
106
+ codeBlockParser = CodeBlockParser.new(isForJekyll)
107
107
  preParser.setNext(codeBlockParser)
108
108
  fallbackParser = FallbackParser.new()
109
109
  codeBlockParser.setNext(fallbackParser)
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: 1.9.5
4
+ version: 1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri