jekyll_figure 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeda5a19bf522509d0c996e30ee0ca6b47572961
4
- data.tar.gz: 71718baaa1f10f740ba3da7ed302f8e0f4a6676c
3
+ metadata.gz: deedc40d800fbd4530ec24da957ab4b8c8d70a2b
4
+ data.tar.gz: 82bc9f42482ceec4e8d67d2073bc9713aab734a5
5
5
  SHA512:
6
- metadata.gz: 84efb5c5871eed44bc147b0b6be0af396b47af7e2c03b64959c16e98ed6ac786d32c5df7f80deef5fa462d361ff9cb90b3c6075764a3a3b2e29bd61dcda71a0a
7
- data.tar.gz: 57d5e8caf38d86216b151c804baf31b94245176ec7185b032f02f14f3bdae5682afe831f567f6a1e7dde1eba4537fecbd1e42948b04d51d53c79e7779d5e0fd8
6
+ metadata.gz: 9e77ea952ab9fffb04ea0d4026ee906c1b6d64ea097118a80aa9d69f5bab6304bab457ab8894c2f83924971262f5423efec1ae46db4eb78f81a234264e5c00f5
7
+ data.tar.gz: e463039e0b9bbd1e6744274827bd8279353f09c197d558d7ed9b9ce75d67f6848771739d9d1108ab3243def6f8f524a56333846e495a0bcdf91fd2f2f56e2363
data/README.md CHANGED
@@ -24,9 +24,15 @@ If you have a directory where you keep your figures, add these lines to
24
24
  figures:
25
25
  dir: /figures
26
26
 
27
+ If you would like the figures to be enumerated (e.g., "Figure 1," "Figure
28
+ 2") then add this value to `_config.yml`:
29
+
30
+ figures:
31
+ enumerate: true
32
+
27
33
  ## Usage
28
34
 
29
- Creates a Liquid figure tag. The figure tag should take this form:
35
+ To add a figure, use the figure tag in this form:
30
36
 
31
37
  {% figure filename svg,png,pdf 'Your caption here' %}
32
38
 
@@ -38,9 +44,13 @@ extensions. It will include a caption with links to all the figure
38
44
  formats. If the figures directory is set in `_config.yml`, then the
39
45
  image and the links will point there.
40
46
 
47
+ You can [see an example here][].
48
+
49
+
41
50
  ## License
42
51
 
43
52
  MIT License <http://lmullen.mit-license.org/>
44
53
 
45
54
  [Jekyll]: http://jekyllrb.com/
55
+ [see an example here]: http://lincolnmullen.com/blog/a-figure-plugin-for-jekyll/
46
56
 
data/lib/jekyll_figure.rb CHANGED
@@ -19,10 +19,13 @@ module Jekyll
19
19
 
20
20
  def initialize(tag_name, text, tokens)
21
21
  super
22
- @text = text.shellsplit
22
+ @text = text.shellsplit
23
+ @@fig_num = 0
23
24
  end
24
25
 
25
26
  def render(context)
27
+ @@fig_num += 1
28
+
26
29
  # If the figures directory is not defined, set dir to site root
27
30
  if defined? context.registers[:site].config["figures"]["dir"]
28
31
  dir = context.registers[:site].config["figures"]["dir"]
@@ -30,6 +33,14 @@ module Jekyll
30
33
  dir = ""
31
34
  end
32
35
 
36
+ # Should we explicitly enumerate the figures?
37
+ enumeration = ""
38
+ if defined? context.registers[:site].config["figures"]["enumerate"]
39
+ if context.registers[:site].config["figures"]["enumerate"]
40
+ enumeration = "Figure #{@@fig_num}: "
41
+ end
42
+ end
43
+
33
44
  filename = @text[0]
34
45
  extensions = @text[1].split(",")
35
46
  caption = @text[2]
@@ -42,10 +53,11 @@ module Jekyll
42
53
  d.join(" ")[0..-2]
43
54
  }
44
55
 
45
- "<figure>" +
56
+
57
+ "<figure id='figure-#{@@fig_num}'>" +
46
58
  "<a href='#{img_src}'><img src='#{img_src}' alt='#{caption}'></a>" +
47
- "<figcaption>" +
48
- "#{caption} (#{downloads.call})" +
59
+ "<figcaption>#{enumeration}" +
60
+ "#{caption} [#{downloads.call}]" +
49
61
  "</figcaption>" +
50
62
  "</figure>"
51
63
 
@@ -1,3 +1,3 @@
1
1
  module JekyllFigure
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_figure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lincoln Mullen