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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ad7d4aaa279746048959177dd44d856a0ea2bdd5e7abafe0a17bb91c1fa270c
4
- data.tar.gz: 190cf803221cc22ce226a0d2ce75209a561defde7223b156a373af1e510b730c
3
+ metadata.gz: c346ebddf4a54f030cce4ea3248ccf3fe9d2f564f02a2d43771224677385f94a
4
+ data.tar.gz: 5a69488e4d00b56480237693bff409ee8890039ef7e9470df5226882af64a7c1
5
5
  SHA512:
6
- metadata.gz: 1c38796a2d4f3a3b3e88af2ee3da95af37828a8cc112f10694ee50cba21ed916aeae5bfcde075714fbc51c9b93cdc3595e7cab2672a21bbb7c58ed1bd2ed7d07
7
- data.tar.gz: a82fbc482dff1902662076964c2eb76f14b1bb69c694257e80ba64755a99d3af38f6a4ff47fa085c0f71cb3c466e6cfe6389f93334ac9775e1bd0f8d49198356
6
+ metadata.gz: e078b4d7d914cee844222f45dcbbd0fb756d52786e01c15cbcc5495356b35b48dca9c7d303b4fa9c2e1c11e8086f1751b4cc6df8c759573432fd546491c4a60b
7
+ data.tar.gz: 586e5b2e6b6a9947ff73237edfde4c4786853eac3ec513ef089e12b018c3cc27feca53ca584f9f9ed63d74bb1990dbd3219ff02ca92744a8f142a0827d3b634d
@@ -40,7 +40,7 @@ class Main
40
40
  Helper.printNewVersionMessageIfExists()
41
41
  end
42
42
 
43
- opts.on('-kpPOST_URL', '--jekyllPostURL=POST_URL', 'Downloading single post with Jekyll friendly') do |postURL|
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)
@@ -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
- comment = ""
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.text}](/#{relativePath}#{comment})\r\n"
31
+ result = "\r\n![#{paragraph.orgText}](/#{relativePath} \"#{paragraph.orgText}\")\r\n"
35
32
  else
36
- "\r\n![#{paragraph.text}](#{relativePath}#{comment})\r\n"
33
+ result = "\r\n![#{paragraph.orgText}](#{relativePath} \"#{paragraph.orgText}\")\r\n"
37
34
  end
38
35
  else
39
- "\r\n![#{paragraph.text}](#{imageURL}#{comment})\r\n"
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)
@@ -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.downcase}\n#{gistRAW}\n```"
70
+ result = "```#{lang}\n#{gistRAW}\n```"
68
71
  end
69
72
  end
70
73
  end
@@ -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.2
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 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri