jekyll_figure 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +11 -1
- data/lib/jekyll_figure.rb +16 -4
- data/lib/jekyll_figure/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: deedc40d800fbd4530ec24da957ab4b8c8d70a2b
|
|
4
|
+
data.tar.gz: 82bc9f42482ceec4e8d67d2073bc9713aab734a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
56
|
+
|
|
57
|
+
"<figure id='figure-#{@@fig_num}'>" +
|
|
46
58
|
"<a href='#{img_src}'><img src='#{img_src}' alt='#{caption}'></a>" +
|
|
47
|
-
"<figcaption
|
|
48
|
-
"#{caption}
|
|
59
|
+
"<figcaption>#{enumeration}" +
|
|
60
|
+
"#{caption} [#{downloads.call}]" +
|
|
49
61
|
"</figcaption>" +
|
|
50
62
|
"</figure>"
|
|
51
63
|
|