ZMediumToMarkdown 1.7.2 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ZMediumToMarkdown +1 -1
- data/lib/Parsers/IMGParser.rb +10 -7
- data/lib/Parsers/IframeParser.rb +5 -2
- data/lib/Parsers/PQParser.rb +3 -1
- 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: c346ebddf4a54f030cce4ea3248ccf3fe9d2f564f02a2d43771224677385f94a
|
4
|
+
data.tar.gz: 5a69488e4d00b56480237693bff409ee8890039ef7e9470df5226882af64a7c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e078b4d7d914cee844222f45dcbbd0fb756d52786e01c15cbcc5495356b35b48dca9c7d303b4fa9c2e1c11e8086f1751b4cc6df8c759573432fd546491c4a60b
|
7
|
+
data.tar.gz: 586e5b2e6b6a9947ff73237edfde4c4786853eac3ec513ef089e12b018c3cc27feca53ca584f9f9ed63d74bb1990dbd3219ff02ca92744a8f142a0827d3b634d
|
data/bin/ZMediumToMarkdown
CHANGED
@@ -40,7 +40,7 @@ class Main
|
|
40
40
|
Helper.printNewVersionMessageIfExists()
|
41
41
|
end
|
42
42
|
|
43
|
-
opts.on('-
|
43
|
+
opts.on('-kPOST_URL', '--jekyllPostURL=POST_URL', 'Downloading single post with Jekyll friendly') do |postURL|
|
44
44
|
outputFilePath = PathPolicy.new(filePath, "/")
|
45
45
|
fetcher.isForJekyll = true
|
46
46
|
fetcher.downloadPost(postURL, outputFilePath)
|
data/lib/Parsers/IMGParser.rb
CHANGED
@@ -23,21 +23,24 @@ class IMGParser < Parser
|
|
23
23
|
imagePathPolicy = PathPolicy.new(pathPolicy.getAbsolutePath(nil), paragraph.postID)
|
24
24
|
absolutePath = imagePathPolicy.getAbsolutePath(fileName)
|
25
25
|
|
26
|
-
|
27
|
-
if paragraph.text != ""
|
28
|
-
comment = " \"#{paragraph.text}\""
|
29
|
-
end
|
26
|
+
result = ""
|
30
27
|
|
31
28
|
if ImageDownloader.download(absolutePath, imageURL)
|
32
29
|
relativePath = "#{pathPolicy.getRelativePath(nil)}/#{imagePathPolicy.getRelativePath(fileName)}"
|
33
30
|
if isForJekyll
|
34
|
-
"\r\n![#{paragraph.
|
31
|
+
result = "\r\n![#{paragraph.orgText}](/#{relativePath} \"#{paragraph.orgText}\")\r\n"
|
35
32
|
else
|
36
|
-
"\r\n![#{paragraph.
|
33
|
+
result = "\r\n![#{paragraph.orgText}](#{relativePath} \"#{paragraph.orgText}\")\r\n"
|
37
34
|
end
|
38
35
|
else
|
39
|
-
"\r\n![#{paragraph.
|
36
|
+
result = "\r\n![#{paragraph.orgText}](#{imageURL} \"#{paragraph.orgText}\")\r\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
if paragraph.text != ""
|
40
|
+
result += "#{paragraph.text}\r\n"
|
40
41
|
end
|
42
|
+
|
43
|
+
result
|
41
44
|
else
|
42
45
|
if !nextParser.nil?
|
43
46
|
nextParser.parse(paragraph)
|
data/lib/Parsers/IframeParser.rb
CHANGED
@@ -60,11 +60,14 @@ class IframeParser < Parser
|
|
60
60
|
gist.gsub! '\"', '"'
|
61
61
|
gist.gsub! '<\/', '</'
|
62
62
|
gistHTML = Nokogiri::HTML(gist)
|
63
|
-
lang = gistHTML.search('table').first['data-tagsearch-lang']
|
63
|
+
lang = gistHTML.search('table').first['data-tagsearch-lang'].downcase
|
64
|
+
if isForJekyll and lang == "objective-c"
|
65
|
+
lang = "objectivec"
|
66
|
+
end
|
64
67
|
gistHTML.search('a').each do |a|
|
65
68
|
if a.text == 'view raw'
|
66
69
|
gistRAW = Request.body(Request.URL(a['href']))
|
67
|
-
result = "```#{lang
|
70
|
+
result = "```#{lang}\n#{gistRAW}\n```"
|
68
71
|
end
|
69
72
|
end
|
70
73
|
end
|
data/lib/Parsers/PQParser.rb
CHANGED
@@ -7,10 +7,12 @@ class PQParser < Parser
|
|
7
7
|
attr_accessor :nextParser
|
8
8
|
def parse(paragraph)
|
9
9
|
if paragraph.type == 'PQ'
|
10
|
-
result = ""
|
10
|
+
result = "\r\n\r\n"
|
11
11
|
paragraph.text.each_line do |p|
|
12
12
|
result += "> #{p}"
|
13
13
|
end
|
14
|
+
result += "\r\n\r\n"
|
15
|
+
|
14
16
|
result
|
15
17
|
else
|
16
18
|
if !nextParser.nil?
|
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.7.
|
4
|
+
version: 1.7.5
|
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-
|
11
|
+
date: 2022-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|