phlexite-content 0.1.0 → 0.2.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5fdec9c17dc89b705262259246b5df4596664640fda2eca21634ed0f65f9938f
|
|
4
|
+
data.tar.gz: bb2df05096ae671be2397df61ac7ad90ece488ca36db710a0f9585ddaf3ed717
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 407864d7c1f67701b5817e9e955dcb8db7388f49aab98bea16ca34c9bbf05c6fc14c8cc8fc81fe26c11439c3bce4598a7550def0a7f0bbbaa3ded9f34a55e25b
|
|
7
|
+
data.tar.gz: bfbc0a7f994de3a25000c086269539758e7ee2d4445c8ea6e2c074d7cfb75368189cde2cdffe346cd7578ce326b2cdc7cad91936ea69c03f96c95bef558ac59f
|
|
@@ -8,17 +8,13 @@ require 'front_matter_parser'
|
|
|
8
8
|
module Phlexite
|
|
9
9
|
module Content
|
|
10
10
|
class Collection
|
|
11
|
-
def initialize(
|
|
12
|
-
@
|
|
11
|
+
def initialize(source, template, prefix: "", out: "")
|
|
12
|
+
@source = source
|
|
13
13
|
@prefix = prefix
|
|
14
14
|
@out = out
|
|
15
15
|
@template = template
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def entries(prefix: @prefix, out: @out)
|
|
19
|
-
@files.map { |f| Entry.new(f, get_out_path(f, prefix: prefix, out: out)) }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
18
|
def build(site, prefix: @prefix, out: @out)
|
|
23
19
|
entries.each do |f|
|
|
24
20
|
next unless f.filename.start_with? prefix
|
|
@@ -29,6 +25,10 @@ module Phlexite
|
|
|
29
25
|
end
|
|
30
26
|
end
|
|
31
27
|
|
|
28
|
+
def entries(prefix: @prefix, out: @out)
|
|
29
|
+
@source.entries.map { |f| Entry.from_source(f, method(:get_out_path), prefix, out) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
32
|
private
|
|
33
33
|
|
|
34
34
|
def get_out_path(file, prefix: @prefix, out: @out) = "#{File.join(out, File.dirname(file).delete_prefix(prefix), File.basename(file, ".*"))}.html"
|
|
@@ -5,12 +5,17 @@ module Phlexite
|
|
|
5
5
|
class Entry
|
|
6
6
|
attr_reader :filename, :out_path
|
|
7
7
|
|
|
8
|
-
def initialize(filename, out_path)
|
|
8
|
+
def initialize(filename, out_path, reader)
|
|
9
9
|
@filename = filename
|
|
10
10
|
@out_path = out_path
|
|
11
|
+
@reader = reader
|
|
11
12
|
end
|
|
12
13
|
|
|
13
|
-
def
|
|
14
|
+
def self.from_source(source_entry, get_out_path, prefix, out)
|
|
15
|
+
self.new(source_entry.filename, get_out_path.call(source_entry.filename, prefix: prefix, out: out), source_entry.reader)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def read = @reader.call(@filename)
|
|
14
19
|
end
|
|
15
20
|
end
|
|
16
21
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'front_matter_parser'
|
|
2
|
+
|
|
3
|
+
module Phlexite
|
|
4
|
+
module Content
|
|
5
|
+
class LocalSource
|
|
6
|
+
def initialize(glob)
|
|
7
|
+
@files = Dir[glob]
|
|
8
|
+
end
|
|
9
|
+
def entries = @files.map { |f| SourceEntry.new(f, proc { FrontMatterParser::Parser.parse_file f }) }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/phlexite/content.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phlexite-content
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aleks Rutins
|
|
@@ -50,6 +50,8 @@ files:
|
|
|
50
50
|
- lib/phlexite/content.rb
|
|
51
51
|
- lib/phlexite/content/collection.rb
|
|
52
52
|
- lib/phlexite/content/entry.rb
|
|
53
|
+
- lib/phlexite/content/local_source.rb
|
|
54
|
+
- lib/phlexite/content/source_entry.rb
|
|
53
55
|
- lib/phlexite/content/version.rb
|
|
54
56
|
- sig/phlexite/content.rbs
|
|
55
57
|
homepage: https://phlexite.farthergate.com/modules/content
|
|
@@ -73,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
73
75
|
- !ruby/object:Gem::Version
|
|
74
76
|
version: '0'
|
|
75
77
|
requirements: []
|
|
76
|
-
rubygems_version:
|
|
78
|
+
rubygems_version: 4.0.16
|
|
77
79
|
specification_version: 4
|
|
78
80
|
summary: A module for loading Markdown or other content collections in Phlexite.
|
|
79
81
|
test_files: []
|