jekyll-archive_link 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: 4f892e18cde2a535f384b06d5456a7237e1dbaba2d56d412de0975c08caf0024
4
- data.tar.gz: 4efc52a78dc5550383dc13ab578d23a1d5e8e5e082d7ace39d773382b7c9f9ab
3
+ metadata.gz: 2d5d61c4cd35701985b111f753162f940b57a81d5a6264b25bade14187a4584c
4
+ data.tar.gz: 3789d323705fe039d2e62b980674a9ddaf88c4f1ebdba3264a04997bf04dfde4
5
5
  SHA512:
6
- metadata.gz: 5ef6970a861340a9c6db7694434f54dd13ea6281e77c72d5f44ce43a9cf3e75f18fa931d9c0a435ff94fde5e53ee44993ef5472c2b91f3daa6556b9d3987cb3b
7
- data.tar.gz: e8125274b9da424bbba72d61b52beab47888a9220a557b8cfe1f17700f4b8f359397d23f7bd0ae3d5ed7bc29614d23bfcb1531da8d13e2437f9a89db9f214c54
6
+ metadata.gz: b7416790b693267f62d3437064cc0690d67bfb8d7fe21792c929ff908621eda5731bc037f499c99abe9469ec0f0f1d19f0984d9d16bddbe15916a19cb8f426c4
7
+ data.tar.gz: 3cc5b52b1c9903b63f97042da5d0f7f8b99631852998fe5c105cb69fa701d72d1d72261251338930ab1593e6b989a0d0ba61414472d3d76f14d3942fa626cc22
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-archive_link (0.1.0)
4
+ jekyll-archive_link (0.2.0)
5
5
  faraday (~> 2.3)
6
6
  faraday-http-cache (~> 2.4)
7
7
  jekyll (~> 4.0)
data/README.md CHANGED
@@ -1,28 +1,36 @@
1
- # Jekyll::Archive::Link
1
+ # Jekyll::ArchiveLink
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jekyll/archive/link`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Adds [InternetArchive Wayback Machine](https://archive.org) links for a given URL. Useful for preserving access to content on other sites that you do not control.
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'jekyll-archive-link'
10
+ group :jekyll_plugins do
11
+ gem 'jekyll-archive_link'
12
+ end
13
13
  ```
14
14
 
15
- And then execute:
15
+ Install via `$ bundle install`.
16
16
 
17
- $ bundle install
17
+ And then add this line to your Jekyll config file:
18
18
 
19
- Or install it yourself as:
19
+ ``` yaml
20
+ plugins:
21
+ - jekyll-archive_link
22
+ ```
20
23
 
21
- $ gem install jekyll-archive-link
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ To add an archive link to your Jekyll pages, embed the following view tag:
28
+
29
+ ``` liquid
30
+ {% archive_url_link click me %}
31
+ {{ page.content_url }} <!-- Whatever attribute you use to define URLs -->
32
+ {% endarchive_url_link %}
33
+ ```
26
34
 
27
35
  ## Development
28
36
 
@@ -32,7 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
40
 
33
41
  ## Contributing
34
42
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-archive-link.
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bodacious/jekyll-archive_link.
36
44
 
37
45
  ## License
38
46
 
@@ -5,15 +5,18 @@ module Jekyll
5
5
  require "liquid"
6
6
  require_relative "url"
7
7
  class Tag < Liquid::Block
8
- attr_reader :url
8
+ attr_reader :link_text, :url
9
+
10
+ def initialize(tag_name, link_text, tokens)
11
+ super
12
+ @link_text = link_text
13
+ end
9
14
 
10
15
  def render(context)
11
- @url = super.to_s.strip
16
+ @url = super(context).to_s.strip
12
17
  Jekyll::ArchiveLink.debug("Render called: #{@url}")
13
18
 
14
- <<~HTML
15
- <a href="#{archive_url}">Archive link</a>
16
- HTML
19
+ %[<a href="#{archive_url}">#{link_text}</a>]
17
20
  end
18
21
 
19
22
  def archive_url
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module ArchiveLink
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-archive_link
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodacious