jekyll-pages-directory 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.
- checksums.yaml +7 -0
- data/lib/jekyll-pages-directory.rb +53 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 183fc96b62c107c4b7aab4b7a34ed821c5e9adcabf3fe6a4efee8d28fc182e99
|
4
|
+
data.tar.gz: 93700e2a47fdda30db98c09039dacd431e8b2778fb79984462e724691d6684ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b62a362ba9426c6c9b13384551fa3199166b55dc11d91c9618dc3a8f30557c59f51dc63389fa2836e8e4a547243b9fab32b04794e4eadf37216117316ee18c68
|
7
|
+
data.tar.gz: 894e4d46070f5b7edbeaeceae30751c39a482d4d1394febd71b3c07d34d643eb01bd5785529bcaac1c4bbdad6819faa37f89de328b73939d86011cd4d759e733
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# https://github.com/bbakersmith/jekyll-pages-directory / commit: 1abb41fbc9a064b7498f52a797cda53505525883
|
2
|
+
# Based off the latest commit, with additional tweaks to allow _pages within collections_dir
|
3
|
+
module Jekyll
|
4
|
+
class PagesDirGenerator < Generator
|
5
|
+
def generate(site)
|
6
|
+
pages_dir = site.config['pages'] || (site.config['collections_dir'] ? site.config['collections_dir'] + '/_pages' : nil) || './_pages'
|
7
|
+
all_raw_paths = Dir["#{site.source}/#{pages_dir}/**/*"]
|
8
|
+
all_raw_paths.each do |f|
|
9
|
+
|
10
|
+
if File.file?(f)
|
11
|
+
filename = f.match(/[^\/]*$/)[0]
|
12
|
+
clean_filepath = f.gsub(/^#{site.source}\/#{pages_dir}\//, '')
|
13
|
+
clean_dir = extract_directory(clean_filepath)
|
14
|
+
|
15
|
+
site.pages << PagesDirPage.new(site,
|
16
|
+
site.source,
|
17
|
+
clean_dir,
|
18
|
+
filename,
|
19
|
+
pages_dir)
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def extract_directory(filepath)
|
26
|
+
dir_match = filepath.match(/(.*\/)[^\/]*$/)
|
27
|
+
if dir_match
|
28
|
+
return dir_match[1]
|
29
|
+
else
|
30
|
+
return ''
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class PagesDirPage < Page
|
36
|
+
|
37
|
+
def initialize(site, base, dir, name, pagesdir)
|
38
|
+
@site = site
|
39
|
+
@base = base
|
40
|
+
@dir = dir
|
41
|
+
@name = name
|
42
|
+
|
43
|
+
process(name)
|
44
|
+
read_yaml(File.join(base, pagesdir, dir), name)
|
45
|
+
|
46
|
+
data.default_proc = proc do |hash, key|
|
47
|
+
site.frontmatter_defaults.find(File.join(dir, name), type, key)
|
48
|
+
end
|
49
|
+
|
50
|
+
Jekyll::Hooks.trigger :pages, :post_init, self
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-pages-directory
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Baker-Smith
|
8
|
+
- Angus Johnston
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jekyll
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.7'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '5.0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.7'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
description:
|
35
|
+
email:
|
36
|
+
- admin+rubygems@codeanimu.net
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- lib/jekyll-pages-directory.rb
|
42
|
+
homepage: https://github.com/bbakersmith/jekyll-pages-directory
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata:
|
46
|
+
homepage_uri: https://github.com/bbakersmith/jekyll-pages-directory
|
47
|
+
source_code_uri: https://github.com/bbakersmith/jekyll-pages-directory
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubygems_version: 3.0.3
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: Defines a _pages directory for page files which routes its contents relative
|
67
|
+
to the project root.
|
68
|
+
test_files: []
|