nanoc-conref-fs 0.4.0 → 0.4.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 +4 -4
- data/lib/nanoc-conref-fs/conref-fs.rb +12 -1
- data/lib/nanoc-conref-fs/version.rb +3 -0
- data/nanoc-conref-fs.gemspec +3 -1
- data/test/conref_fs_test.rb +12 -0
- data/test/fixtures/content/maliciousness/unknown.html +14 -0
- data/test/fixtures/content/maliciousness/unknown.md +5 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8084c53b24aef8bc7312834d613080e4db9a113a
|
4
|
+
data.tar.gz: 8694bb5fd7471cf585bf315a32939ee5ea5edc52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4463e0a3e0ad4072eaaf62f2839a36646fb52273f52b2b15ac8f7d7d9790cfd57cdf75b415987f1ae8f471673944222031b8cdbca3248fabf7ba15b3248b9f2d
|
7
|
+
data.tar.gz: 3fbd9bd87eb03c25a6426bf069e5ebe495cfbe63db828ab2e3e6a47cbad4ba383e671c0d5297bf74ac4fcc08de6e64f01a61a05aae93cfd9dbd0f24c3a61706e
|
@@ -142,6 +142,7 @@ class ConrefFS < Nanoc::DataSource
|
|
142
142
|
# (demarcated by Liquid's {{ }} tags) using both the data/ folder and any variables defined
|
143
143
|
# within the nanoc.yaml config file
|
144
144
|
def read(filename)
|
145
|
+
data = ''
|
145
146
|
begin
|
146
147
|
page_vars = Conrefifier.file_variables(@site_config[:page_variables], filename)
|
147
148
|
page_vars = { 'page' => page_vars }.merge(@variables)
|
@@ -153,16 +154,26 @@ class ConrefFS < Nanoc::DataSource
|
|
153
154
|
data = data.gsub(/\{\{\s*#(\S+)\s*\}\}/, '[[#\1]]')
|
154
155
|
data = data.gsub(/\{\{\s*\/(\S+)\s*\}\}/, '[[/\1]]')
|
155
156
|
data = data.gsub(/\{\{\s*(octicon-\S+\s*[^\}]+)\s*\}\}/, '[[\1]]')
|
157
|
+
rescue => e
|
158
|
+
raise "Could not read #{filename}: #{e.inspect}"
|
159
|
+
end
|
160
|
+
|
161
|
+
result = data
|
156
162
|
|
163
|
+
begin
|
157
164
|
# This first pass converts the frontmatter variables,
|
158
165
|
# and inserts data variables into the body
|
159
166
|
result = Conrefifier.apply_liquid(data, page_vars)
|
160
167
|
# This second application renders the previously inserted
|
161
168
|
# data conditionals within the body
|
162
169
|
result = Conrefifier.apply_liquid(result, page_vars)
|
170
|
+
rescue Liquid::SyntaxError
|
171
|
+
# unrecognized Liquid, so just return the content
|
163
172
|
rescue => e
|
164
|
-
raise
|
173
|
+
raise "#{e.message}: #{e.inspect}"
|
165
174
|
end
|
175
|
+
|
176
|
+
result
|
166
177
|
end
|
167
178
|
|
168
179
|
# This method is extracted from the Nanoc default FS
|
data/nanoc-conref-fs.gemspec
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
lib = File.expand_path('../lib', __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
|
+
require 'nanoc-conref-fs/version'
|
5
|
+
|
4
6
|
Gem::Specification.new do |spec|
|
5
7
|
spec.name = 'nanoc-conref-fs'
|
6
|
-
spec.version =
|
8
|
+
spec.version = Conrefifier::VERSION
|
7
9
|
spec.authors = ['Garen Torikian']
|
8
10
|
spec.email = ['gjtorikian@gmail.com']
|
9
11
|
spec.summary = 'A Nanoc filesystem to permit using conrefs/reusables in your content.'
|
data/test/conref_fs_test.rb
CHANGED
@@ -176,4 +176,16 @@ class DatafilesTest < MiniTest::Test
|
|
176
176
|
assert_equal output_file, test_file
|
177
177
|
end
|
178
178
|
end
|
179
|
+
|
180
|
+
def test_it_ignores_unknown_tags
|
181
|
+
with_site(name: FIXTURES_DIR) do |site|
|
182
|
+
|
183
|
+
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
184
|
+
site.compile
|
185
|
+
|
186
|
+
output_file = read_output_file('maliciousness', 'unknown')
|
187
|
+
test_file = read_test_file('maliciousness', 'unknown')
|
188
|
+
assert_equal output_file, test_file
|
189
|
+
end
|
190
|
+
end
|
179
191
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>
|
5
|
+
Unknown tag
|
6
|
+
</title>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
|
11
|
+
You may also wish to add the `{% feed_meta %}` tag to your layout's `<head>` section to allow browsers to more easily discover your site's feed.
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1
|
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
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/nanoc-conref-fs/conref-fs.rb
|
98
98
|
- lib/nanoc-conref-fs/conrefifier.rb
|
99
99
|
- lib/nanoc-conref-fs/datafiles.rb
|
100
|
+
- lib/nanoc-conref-fs/version.rb
|
100
101
|
- nanoc-conref-fs.gemspec
|
101
102
|
- script/bootstrap
|
102
103
|
- test/conref_fs_test.rb
|
@@ -120,6 +121,8 @@ files:
|
|
120
121
|
- test/fixtures/content/frontmatter/different.md
|
121
122
|
- test/fixtures/content/frontmatter/title.html
|
122
123
|
- test/fixtures/content/frontmatter/title.md
|
124
|
+
- test/fixtures/content/maliciousness/unknown.html
|
125
|
+
- test/fixtures/content/maliciousness/unknown.md
|
123
126
|
- test/fixtures/content/obfuscation/admonitions.html
|
124
127
|
- test/fixtures/content/obfuscation/admonitions.md
|
125
128
|
- test/fixtures/content/obfuscation/octicon.html
|
@@ -190,6 +193,8 @@ test_files:
|
|
190
193
|
- test/fixtures/content/frontmatter/different.md
|
191
194
|
- test/fixtures/content/frontmatter/title.html
|
192
195
|
- test/fixtures/content/frontmatter/title.md
|
196
|
+
- test/fixtures/content/maliciousness/unknown.html
|
197
|
+
- test/fixtures/content/maliciousness/unknown.md
|
193
198
|
- test/fixtures/content/obfuscation/admonitions.html
|
194
199
|
- test/fixtures/content/obfuscation/admonitions.md
|
195
200
|
- test/fixtures/content/obfuscation/octicon.html
|