jekyll-svg-plugin 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,7 @@
1
+ === 1.1.0 (2011-9-18)
2
+ * Replace imagesize gem with maintained image_size ~> 1.0.3.
3
+ * Support relative or site-absolute svg/png file paths.
4
+ * Use <img/> empty tag for XHTML compatibility.
5
+
1
6
  === 1.0.0 (2010-8-14)
2
7
  * Initial release.
@@ -18,9 +18,10 @@ Then you can include an SVG reference HTML object via liquid tag:
18
18
 
19
19
  {% svg svg/mygraph.svg %}
20
20
 
21
- Note that both an *.svg and *.png are expected at the specified
22
- location. The later is used as a fallback and also to obtain
23
- dimensions (via imagesize gem, pure ruby) from the png file.
21
+ Where the referenced file is relative to the current page, or to the
22
+ site source if absolute. Note that both an *.svg and *.png are
23
+ expected at the specified location. The PNG file is used as a fallback
24
+ and also to obtain dimensions (via imagesize gem, pure ruby).
24
25
 
25
26
  I typically use Graphviz dot to generate my SVG/PNG graphs, with a Rakefile like this:
26
27
 
@@ -43,7 +44,7 @@ I typically use Graphviz dot to generate my SVG/PNG graphs, with a Rakefile like
43
44
 
44
45
  == License
45
46
 
46
- Copyright (c) 2010 David Kellum
47
+ Copyright (c) 2010-2011 David Kellum
47
48
  All rights reserved.
48
49
 
49
50
  Permission is hereby granted, free of charge, to any person obtaining
data/Rakefile CHANGED
@@ -4,14 +4,14 @@ $LOAD_PATH << './lib'
4
4
  require 'jekyll-svg-plugin/base'
5
5
 
6
6
  require 'rubygems'
7
- gem 'rjack-tarpit', '~> 1.2.2'
7
+ gem 'rjack-tarpit', '~> 1.3.3'
8
8
  require 'rjack-tarpit'
9
9
 
10
10
  t = RJack::TarPit.new( 'jekyll-svg-plugin', JekyllSVGPlugin::VERSION )
11
11
 
12
12
  t.specify do |h|
13
13
  h.developer( 'David Kellum', 'dek-oss@gravitext.com' )
14
- h.extra_deps << [ 'imagesize', '>= 0.1.1' ]
14
+ h.extra_deps << [ 'image_size', '~> 1.0.3' ]
15
15
  end
16
16
 
17
17
  task :check_history_version do
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010 David Kellum
2
+ # Copyright (c) 2010-2011 David Kellum
3
3
  # All rights reserved.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining
@@ -30,6 +30,7 @@ mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
30
30
  mime_types.store 'svg', 'image/svg+xml'
31
31
 
32
32
  require 'image_size'
33
+
33
34
  module Jekyll
34
35
 
35
36
  class SvgTag < Liquid::Tag
@@ -40,13 +41,23 @@ module Jekyll
40
41
 
41
42
  def render(context)
42
43
  png = @svg.sub( /(\.svg)$/, '.png' )
43
- w,h = open( png, 'rb' ) do |fpng|
44
- ImageSize.new( fpng.read ).get_size
44
+ png_file = png
45
+
46
+ # png file is relative to this page, if relative
47
+ unless png_file =~ %r{^/}
48
+ png_file = File.join( File.dirname( context[ 'page' ][ 'url' ] ), png )
49
+ end
50
+
51
+ # And found in the site source
52
+ png_file = File.join( context.registers[ :site ].source, png_file )
53
+
54
+ w,h = open( png_file, 'rb' ) do |fpng|
55
+ ImageSize.new( fpng.read ).size
45
56
  end
46
57
  <<END
47
58
  <div class="svg-object">
48
59
  <object data="#{@svg}" type="image/svg+xml" width="#{w}" height="#{h}">
49
- <img src="#{png}" width="#{w}" height="#{h}">
60
+ <img src="#{png}" width="#{w}" height="#{h}" />
50
61
  </object>
51
62
  </div>
52
63
  END
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010 David Kellum
2
+ # Copyright (c) 2010-2011 David Kellum
3
3
  # All rights reserved.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining
@@ -23,5 +23,5 @@
23
23
  #++
24
24
 
25
25
  module JekyllSVGPlugin
26
- VERSION='1.0.0'
26
+ VERSION='1.1.0'
27
27
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-svg-plugin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Kellum
@@ -15,23 +15,22 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-14 00:00:00 -07:00
19
- default_executable:
18
+ date: 2011-09-18 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: imagesize
21
+ name: image_size
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
- - - ">="
26
+ - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 25
28
+ hash: 17
30
29
  segments:
31
- - 0
32
- - 1
33
30
  - 1
34
- version: 0.1.1
31
+ - 0
32
+ - 3
33
+ version: 1.0.3
35
34
  type: :runtime
36
35
  version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
@@ -42,12 +41,12 @@ dependencies:
42
41
  requirements:
43
42
  - - ~>
44
43
  - !ruby/object:Gem::Version
45
- hash: 27
44
+ hash: 29
46
45
  segments:
47
46
  - 1
48
- - 2
49
- - 2
50
- version: 1.2.2
47
+ - 3
48
+ - 3
49
+ version: 1.3.3
51
50
  type: :development
52
51
  version_requirements: *id002
53
52
  description: |-
@@ -71,7 +70,6 @@ files:
71
70
  - Rakefile
72
71
  - lib/jekyll-svg-plugin/base.rb
73
72
  - lib/jekyll-svg-plugin.rb
74
- has_rdoc: true
75
73
  homepage: http://github.com/dekellum/jekyll-svg-plugin
76
74
  licenses: []
77
75
 
@@ -102,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
100
  requirements: []
103
101
 
104
102
  rubyforge_project: jekyll-svg-plugin
105
- rubygems_version: 1.3.7
103
+ rubygems_version: 1.7.2
106
104
  signing_key:
107
105
  specification_version: 3
108
106
  summary: A plugin for adding an SVG liquid tag to Jekyll