octopress-image-caption-tag 0.0.6 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 881fc86da2b6e9eea5d48c5df0cc6a449faa43ee
4
- data.tar.gz: 2fcb19fc4fbb72de99af758e5f3d2f377176b153
3
+ metadata.gz: 9c655d35e300a5da18f87e18f518bc27fc1b346b
4
+ data.tar.gz: 0aebbb4402551733b6c3c805842207451a3020e0
5
5
  SHA512:
6
- metadata.gz: 4879a1467bc1f3d68fab416dfd5f213f3e7388bdc87e110c15c7d617af55ab6ae1950107b31a51df9910b457ae52042ba1ba319e1af94aa556828d463b8dbb9f
7
- data.tar.gz: 5f864d36fde29c79833eff40aa95d27b1dcb0639d6bee7766aea7f379f3dbd97ffa8d1f57b58a16e1f27cd8fddaf6470d70a94d1c61eb7d35719a95445347d97
6
+ metadata.gz: b4f458c9899a1e275073512d655762d1e42a05275c85384064681ea659cc37ce0bb74071e7413c90b68e746eb4b3521cc787546f3d90e9c4d352e65df01b1801
7
+ data.tar.gz: c9c98d2e03c18c2f05d032eee0934d9e0147f73840eefe92629daccfcd947cec258d66bcf2878ed16ef36893363eb18407e7508d4b48b074bab0c48cb0770956
@@ -1,4 +1,13 @@
1
1
  # Changelog
2
+ ### 0.9.0 (2016-05-18)
3
+ - Add support for absolute sizing in ems
4
+ - Confident enough to consider this a pre-release rather than pre-alpha
5
+ ### 0.0.6 (2016-05-16)
6
+ - Removed superfluous inline styling
7
+ - Explicit tests for additional classes
8
+ ### 0.0.5 (2016-04-17)
9
+ - Updated for Jekyll 3
10
+ - Major refactoring
2
11
  ### 0.0.3 (2015-11-14)
3
12
  - Added README and tests
4
13
  ### 0.0.2 (2015-11-13)
@@ -12,7 +12,7 @@ module Octopress
12
12
  module ImageCaptionTag
13
13
  module ImageCaptionFunctions
14
14
  def parse_sizes(raw_size)
15
- if /\s*(?<w>\d+%?)\s+(?<h>\d+%?)/ =~ raw_size
15
+ if /\s*(?<w>\d+%?(em)?)\s+(?<h>\d+%?(em)?)/ =~ raw_size
16
16
  @width = w
17
17
  @height = h
18
18
  elsif @class.rstrip == 'right' || @class.rstrip == 'left'
@@ -46,6 +46,19 @@ module Octopress
46
46
  EOS
47
47
  end
48
48
 
49
+ def em_sized_figure
50
+ <<-EOS.gsub(/^ {10}/, '') # gsubm is to pretty up source by indenting
51
+ <figure class='image-caption image-caption-absolute #{@class.rstrip}'>
52
+ <a class='image-popup' href='#{@img}'>
53
+ <img class='caption' src='#{@img}' style='width:#{@width};height:#{@height};' title='#{@title}' alt='#{@alt}'>
54
+ </a>
55
+ <figcaption class='caption-text'>
56
+ #{@caption}
57
+ </figcaption>
58
+ </figure>
59
+ EOS
60
+ end
61
+
49
62
  def relative_sized_figure
50
63
  <<-EOS.gsub(/^ {10}/, '') # gsubm is to pretty up source by indenting
51
64
  <figure class='image-caption #{@class.rstrip}'>
@@ -69,7 +82,7 @@ module Octopress
69
82
  @height = ''
70
83
 
71
84
  def initialize(tag_name, markup, tokens)
72
- if %r{(?<classname>\S.*\s+)?(?<protocol>https?://|/)(?<url>\S+)(?<sizes>\s+\d+%?\s+\d+%?)?(?<title>\s+.+)?} =~ markup
85
+ if %r{(?<classname>\S.*\s+)?(?<protocol>https?://|/)(?<url>\S+)(?<sizes>\s+\d+%?(em)?\s+\d+%?(em)?)?(?<title>\s+.+)?} =~ markup
73
86
  @class = classname || 'center'
74
87
  @img = "#{protocol}#{url}"
75
88
  @title = title.strip if title
@@ -84,6 +97,8 @@ module Octopress
84
97
  @caption = @title
85
98
  if @img && @width[-1] == '%' # Relative width, so width goes on outer span
86
99
  relative_sized_figure
100
+ elsif @img && @width[-2..-1] == 'em' # Absolute size in ems
101
+ em_sized_figure
87
102
  elsif @img # Absolute width, so width goes on the img tag and text span gets sytle-width:@width-15;
88
103
  absolute_sized_figure
89
104
  else
@@ -101,7 +116,7 @@ module Octopress
101
116
  @height = ''
102
117
 
103
118
  def initialize(tag_name, markup, tokens)
104
- if %r{(?<classname>\S.*\s+)?(?<protocol>https?://|/)(?<url>\S+)(?<sizes>\s+\d+%?\s+\d+%?)?(?<title>\s+.+)?} =~ markup
119
+ if %r{(?<classname>\S.*\s+)?(?<protocol>https?://|/)(?<url>\S+)(?<sizes>\s+\d+%?(em)?\s+\d+%?(em)?)?(?<title>\s+.+)?} =~ markup
105
120
  @class = classname || 'center'
106
121
  @img = "#{protocol}#{url}"
107
122
  @title = title.strip if title
@@ -117,6 +132,8 @@ module Octopress
117
132
  @caption = converter.convert(super).lstrip.rstrip
118
133
  if @img && @width[-1] == '%' # Relative width, so width goes on outer span
119
134
  relative_sized_figure
135
+ elsif @img && @width[-2..-1] == 'em'
136
+ em_sized_figure
120
137
  elsif @img # Absolute width, so width goes on the img tag and text span gets sytle-width:@width-15;
121
138
  absolute_sized_figure
122
139
  else
@@ -1,7 +1,7 @@
1
1
  module Octopress
2
2
  module Tags
3
3
  module ImageCaptionTag
4
- VERSION = '0.0.6'
4
+ VERSION = '0.9.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-image-caption-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,46 +56,51 @@ dependencies:
56
56
  name: clash
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '2.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '2.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry-byebug
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '3.3'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
97
- description: A tag to create images with pretty captions for Jekyll and Octopress
98
- blogs.
96
+ version: '3.3'
97
+ description: |2
98
+ Octopress Image Caption Tag is a major expansion on the feature set of
99
+ Octopress Image Tag, adding support to Jekyll and Octopress for rich
100
+ image figures with figcaptions. There are both tag and a new block version
101
+ provided, with the block version allowing for full markdown foratting
102
+ within the captions for your images. Figures and images can be sized based
103
+ on css classes, or absolutely in either pxs or ems.
99
104
  email:
100
105
  - eToThePiIPower@gmail.com
101
106
  executables: []