jekyll-relative-urls 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 679993844d159d8d93e7be387656292d3d2cfc45c7d7d40bef5dbc85304311b5
4
- data.tar.gz: 4ce78e2b0c4b032bca6e70c6c11fa1e21b81cbb5b23ff26a033acd54cd90d2b0
3
+ metadata.gz: 5d57d03129df2bf7f5d74d9c32be83ed105f30e6d141dd89d565d377c1e643e8
4
+ data.tar.gz: dd023be0b607b25eb8d23061e111b762c4bcac72b0a871c3a86521482b93156b
5
5
  SHA512:
6
- metadata.gz: 871ad8b7444839125c6af02a6d69debe86831499555d79a00b2105505361aec6a60d5dd6f816754aeabab705c37a30e695928e66bb5bb249c0d7d87cc9912a06
7
- data.tar.gz: 1082b7881471499e8112f19137477712a2974fa6b18135c5848dfe7530ab2fbeb1d6e177d520b7a88d0bc9650ce497cef547ce0bf94cb4eb6eaddb608bc920b2
6
+ metadata.gz: 9529fe97234ff79601fa03c92b97395d912ec8595a160247fba15aa7a4954d3673ba35307f9e5af2960cd3eca7d64b413f6c40163b64aece71f4ef506f700ad2
7
+ data.tar.gz: e777a1f1da3432aceb819fdaf3e76fe90e93d7f1d4e9a486d21eef89e192d52244dc9c0b2dd97e9d93cdf9fbc44c3911a2268ba1d88314f91625890b609cb15a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-relative-urls (0.0.1)
4
+ jekyll-relative-urls (0.0.3)
5
5
  jekyll (~> 3.8.5)
6
6
 
7
7
  GEM
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'jekyll-relative-urls'
6
- gem.version = '0.0.2'
6
+ gem.version = '0.0.3'
7
7
  gem.authors = ['Sutty']
8
8
  gem.email = ['hi@sutty.nl']
9
9
  gem.description = 'It allows you to generate sites that work without changes even if you put them on one or several levels of subdirectories, thus making them transportable :)'
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.add_dependency('jekyll', '~> 3.8.5')
19
+ gem.add_runtime_dependency 'jekyll', '~> 3.8', '>= 3.8.5'
20
20
  gem.add_development_dependency('rubocop', '~> 0.68')
21
21
  gem.add_development_dependency('rubocop-performance', '~> 0')
22
22
  end
@@ -1,2 +1,3 @@
1
1
  require_relative 'jekyll/url'
2
+ require_relative 'jekyll/renderer'
2
3
  require_relative 'jekyll/tags/base'
@@ -0,0 +1,39 @@
1
+ # Copyright (c) 2019 Sutty <hi@sutty.nl>
2
+ #
3
+ # This file is part of jekyll-relative-urls
4
+ #
5
+ # jekyll-relative-urls is free software: you can redistribute it and/or
6
+ # modify it under the terms of the GNU General Public License as
7
+ # published by the Free Software Foundation, either version 3 of the
8
+ # License, or (at your option) any later version.
9
+ #
10
+ # jekyll-relative-urls is distributed in the hope that it will be
11
+ # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with jekyll-relative-urls. If not, see
17
+ # <https://www.gnu.org/licenses/>.
18
+
19
+ # Asegurarse que Jekyll::Renderer exista antes de redefinirlo
20
+ require 'jekyll/renderer'
21
+
22
+ module Jekyll
23
+ # Redefinir Renderer.render_document()
24
+ class Renderer
25
+ alias original_render_document render_document
26
+
27
+ def render_document
28
+ relativize_anchors_to original_render_document, document.url
29
+ end
30
+
31
+ private
32
+
33
+ # Los links internos necesitan colocarse dentro de la misma URL o
34
+ # sino volvemos al inicio del sitio
35
+ def relativize_anchors_to(input, base)
36
+ input.gsub(/(href=["'])#/, "\\1#{base}#")
37
+ end
38
+ end
39
+ end
@@ -27,6 +27,9 @@ module Jekyll
27
27
  # La ruta relativa a la raíz del sitio
28
28
  base = ''
29
29
 
30
+ # Si la ruta contiene extensión, descontar uno
31
+ depth -= 1 unless context.registers[:page]['url'].end_with? '/'
32
+
30
33
  # Establecer el nivel en el que estamos, subiendo niveles hacia la
31
34
  # raíz del sitio
32
35
  depth.times do
metadata CHANGED
@@ -1,20 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-relative-urls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sutty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-11 00:00:00.000000000 Z
11
+ date: 2019-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.8'
20
+ - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 3.8.5
20
23
  type: :runtime
@@ -22,6 +25,9 @@ dependencies:
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.8'
30
+ - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 3.8.5
27
33
  - !ruby/object:Gem::Dependency
@@ -72,6 +78,7 @@ files:
72
78
  - jekyll-relative-urls.gemspec
73
79
  - lib/jekyll-relative-urls.rb
74
80
  - lib/jekyll.rb
81
+ - lib/jekyll/renderer.rb
75
82
  - lib/jekyll/tags/base.rb
76
83
  - lib/jekyll/url.rb
77
84
  homepage: https://0xacab.org/sutty/jekyll/jekyll-relative-urls