jekyll-pdfviewer 1.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jekyll-pdfviewer.rb +31 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5a7745a4285fb1925a35fd04f979893d475d6358f6d93359310d3ee8c3898154
4
+ data.tar.gz: 76eaf68e2f221abb95e8840681c84a29e0caf43ba17327a730e9a73edc028fda
5
+ SHA512:
6
+ metadata.gz: 4f830e155f253c8d6154097ffcbdca381b86b05271ea0155f63ce406428e4e2a2634ef0cedd9e6f1808defaeb09e5c86f6140d8a0210d404f10ad3083a23724c
7
+ data.tar.gz: d373a78fa514e730cf89d51ce386db8c74064c31f042327d7b795f73a6fdc479cedb1bce33725d0567a367b3fabede3c83efb9e91c636cdd602192df231201de
@@ -0,0 +1,31 @@
1
+ require "jekyll"
2
+ require "jekyll-pdfviewer/version"
3
+ class PdfViewer < Liquid::Tag
4
+
5
+ def initialize(tagName, content, tokens)
6
+ super
7
+ @content = content
8
+ end
9
+
10
+ def render(context)
11
+ pdf_url = "#{context[@content.strip]}"
12
+ # if pdf_url[/youtu\.be\/([^\?]*)/]
13
+ # @youtube_id = $1
14
+ # else
15
+ # # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367
16
+ # pdf_url[/^.*((v\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/]
17
+ # @youtube_id = $5
18
+ # end
19
+
20
+ tmpl_path = File.join Dir.pwd, "_includes", "pdfviewer.html"
21
+ if File.exist?(tmpl_path)
22
+ tmpl = File.read tmpl_path
23
+ site = context.registers[:site]
24
+ tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"pdf_url" => @pdf_url})
25
+ else
26
+ %Q{<object data='#{ @pdf_url }#search=study&highlight=20,20,20,20' type='application/pdf' width='50%' height='50%'><p>It appears your Web browser is not configured to display PDF files. No worries, just <a href='#{ @pdf_url }'>click here to download the PDF file.</a></p></object>}
27
+ end
28
+ end
29
+
30
+ Liquid::Template.register_tag "pdfviewer", self
31
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-pdfviewer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Agius Alexandre
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A pdfViewer for jekyll
14
+ email: agiusalexandre@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/jekyll-pdfviewer.rb
20
+ homepage: https://rubygems.org/gems/pdfviewer
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: PdfViewer for jekyll
43
+ test_files: []