nanoc-conref-fs 0.4.3 → 0.4.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/Gemfile +2 -9
- data/lib/nanoc-conref-fs/conref-fs.rb +27 -20
- data/lib/nanoc-conref-fs/version.rb +1 -1
- data/nanoc-conref-fs.gemspec +2 -1
- data/test/conref_fs_test.rb +24 -0
- data/test/datafiles_test.rb +2 -2
- data/test/fixtures/Rules +2 -5
- data/test/fixtures/content/maliciousness/asterisk_double.html +15 -0
- data/test/fixtures/content/maliciousness/asterisk_double.md +6 -0
- data/test/fixtures/content/maliciousness/asterisk_single.html +15 -0
- data/test/fixtures/content/maliciousness/asterisk_single.md +6 -0
- data/test/fixtures/data/variables/asterisks.yml +5 -0
- data/test/fixtures/layouts/asterisk.html +15 -0
- metadata +33 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbf03675daecb4694ef342f40682105c08117466
|
4
|
+
data.tar.gz: b654f9aec04cb0b670be30f8a292bca44f154c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21894f1ea9a1a74fdf32f0b8030687d424716bf8feae45fb0f9f8c965bdc0651de8ebd224337d3ac9d015f4c1b35b873bd831c1058692a510555208456a39001
|
7
|
+
data.tar.gz: 9d272820c3cc481104c5da4083e988b293335776fd595d453b5c0a83f575192d588f7a03eae571101136d23514feb196754b334fd89fa7ac339f416c4580be0c
|
data/Gemfile
CHANGED
@@ -1,11 +1,4 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
gem 'kramdown'
|
6
|
-
gem 'activesupport'
|
7
|
-
|
8
|
-
gem 'rake'
|
9
|
-
gem 'minitest'
|
10
|
-
gem 'awesome_print'
|
11
|
-
gem 'safe_yaml'
|
3
|
+
# Specify your gem's dependencies in jekyll-html-pipeline.gemspec
|
4
|
+
gemspec
|
@@ -28,7 +28,7 @@ class ConrefFS < Nanoc::DataSource
|
|
28
28
|
identifier :'conref-fs'
|
29
29
|
|
30
30
|
# Before iterating over the file objects, this method loads the data folder
|
31
|
-
# and applies
|
31
|
+
# and applies it to an ivar for later usage.
|
32
32
|
def load_objects(dir_name, kind, klass)
|
33
33
|
if klass == Nanoc::Int::Item && @variables.nil?
|
34
34
|
data = Datafiles.process(@site_config)
|
@@ -47,16 +47,16 @@ class ConrefFS < Nanoc::DataSource
|
|
47
47
|
association = page_vars[:data_association]
|
48
48
|
toc = VariableMixin.fetch_data_file(association)
|
49
49
|
meta[:parents] = if toc.is_a?(Array)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
find_array_parents(toc, meta['title'])
|
51
|
+
elsif toc.is_a?(Hash)
|
52
|
+
find_hash_parents(toc, meta['title'])
|
53
|
+
end
|
54
54
|
|
55
55
|
meta[:children] = if toc.is_a?(Array)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
find_array_children(toc, meta['title'])
|
57
|
+
elsif toc.is_a?(Hash)
|
58
|
+
find_hash_children(toc, meta['title'])
|
59
|
+
end
|
60
60
|
end
|
61
61
|
page_vars.each_pair do |name, value|
|
62
62
|
meta[name.to_s] = value
|
@@ -103,7 +103,6 @@ class ConrefFS < Nanoc::DataSource
|
|
103
103
|
parents
|
104
104
|
end
|
105
105
|
|
106
|
-
|
107
106
|
# Given a category file that's an array, this method finds
|
108
107
|
# the children of an item, probably a map topic
|
109
108
|
def find_array_children(toc, title)
|
@@ -162,20 +161,28 @@ class ConrefFS < Nanoc::DataSource
|
|
162
161
|
result = ''
|
163
162
|
# This pass replaces any conditionals
|
164
163
|
result = if content =~ Conrefifier::BLOCK_SUB
|
165
|
-
|
164
|
+
content.gsub(Conrefifier::BLOCK_SUB) do |match|
|
165
|
+
Conrefifier.apply_liquid(match, page_vars).chomp
|
166
|
+
end
|
166
167
|
else
|
167
|
-
|
168
|
+
content
|
168
169
|
end
|
169
170
|
|
170
171
|
# This pass converts the frontmatter variables,
|
171
172
|
# and inserts data variables into the body
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
173
|
+
if result =~ Conrefifier::SINGLE_SUB
|
174
|
+
result = result.gsub(Conrefifier::SINGLE_SUB) do |match|
|
175
|
+
resolution = Conrefifier.apply_liquid(match, page_vars).strip
|
176
|
+
if resolution.start_with?('*')
|
177
|
+
if resolution[1] != '*'
|
178
|
+
resolution = resolution.sub(/\*(.+?)\*/, '<em>\1</em>')
|
179
|
+
else
|
180
|
+
resolution = resolution.sub(/\*{2}(.+?)\*{2}/, '<strong>\1</strong>')
|
181
|
+
end
|
182
|
+
end
|
183
|
+
resolution
|
184
|
+
end
|
185
|
+
end
|
179
186
|
|
180
187
|
# This second pass renders any previously inserted
|
181
188
|
# data conditionals within the body
|
@@ -186,7 +193,7 @@ class ConrefFS < Nanoc::DataSource
|
|
186
193
|
end
|
187
194
|
|
188
195
|
result
|
189
|
-
rescue Liquid::SyntaxError
|
196
|
+
rescue Liquid::SyntaxError
|
190
197
|
# unrecognized Liquid, so just return the content
|
191
198
|
# STDERR.puts "Could not convert #{filename}: #{e.message}"
|
192
199
|
result
|
data/nanoc-conref-fs.gemspec
CHANGED
@@ -17,10 +17,11 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_runtime_dependency 'nanoc', '
|
20
|
+
spec.add_runtime_dependency 'nanoc', '~> 4.0'
|
21
21
|
spec.add_runtime_dependency 'activesupport', '~> 4.2'
|
22
22
|
spec.add_runtime_dependency 'liquid', '~> 3.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'rake'
|
25
25
|
spec.add_development_dependency 'minitest', '~> 5.8'
|
26
|
+
spec.add_development_dependency 'awesome_print'
|
26
27
|
end
|
data/test/conref_fs_test.rb
CHANGED
@@ -188,4 +188,28 @@ class DatafilesTest < MiniTest::Test
|
|
188
188
|
assert_equal output_file, test_file
|
189
189
|
end
|
190
190
|
end
|
191
|
+
|
192
|
+
def test_it_works_if_an_asterisk_is_the_first_character
|
193
|
+
with_site(name: FIXTURES_DIR) do |site|
|
194
|
+
|
195
|
+
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
196
|
+
site.compile
|
197
|
+
|
198
|
+
output_file = read_output_file('maliciousness', 'asterisk_single')
|
199
|
+
test_file = read_test_file('maliciousness', 'asterisk_single')
|
200
|
+
assert_equal output_file, test_file
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_it_works_if_asterisks_are_the_first_two_characters
|
205
|
+
with_site(name: FIXTURES_DIR) do |site|
|
206
|
+
|
207
|
+
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
208
|
+
site.compile
|
209
|
+
|
210
|
+
output_file = read_output_file('maliciousness', 'asterisk_double')
|
211
|
+
test_file = read_test_file('maliciousness', 'asterisk_double')
|
212
|
+
assert_equal output_file, test_file
|
213
|
+
end
|
214
|
+
end
|
191
215
|
end
|
data/test/datafiles_test.rb
CHANGED
@@ -6,8 +6,8 @@ class DatafilesTest < MiniTest::Test
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_it_collects_the_files
|
9
|
-
files = Datafiles.collect_data(File.join(FIXTURES_DIR, 'data'))
|
10
|
-
names = %w(categories/category categories/simple reusables/intro reusables/names variables/empty variables/product)
|
9
|
+
files = Datafiles.collect_data(File.join(FIXTURES_DIR, 'data')).sort
|
10
|
+
names = %w(categories/category categories/simple reusables/intro reusables/names variables/asterisks variables/empty variables/product)
|
11
11
|
names.map! { |name| File.join(FIXTURES_DIR, 'data', "#{name}.yml") }
|
12
12
|
assert_equal files, names
|
13
13
|
end
|
data/test/fixtures/Rules
CHANGED
@@ -9,20 +9,17 @@ compile '/**/*.md' do
|
|
9
9
|
layout '/retrieve.*'
|
10
10
|
elsif item[:filename] =~ /_children/
|
11
11
|
layout '/children.*'
|
12
|
+
elsif item[:filename] =~ /asterisk/
|
13
|
+
layout '/asterisk.*'
|
12
14
|
else
|
13
15
|
layout '/default.*'
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
|
18
19
|
route '/**/*.md' do
|
19
20
|
item.identifier.without_ext + '/index.html'
|
20
21
|
end
|
21
22
|
|
22
|
-
route '/**/*.html}' do
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
23
|
route '/**/*' do
|
27
24
|
item.identifier.to_s
|
28
25
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>
|
5
|
+
Asterisk
|
6
|
+
</title>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<strong>Two-factor authentication</strong>, or 2FA, is a way of logging into websites that requires more than just a password. Using a password to log into a website is susceptible to security threats, because it represents a _single_ piece of information a malicious person needs to acquire. The added security that 2FA provides is requiring _additional information_ to sign in.
|
11
|
+
|
12
|
+
*Ta-da!*
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>
|
5
|
+
Asterisk
|
6
|
+
</title>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<em>Two-factor authentication</em>, or 2FA, is a way of logging into websites that requires more than just a password. Using a password to log into a website is susceptible to security threats, because it represents a _single_ piece of information a malicious person needs to acquire. The added security that 2FA provides is requiring _additional information_ to sign in.
|
11
|
+
|
12
|
+
*Ta-da!*
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
about-two-factor-authentication: |
|
2
|
+
*Two-factor authentication*, or 2FA, is a way of logging into websites that requires more than just a password. Using a password to log into a website is susceptible to security threats, because it represents a _single_ piece of information a malicious person needs to acquire. The added security that 2FA provides is requiring _additional information_ to sign in.
|
3
|
+
|
4
|
+
about-two-factor-authentication-strong: |
|
5
|
+
**Two-factor authentication**, or 2FA, is a way of logging into websites that requires more than just a password. Using a password to log into a website is susceptible to security threats, because it represents a _single_ piece of information a malicious person needs to acquire. The added security that 2FA provides is requiring _additional information_ to sign in.
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-conref-fs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: awesome_print
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- gjtorikian@gmail.com
|
@@ -121,6 +135,10 @@ files:
|
|
121
135
|
- test/fixtures/content/frontmatter/different.md
|
122
136
|
- test/fixtures/content/frontmatter/title.html
|
123
137
|
- test/fixtures/content/frontmatter/title.md
|
138
|
+
- test/fixtures/content/maliciousness/asterisk_double.html
|
139
|
+
- test/fixtures/content/maliciousness/asterisk_double.md
|
140
|
+
- test/fixtures/content/maliciousness/asterisk_single.html
|
141
|
+
- test/fixtures/content/maliciousness/asterisk_single.md
|
124
142
|
- test/fixtures/content/maliciousness/unknown.html
|
125
143
|
- test/fixtures/content/maliciousness/unknown.md
|
126
144
|
- test/fixtures/content/obfuscation/admonitions.html
|
@@ -139,8 +157,10 @@ files:
|
|
139
157
|
- test/fixtures/data/categories/simple.yml
|
140
158
|
- test/fixtures/data/reusables/intro.yml
|
141
159
|
- test/fixtures/data/reusables/names.yml
|
160
|
+
- test/fixtures/data/variables/asterisks.yml
|
142
161
|
- test/fixtures/data/variables/empty.yml
|
143
162
|
- test/fixtures/data/variables/product.yml
|
163
|
+
- test/fixtures/layouts/asterisk.html
|
144
164
|
- test/fixtures/layouts/children.html
|
145
165
|
- test/fixtures/layouts/default.html
|
146
166
|
- test/fixtures/layouts/retrieve.html
|
@@ -167,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
187
|
version: '0'
|
168
188
|
requirements: []
|
169
189
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.4.5
|
190
|
+
rubygems_version: 2.4.5.1
|
171
191
|
signing_key:
|
172
192
|
specification_version: 4
|
173
193
|
summary: A Nanoc filesystem to permit using conrefs/reusables in your content.
|
@@ -193,6 +213,10 @@ test_files:
|
|
193
213
|
- test/fixtures/content/frontmatter/different.md
|
194
214
|
- test/fixtures/content/frontmatter/title.html
|
195
215
|
- test/fixtures/content/frontmatter/title.md
|
216
|
+
- test/fixtures/content/maliciousness/asterisk_double.html
|
217
|
+
- test/fixtures/content/maliciousness/asterisk_double.md
|
218
|
+
- test/fixtures/content/maliciousness/asterisk_single.html
|
219
|
+
- test/fixtures/content/maliciousness/asterisk_single.md
|
196
220
|
- test/fixtures/content/maliciousness/unknown.html
|
197
221
|
- test/fixtures/content/maliciousness/unknown.md
|
198
222
|
- test/fixtures/content/obfuscation/admonitions.html
|
@@ -211,8 +235,10 @@ test_files:
|
|
211
235
|
- test/fixtures/data/categories/simple.yml
|
212
236
|
- test/fixtures/data/reusables/intro.yml
|
213
237
|
- test/fixtures/data/reusables/names.yml
|
238
|
+
- test/fixtures/data/variables/asterisks.yml
|
214
239
|
- test/fixtures/data/variables/empty.yml
|
215
240
|
- test/fixtures/data/variables/product.yml
|
241
|
+
- test/fixtures/layouts/asterisk.html
|
216
242
|
- test/fixtures/layouts/children.html
|
217
243
|
- test/fixtures/layouts/default.html
|
218
244
|
- test/fixtures/layouts/retrieve.html
|