ZMediumToMarkdown 2.4.1 → 2.4.3

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 +31 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8a5ca887a7781219ae534d50ebe022c796d21ddc6eb5fab977559fd65ce4cb2
4
- data.tar.gz: 4e43067b4502adc9a11cf3347c68091980c273e567d22811e6d4d02b233ef5a8
3
+ metadata.gz: 66d3192cbb7b6f0971cbb4261ee5c2ca546a3ea66268388bc5d4d500809eb894
4
+ data.tar.gz: 30a873bcd0a75adfdb07318570bfb7c449940681655dd72405b4f389e4112b01
5
5
  SHA512:
6
- metadata.gz: 8e7ecbc20c8038097d213bfce93f6129b8451f7a990ad97c04f07533b6b9c0be8c0a913d4599d19b8aa6ca8e8d95724da4190f6f55c5678c5e944078d022a390
7
- data.tar.gz: 7ea56ec01d108d51a1f56087e28a5596a7e865dbc937507ccf2e029ed8ac1f536225a940437d30a5e36ab3a74e7c1fef38b410f0adc7b6081144baafdcbd3e4b
6
+ metadata.gz: 9daad86eebecf4648476302ab783c94a362ed2871fa984e5cdbecdfbe8a1beb79a8d43d41d532ba3d30fc7d5650e13ad6492f0929a454d241a507a4b5fde35d1
7
+ data.tar.gz: 3f8a18a4e84e00f681cc46f6f43b4615f0b840d409996cdc1a54b86ff9ee0166fafe481cdc646b7758d6322c9cc4297a7ac148c00ef8b73f7636dda8d3560881
@@ -76,19 +76,42 @@ class IframeParser < Parser
76
76
  gist.gsub! '\"', '"'
77
77
  gist.gsub! '<\/', '</'
78
78
  gistHTML = Nokogiri::HTML(gist)
79
- lang = gistHTML.search('table').first['data-tagsearch-lang'].downcase
80
- if isForJekyll and lang == "objective-c"
81
- lang = "objectivec"
82
- end
79
+
83
80
  gistHTML.search('a').each do |a|
84
81
  if a.text == 'view raw'
85
- gistRAW = Request.body(Request.URL(a['href']))
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
86
98
 
87
- result = "```#{lang}\n"
88
99
 
89
- result += gistRAW.chomp
100
+ gistRAW = Request.body(Request.URL(a['href']))
90
101
 
91
- result += "\n```"
102
+ if isMarkdown
103
+ result = "\n"
104
+
105
+ result += gistRAW.chomp
106
+
107
+ result += "\n"
108
+ else
109
+ result = "```#{lang}\n"
110
+
111
+ result += gistRAW.chomp
112
+
113
+ result += "\n```"
114
+ end
92
115
  end
93
116
  end
94
117
  else
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.1
4
+ version: 2.4.3
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-11 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