nanoc-conref-fs 0.4.2 → 0.4.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80883b64d0bb6285ba2dd26c11d991310170d5d3
|
4
|
+
data.tar.gz: b961ceb417cd9538101760a2c871e32e3bf86b2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71dcfcc7919e46fe2bc62bf351149eb8af6ede84036e6236807508d72aab159aa05a40eb016d25b03bf40db42fb07a9ba737bc9133d51e12c29676fb3057a083
|
7
|
+
data.tar.gz: 3d73990232db307ab431627c5cd40dcbc286bf22dd35864bcbaa37f322c6b8ab7da31456a7b64a74f91e695c09a5858a6d814e80516938e9d92c2f148ee2c61b
|
@@ -159,16 +159,37 @@ class ConrefFS < Nanoc::DataSource
|
|
159
159
|
end
|
160
160
|
|
161
161
|
begin
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
162
|
+
result = ''
|
163
|
+
# This pass replaces any conditionals
|
164
|
+
result = if content =~ Conrefifier::BLOCK_SUB
|
165
|
+
Conrefifier.apply_liquid(content, page_vars)
|
166
|
+
else
|
167
|
+
content
|
168
|
+
end
|
169
|
+
|
170
|
+
# This pass converts the frontmatter variables,
|
171
|
+
# and inserts data variables into the body
|
172
|
+
result = if result =~ Conrefifier::SINGLE_SUB
|
173
|
+
result.gsub(Conrefifier::SINGLE_SUB) do |match|
|
174
|
+
Conrefifier.apply_liquid(match, page_vars)
|
175
|
+
end
|
176
|
+
else
|
177
|
+
result
|
178
|
+
end
|
179
|
+
|
180
|
+
# This second pass renders any previously inserted
|
181
|
+
# data conditionals within the body
|
182
|
+
if result =~ Conrefifier::SINGLE_SUB
|
183
|
+
result = result.gsub(Conrefifier::SINGLE_SUB) do |match|
|
184
|
+
Conrefifier.apply_liquid(match, page_vars)
|
185
|
+
end
|
169
186
|
end
|
170
|
-
|
187
|
+
|
188
|
+
result
|
189
|
+
rescue Liquid::SyntaxError => e
|
171
190
|
# unrecognized Liquid, so just return the content
|
191
|
+
# STDERR.puts "Could not convert #{filename}: #{e.message}"
|
192
|
+
result
|
172
193
|
rescue => e
|
173
194
|
raise "#{e.message}: #{e.inspect}"
|
174
195
|
end
|
@@ -9,7 +9,7 @@ module Datafiles
|
|
9
9
|
data_vars = Conrefifier.file_variables(config[:data_variables], path)
|
10
10
|
data_vars = { :page => data_vars, :site => { :config => config } }
|
11
11
|
|
12
|
-
content = content.gsub(
|
12
|
+
content = content.gsub(Conrefifier::BLOCK_SUB) do |match|
|
13
13
|
# We must obfuscate Liquid variables while replacing conditionals
|
14
14
|
match = match.gsub(/{{/, '~~#~~')
|
15
15
|
match = Conrefifier.apply_liquid(match, data_vars)
|