remote-footer 0.0.1
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 +7 -0
- data/_plugins/remote-footer.rb +39 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e1e9af10858da0cfc94c82ecd6075f9d49d7ffa853b8aa381d8834f302ec8b1d
|
|
4
|
+
data.tar.gz: 82f49c42b98c370ea9e9e9799a70bcb7b716fd8c2ba1a27ff9de98d249d20346
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7c57f684fa0eb20d7ebfb4f7eb4c3857e4a999867dfeb7af1ac6de5f55b760a261b665e68936c32cf5f66d4109d9b65d1fa8ff26630e4fb528fcaa11ad427c87
|
|
7
|
+
data.tar.gz: 63e11e2fffc99d808c3c57cf897c4613e0c90c1e5c7669bafd73b6590855494ca9ad8f8f139042c6312fb4bbc453f3b314af25d5143043478029c50028753262
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
require 'open-uri'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module Jekyll
|
|
6
|
+
|
|
7
|
+
class RemoteFooterTag < Liquid::Tag
|
|
8
|
+
|
|
9
|
+
def initialize(tag_name, markup, tokens)
|
|
10
|
+
#markup is what is defined in the tag. Lets make it a URL so devs
|
|
11
|
+
#don't have to update code if the URL changes.
|
|
12
|
+
url = markup
|
|
13
|
+
|
|
14
|
+
#check if the URL is valid
|
|
15
|
+
if url =~ URI::regexp
|
|
16
|
+
#grab the remote document with nokogiri
|
|
17
|
+
doc = Nokogiri::HTML(open(url))
|
|
18
|
+
|
|
19
|
+
#search the document for the HTML element you want
|
|
20
|
+
@node = doc.at_xpath("//div[@id='footer']")
|
|
21
|
+
else
|
|
22
|
+
raise 'Invalid URL passed to RemoteFooterTag'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def render(context)
|
|
29
|
+
output = super
|
|
30
|
+
if @node
|
|
31
|
+
node.to_s
|
|
32
|
+
else
|
|
33
|
+
"Something went wrong in RemoteFooterTag"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Liquid::Template.register_tag('remote-footer', Jekyll::RemoteFooterTag)
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: remote-footer
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Frederic Mallet
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple remote-footer gem
|
|
14
|
+
email: mallet.frederic@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- _plugins/remote-footer.rb
|
|
20
|
+
homepage: https://rubygems.org/gems/remote-footer
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubygems_version: 3.1.2
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: Remote-footer!
|
|
43
|
+
test_files: []
|