jekyll-img-converter 0.1.4 → 0.1.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/jekyll-img-converter.rb +34 -52
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6cf458e72ce862ef81f217d807c76aeebec1831
4
- data.tar.gz: 6ce9ddcb0d416d5ed3321e08d26a9191d979e79b
3
+ metadata.gz: 03ec833f5b958643b44263c5fd9a78d84ca3c0e6
4
+ data.tar.gz: 06420a618107b4af009a2d5154717b72ae8645d7
5
5
  SHA512:
6
- metadata.gz: 1061eb3581b9a3218bc8fb4fd531f74851b3a46802fe7433dcff857039ac5cb9384fba9fc135675b4574e0b38df3cf4098b4a47ac95087e76c5e0aa1eb5dc83a
7
- data.tar.gz: 43e905e294a442920bce77346fe80b2f144f22a297ffe293019690ad497dd35adc0456af4ecce28aa669d80172dd9f58a3657dc19f6064de20b15a7c023f37db
6
+ metadata.gz: 7fef2f870d3d9e3b41f7e4bf5e652e95400cde698606c2a82f7fb4ad3913a9932ee9626fd1fe28efe59ca456a459ae28090425d86113e93863687561c26a7b74
7
+ data.tar.gz: 1e0445157827591eab014eea690ce152f64cd090062f689bfb9180f18d440879dfb577de6df89d821bf4414b8fc6ce5a2b076ed8a5b20b816294123094594a46
@@ -1,61 +1,43 @@
1
1
  require 'jekyll'
2
- require 'redcarpet'
3
2
 
4
3
  module Jekyll
5
-
6
- class ImgConverter < Redcarpet::Render::HTML
7
-
8
- def image(link, title, content)
9
- # content &&= content
10
- pattern = /({)(.+)(})/
11
- matchData = pattern.match(content)
4
+ module Converters
5
+ class Markdown < Converter
6
+
7
+ class RedcarpetParser
8
+ module CommonMethods
9
+ # def postprocess(full_document)
10
+ # Regexp.new(/\A<p>(.*)<\/p>\Z/m).match(full_document)[1] rescue full_document
11
+ # end
12
+ # def postprocess(document)
13
+ # document.gsub("\n", '').strip
14
+ # end
15
+
16
+ def image(link, title, content)
17
+ pattern = /({)(.+)(})/
18
+ matchData = pattern.match(content)
19
+
20
+ imgTag = "<img src=\"#{link}\""
21
+
22
+ if (matchData)
23
+ style = matchData[2]
24
+ stripContent = content.gsub(matchData.to_s,'').rstrip
25
+
26
+ imgTag += " alt=\"#{stripContent}\" style=\"#{style}\""
27
+ else
28
+ imgTag += " alt=\"#{content}\""
29
+ end
12
30
 
13
- imgTag = "<img src=\"#{link}\""
31
+ if(title)
32
+ imgTag += " title=\"#{title}\""
33
+ end
14
34
 
15
- if (matchData)
16
- style = matchData[2]
17
- stripContent = content.gsub(matchData.to_s,'').rstrip
18
-
19
- imgTag += " alt=\"#{stripContent}\" style=\"#{style}\""
20
- else
21
- imgTag += " alt=\"#{content}\""
22
- end
23
-
24
- if(title)
25
- imgTag += " title=\"#{title}\""
26
- end
27
-
28
- imgTag = imgTag + "/>"
29
- end
30
-
31
- end
32
-
33
- class SFMarkdownConverter < Converter
34
- safe true
35
- priority :high
36
-
37
- def matches(ext)
38
- ext =~ /^.md(own)?$/i
39
- end
40
-
41
- def output_ext(ext)
42
- ".html"
43
- end
44
-
45
- def convert(content)
46
- # @renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
47
- # markdown = Redcarpet::Markdown.new(@renderer.new(@extensions), @extensions)
48
- markdown = Redcarpet::Markdown.new(ImgConverter.new(@extensions), @extensions)
49
- markdown.render(content)
50
- end
51
-
52
- def initialize(config)
53
- super
54
- @extensions = {}
55
- @config['redcarpet']['extensions'].each { |e| @extensions[e.to_sym] = true}
56
- @extensions = @config['redcarpet']['extensions'].each_with_object({}) do |e, hash|
57
- hash[e.to_sym] = true
35
+ imgTag += "/>"
36
+ end
37
+ end
58
38
  end
39
+
59
40
  end
60
41
  end
61
42
  end
43
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-img-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - SungKwang Song
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll