jekyll-footnotes 0.5.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5fdc7cd1b6a8b6e71b9b518f85c6ebaeb259177a
4
+ data.tar.gz: d3192fca39810fc83e48b574a6372e79d116e8e0
5
+ SHA512:
6
+ metadata.gz: e7c06341cca9d2253b06753dc75e2481c3b9213606fb21318be3b5b0b1eccbb3ddf92c7ec4fa6daa66b089887caebf264c37398f8eb49be395da5d839b9aa502
7
+ data.tar.gz: bf6b51f0f1ce872c5dc5f50777495e4dd3505e3376c64866b03139255f1ff8eee45ad0318eb7b49e65bc7cbcc1c15b386000cb164188a5dece4c856e7caec899
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-footnotes.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Julian Simioni
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ "Footnotes" is a [Jekyll](http://jekyllrb.com/) plugin that helps inserts
2
+ footnote reference and body HTML, with automatic numbering, if desired.
3
+
4
+ All footnotes will include a superscript link to the footnotes body. The
5
+ footnote body will include a link back to the footnote (using the ⏎ icon ) for
6
+ easy reading.
7
+
8
+ ## Install
9
+
10
+ * Include "jekyll-footnotes" in your Gemfile, or install the gem
11
+ * Add "jekyll-footnotes to the plugins section of \_config.yml
12
+
13
+ ## Automatic numbering
14
+ hello{% fn %} world{% fn %}
15
+ {% footnotes %}
16
+ {% fnbody %}
17
+ <p>salut</p>
18
+ {% endfnbody %}
19
+ {% fnbody %}
20
+ <em>monde</em>
21
+ {% endfnbody %}
22
+ {% endfootnotes %}
23
+
24
+ ## Custom numbering:
25
+ hello{% fn 3 %} world{% fn 5 %}
26
+ {% footnotes %}
27
+ {% fnbody 3 %}
28
+ <p>salut</p>
29
+ {% endfnbody %}
30
+ {% fnbody 5 %}
31
+ <em>monde</em>
32
+ {% endfnbody %}
33
+ {% endfootnotes %}
34
+
35
+ ## CSS Styling
36
+ The following CSS selectors allow the footnotes, footnote bodies, and backlinks
37
+ to be customised using CSS
38
+
39
+ ```CSS
40
+ .footnote {
41
+ /* a single footnote link */
42
+ }
43
+ .footnotelist {
44
+ /* entire footnote section */
45
+ }
46
+
47
+ .footnotelist .footnotebody {
48
+ /* a single footnote body */
49
+ }
50
+
51
+ .footnotelist .backlink {
52
+ /* backlink to the footnote link */
53
+ }
54
+ ```
55
+
56
+ ## Notes
57
+
58
+ Do not mix custom and automatic numbering (although it will work if you only
59
+ use custom numbers above the highest automatic one).
60
+
61
+ Only numeric IDs are allowed currently.
62
+
63
+ **We generate valid HTML5**
64
+
65
+
66
+ © Ben Eills, 2013
67
+ © Julian Simioni, 2015
68
+
69
+ Released under the MIT License
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll/footnotes/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jekyll-footnotes"
8
+ spec.version = Jekyll::Footnotes::VERSION
9
+ spec.authors = ["Julian Simioni"]
10
+ spec.email = ["julian@simioni.org"]
11
+ spec.summary = %q{A Jekyll plugin for footnotes}
12
+ spec.description = %q{A Jekyll plugin that allows you to easily add
13
+ footnotes to your pages. Includes links to the footnote body, backlinks, and
14
+ classes for styling.}
15
+ spec.homepage = "https://github.com/orangejulius/jekyll-footnotes"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.4"
25
+ end
@@ -0,0 +1,53 @@
1
+ require "jekyll/footnotes/version"
2
+
3
+ module Jekyll
4
+ class FootnoteTag < Liquid::Tag
5
+ def initialize(tag_name, id, tokens)
6
+ raise(SyntaxError.new("invalid footnote ID")) if ['"', '<', '>'].any? { |c| id.include?(c) }
7
+ @id = id.strip unless id.strip.empty?
8
+ super
9
+ end
10
+
11
+ def render(context)
12
+ if @id.nil?
13
+ context.registers[:fn] ||= 0
14
+ context.registers[:fn] = context.registers[:fn].next
15
+ @id = context.registers[:fn]
16
+ end
17
+ "<sup><a href=\"#fn:#{@id}\" class=\"footnote\" rel=\"footnote\" id=\"fn-back:#{@id}\">#{@id}</a></sup>"
18
+ end
19
+ end
20
+
21
+ class FootnoteBody < Liquid::Block
22
+ def initialize(tag_name, id, tokens)
23
+ raise(SyntaxError.new("invalid footnote ID")) if ['"', '<', '>'].any? { |c| id.include?(c) }
24
+ @id = id.strip unless id.strip.empty?
25
+ super
26
+ end
27
+
28
+ def render(context)
29
+ if @id.nil?
30
+ context.registers[:fnbody] ||= 0
31
+ context.registers[:fnbody] = context.registers[:fnbody].next
32
+ @id = context.registers[:fnbody]
33
+ end
34
+ context.stack do
35
+ body = super
36
+ "<li id=\"fn:#{@id}\" class=\"footnotebody\"value=\"#{@id}\">#{body}<a href=\"#fn-back:#{@id}\" class=\"backlink\">⏎</a></li>"
37
+ end
38
+ end
39
+ end
40
+
41
+ class FootnoteList < Liquid::Block
42
+ def render(context)
43
+ context.stack do
44
+ body = super
45
+ "<ol class=\"footnotelist\">#{body}</ol>"
46
+ end
47
+ end
48
+ end
49
+
50
+ Liquid::Template.register_tag('fn', Jekyll::FootnoteTag)
51
+ Liquid::Template.register_tag('footnotes', FootnoteList)
52
+ Liquid::Template.register_tag('fnbody', FootnoteBody)
53
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Footnotes
3
+ VERSION = "0.5.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-footnotes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Julian Simioni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.4'
41
+ description: |-
42
+ A Jekyll plugin that allows you to easily add
43
+ footnotes to your pages. Includes links to the footnote body, backlinks, and
44
+ classes for styling.
45
+ email:
46
+ - julian@simioni.org
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - ".gitignore"
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - jekyll-footnotes.gemspec
57
+ - lib/jekyll/footnotes.rb
58
+ - lib/jekyll/footnotes/version.rb
59
+ homepage: https://github.com/orangejulius/jekyll-footnotes
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.5
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: A Jekyll plugin for footnotes
83
+ test_files: []