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 +4 -4
- data/bin/ZMediumToMarkdown +0 -1
- data/lib/Parsers/CodeBlockParser.rb +16 -2
- data/lib/Parsers/IframeParser.rb +12 -1
- data/lib/Parsers/PREParser.rb +14 -1
- data/lib/ZMediumFetcher.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acc5589c92b8dd859f91b98fe7c2f1073a39af102ee8ebce27f1351824ffcab7
|
4
|
+
data.tar.gz: b14f257296741edd700bf484c37da6b2e386ddfb96dffca540b60cea8c04fecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da41323a9b967724f758535d4ad8bb191cc1c015929b8af49e94851c7ff83b8a45d0ee8eb25298e2712b4acfbe1d3263cf4d327609cfc9f170e16cffadd347a9
|
7
|
+
data.tar.gz: c8a491d922669dd8ac947e658367fcbc093a007bda351ed9f7627213ad635c0d4246d36d09862ae597312147d4627f0314f12547df2c37d95a8bc400064c0897
|
data/bin/ZMediumToMarkdown
CHANGED
@@ -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
|
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)
|
data/lib/Parsers/IframeParser.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/Parsers/PREParser.rb
CHANGED
@@ -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?
|
data/lib/ZMediumFetcher.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|