jekyll-pdf-embed 1.0.2 → 1.0.3

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 +4 -4
  2. data/lib/jekyll-pdf-embed.rb +12 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beae1030c2bc28ceacb22348348e25e795bb13edf8c6acb85143f116ed46a1b0
4
- data.tar.gz: dc2aaa09bdd08457d0ffb36978efcade92dd1b9821bfabe1671609e1cd6d6f88
3
+ metadata.gz: 4a1810d37651040f56ddf5c3b7bd97bb06f7013bdf4ff2010e5c9584c0e44d1e
4
+ data.tar.gz: 70612d1a41f465b18e6f624c76c988f25a9707d421bf643c0d62e079967c2f2f
5
5
  SHA512:
6
- metadata.gz: df0a83aee8120e660643d1e1215dd278456456fa5bcf2beea2f3d1a274b083c09b31249ac03d30b316ac4410a2ce11d50326e0e3aa9704a5a7975acda2ee6a85
7
- data.tar.gz: 4ed799fad7d82aef99ccdbb837856913d2a77d84e09ddc778163d1dcfcf2c6e8e998eaa3b0b0a8d46dd9acbc3eb81192ea8d8dbc8aa06f4c48f38e7d24a4fa4e
6
+ metadata.gz: 8a8d8c93bd45bc8dc4e1be55e035b19343a4405afa2e6b61c00672812da035e0771f139aa64a9bddc86dad475876e490869c0f8b8c36b6eb50aa50fc8ba20087
7
+ data.tar.gz: 726883df29da44c0320e516693afe1b4a12875ef9beb8c2f22282973ae7aae100fef04d33c7f0222f9738399a39b8c3b56c0a5e344d446c3c1ad0c3f68128dce
@@ -4,13 +4,21 @@ class PDFEmbed < Liquid::Tag
4
4
 
5
5
  def initialize(tag_name, text, tokens)
6
6
  super
7
- @text = text
7
+ @link = text[/".*?"/]
8
+ @link_escaped = @link.gsub(" ", "%20")
9
+ @text = text.gsub(@link, @link_escaped)
10
+ *@params = @text.split(/ /)
8
11
  end
9
12
 
10
13
  def render(context)
11
- %Q{<style>.pdf-embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin-bottom: 20px; border-style: solid; } .pdf-link { background-color: white; text-align: center; border-style: solid; } .pdf-embed-container iframe, .pdf-embed-container object, .pdf-embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class='pdf-link'><a href=#{@text}>View PDF</a></div><div class='pdf-embed-container'><iframe title="PDF file" width="640" height="390" src=#{@text} frameborder="0" allowfullscreen></iframe></div>}
14
+ if @params.length == 1
15
+ %Q{<style>.pdf-embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin-bottom: 20px; border-style: solid; } .pdf-link { background-color: white; text-align: center; border-style: solid; } .pdf-embed-container iframe, .pdf-embed-container object, .pdf-embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class='pdf-link'><a href=#{@link_escaped} target="_blank">View PDF</a></div><div class='pdf-embed-container'><iframe title="PDF file" width="640" height="390" src=#{@link_escaped} frameborder="0" allowfullscreen></iframe></div>}
16
+ elsif @params.length == 2 && @params[1] == 'no_link'
17
+ %Q{<style>.pdf-embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin-bottom: 20px; } .pdf-embed-container iframe, .pdf-embed-container object, .pdf-embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class='pdf-embed-container'><iframe title="PDF file" width="640" height="390" src=#{@link_escaped} frameborder="0" allowfullscreen></iframe></div>}
18
+ else
19
+ raise ArgumentError, 'ERROR:bad_syntax'
20
+ end
12
21
  end
13
22
 
14
23
  Liquid::Template.register_tag('pdf', self)
15
- end
16
-
24
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-pdf-embed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mihajlo Nesic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-24 00:00:00.000000000 Z
11
+ date: 2019-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll