yarrow 0.9.2 → 0.9.4
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 +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/README.md +10 -7
- data/lib/yarrow/config.rb +76 -13
- data/lib/yarrow/configuration.rb +5 -18
- data/lib/yarrow/content/collection.rb +7 -0
- data/lib/yarrow/content/expansion/aggregator.rb +3 -3
- data/lib/yarrow/content/expansion/filename_map.rb +1 -1
- data/lib/yarrow/content/policy.rb +48 -42
- data/lib/yarrow/defaults.yml +15 -2
- data/lib/yarrow/output/build.rb +37 -0
- data/lib/yarrow/schema/definitions.rb +1 -1
- data/lib/yarrow/schema/dictionary.rb +3 -2
- data/lib/yarrow/schema/entity.rb +18 -12
- data/lib/yarrow/schema/types.rb +63 -33
- data/lib/yarrow/schema/value.rb +21 -12
- data/lib/yarrow/symbols.rb +14 -0
- data/lib/yarrow/version.rb +1 -1
- data/lib/yarrow/web/document.rb +22 -1
- data/lib/yarrow/web/manifest.rb +22 -0
- data/lib/yarrow/web/url.rb +29 -0
- data/lib/yarrow.rb +3 -2
- metadata +5 -9
- data/lib/yarrow/assets/manifest.rb +0 -118
- data/lib/yarrow/assets/pipeline.rb +0 -126
- data/lib/yarrow/assets.rb +0 -2
- data/lib/yarrow/output/context.rb +0 -16
- data/lib/yarrow/output/web/indexed_file.rb +0 -45
- data/lib/yarrow/source/graph.rb +0 -6
- data/lib/yarrow/tools/front_matter.rb +0 -37
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module Yarrow
|
|
2
|
-
module Output
|
|
3
|
-
module Web
|
|
4
|
-
class IndexedFile
|
|
5
|
-
WRITE_MODE = 'w+:UTF-8'.freeze
|
|
6
|
-
|
|
7
|
-
# @return [String] Basename reflecting the server convention (usually: index.html)
|
|
8
|
-
def index_name
|
|
9
|
-
@index_name ||= config.index_name || 'index.html'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# @return [String] Docroot of the output target
|
|
13
|
-
def docroot
|
|
14
|
-
@docroot ||= config.output_dir || 'public'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Write an output file to the specified path under the docroot.
|
|
18
|
-
#
|
|
19
|
-
# @param path [String]
|
|
20
|
-
# @param content [String]
|
|
21
|
-
def write(path, content)
|
|
22
|
-
# If the target path is a directory,
|
|
23
|
-
# generate a default index filename.
|
|
24
|
-
if path[path.length-1] == '/'
|
|
25
|
-
path = "#{path}#{index_name}"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
target_path = Pathname.new("#{docroot}#{path}")
|
|
29
|
-
|
|
30
|
-
ensure_dir_exists!(target_path.dirname)
|
|
31
|
-
|
|
32
|
-
File.open(target_path.to_s, WRITE_MODE) do |file|
|
|
33
|
-
file.puts(content)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def ensure_dir_exists!(target)
|
|
38
|
-
unless File.directory?(target)
|
|
39
|
-
FileUtils.mkdir_p(target)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
data/lib/yarrow/source/graph.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
module Yarrow
|
|
2
|
-
module Tools
|
|
3
|
-
# @deprecated
|
|
4
|
-
# Maintained here as it is still used in a number of places but needs to be removed soon
|
|
5
|
-
module FrontMatter
|
|
6
|
-
|
|
7
|
-
def read_split_content(path, options={})
|
|
8
|
-
extract_split_content(File.read(path, :encoding => 'utf-8'), options)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def extract_split_content(text, options={})
|
|
12
|
-
pattern = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
|
13
|
-
if text =~ pattern
|
|
14
|
-
content = text.sub(pattern, "")
|
|
15
|
-
|
|
16
|
-
begin
|
|
17
|
-
if options.key?(:symbolize_keys)
|
|
18
|
-
meta = YAML.load($1, symbolize_names: true)
|
|
19
|
-
else
|
|
20
|
-
meta = YAML.load($1)
|
|
21
|
-
end
|
|
22
|
-
return [content, meta]
|
|
23
|
-
rescue Psych::SyntaxError => error
|
|
24
|
-
if defined? ::Logger
|
|
25
|
-
# todo: application wide logger
|
|
26
|
-
#logger = ::Logger.new(STDOUT)
|
|
27
|
-
#logger.error "#{error.message}"
|
|
28
|
-
end
|
|
29
|
-
return [content, nil]
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
[text, nil]
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|