ZMediumToMarkdown 2.4.2 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Parsers/IframeParser.rb +28 -13
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b853d78f150d3134ac412b310a53a864fa4808a7c6dd476c28f534ecc607de18
4
- data.tar.gz: 886dcd5efb04f28a033eb6ca80ed2babaa2f37c9afc4d524a776b3f154d96f35
3
+ metadata.gz: 5c04e31bc9f4ddb6f3249f206063afb7c65a03c13962c78e2fd08a82b6c67844
4
+ data.tar.gz: 50a6858120b008a667d4dd4b70a0e440f3312a87be56ec811868eaba0d04c421
5
5
  SHA512:
6
- metadata.gz: 7492890c6dbacf64ea895246224692d73925359489fd97383c6331eb613201dc64963631a72eaa2ae708470ebf912199057f800428ca847284300da1bb091b46
7
- data.tar.gz: 869962271b377b7e258bf013d7136befba33bb8a72272f5aee15e10af209e1be276028c344bfb2335d094f28bffaabff723c6fd8f600a6a5051e7baa0b5a9bf0
6
+ metadata.gz: 4d9026a98314223cb513012dea8475c478098d313589481b1f4ecba2d632ef6d27da1995c4a746e9366d2d54c60feb6f794e102ec5eb1e48ef082a0d116a5483
7
+ data.tar.gz: ef965a62eaca395d2e88f703a378b1ec63b7b2b5b4e5b05b7c7da1c178a44f4db0ce801aa16a85fcb1fc604fd398a993af0780e7210322bc7efe1f25c8b20616
@@ -76,18 +76,36 @@ class IframeParser < Parser
76
76
  gist.gsub! '\"', '"'
77
77
  gist.gsub! '<\/', '</'
78
78
  gistHTML = Nokogiri::HTML(gist)
79
-
80
- lang = gistHTML.search('table').first['data-tagsearch-lang']
81
79
 
82
- if !lang.nil?
83
- lang = lang.downcase
84
- if isForJekyll and lang == "objective-c"
85
- lang = "objectivec"
86
- end
87
- gistHTML.search('a').each do |a|
88
- if a.text == 'view raw'
89
- gistRAW = Request.body(Request.URL(a['href']))
80
+ gistHTML.search('a').each do |a|
81
+ if a.text == 'view raw'
82
+ isMarkdown = false
83
+ lang = gistHTML.search('table').first['data-tagsearch-lang']
84
+ if !lang.nil?
85
+ lang = lang.downcase
86
+ if isForJekyll and lang == "objective-c"
87
+ lang = "objectivec"
88
+ end
89
+ else
90
+ viewRawURL = a['href']
91
+ extName = File.extname(viewRawURL).delete_prefix(".")
92
+ if extName == "md"
93
+ isMarkdown = true
94
+ else
95
+ lang = extName
96
+ end
97
+ end
98
+
99
+
100
+ gistRAW = Request.body(Request.URL(a['href']))
101
+
102
+ if isMarkdown
103
+ result = "\n"
104
+
105
+ result += gistRAW.chomp
90
106
 
107
+ result += "\n\n"
108
+ else
91
109
  result = "```#{lang}\n"
92
110
 
93
111
  result += gistRAW.chomp
@@ -95,9 +113,6 @@ class IframeParser < Parser
95
113
  result += "\n```"
96
114
  end
97
115
  end
98
- else
99
- clean_url = srce.to_s.gsub(/\.js$/, '')
100
- result = "[#{clean_url}](#{clean_url})#{jekyllOpen}"
101
116
  end
102
117
  else
103
118
  ogURL = url
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.4.2
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-15 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri