nanoc-conref-fs 0.1.0 → 0.1.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 +4 -2
- data/nanoc-conref-fs.gemspec +2 -2
- data/test/conref_fs_test.rb +16 -0
- data/test/fixtures/content/obfuscation/admonitions.html +40 -0
- data/test/fixtures/content/obfuscation/admonitions.md +27 -0
- data/test/fixtures/content/obfuscation/octicon.html +16 -0
- data/test/fixtures/content/obfuscation/octicon.md +5 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3a726e64721a3b46fba7d2c2127e5a32443e32e
|
4
|
+
data.tar.gz: 4029668164382b87e6e6214a43a6799ab6bbe9b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 721c545407580610d9e5837274e4255b948e2258b9282ed01e84c2d7a7e59ad8f130d38a1def79cb1f789cdf3eac58f9c1cd3f4f4082790a1729268da35ff5b5
|
7
|
+
data.tar.gz: 2d02ae7a354ed8660f4a78b43bfc7fa0cb16966fada9c662ab829fe4c557150c1c79d0554ee3c28477d63e8723b710144c89e849b27b10f0167082d221bb838b
|
@@ -68,14 +68,16 @@ class ConrefFS < Nanoc::DataSource
|
|
68
68
|
return data unless filename.start_with?('content')
|
69
69
|
|
70
70
|
# we must obfuscate essential ExtendedMarkdownFilter content
|
71
|
-
data = data.gsub(/\{\{
|
71
|
+
data = data.gsub(/\{\{\s*#(\S+)\s*\}\}/, '[[#\1]]')
|
72
|
+
data = data.gsub(/\{\{\s*\/(\S+)\s*\}\}/, '[[/\1]]')
|
73
|
+
data = data.gsub(/\{\{\s*(octicon-\S+\s*[^\}]+)\s*\}\}/, '[[\1]]')
|
74
|
+
|
72
75
|
# This first pass converts the frontmatter variables,
|
73
76
|
# and inserts data variables into the body
|
74
77
|
result = Conrefifier.apply_liquid(data, page_vars)
|
75
78
|
# This second application renders the previously inserted
|
76
79
|
# data conditionals within the body
|
77
80
|
result = Conrefifier.apply_liquid(result, page_vars)
|
78
|
-
result.gsub('[[#', '{{#').gsub('{{ octicon-', '[[ octicon-')
|
79
81
|
rescue => e
|
80
82
|
raise RuntimeError.new("Could not read #{filename}: #{e.inspect}")
|
81
83
|
end
|
data/nanoc-conref-fs.gemspec
CHANGED
@@ -3,14 +3,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'nanoc-conref-fs'
|
6
|
-
spec.version = '0.1.
|
6
|
+
spec.version = '0.1.1'
|
7
7
|
spec.authors = ['Garen Torikian']
|
8
8
|
spec.email = ['gjtorikian@gmail.com']
|
9
9
|
spec.summary = 'A Nanoc filesystem to permit using conrefs/reusables in your content.'
|
10
10
|
spec.homepage = 'https://github.com/gjtorikian/nanoc-conref-fs'
|
11
11
|
spec.license = 'MIT'
|
12
12
|
|
13
|
-
spec.files = `git ls-files`.split(
|
13
|
+
spec.files = `git ls-files -z`.split("\x0")
|
14
14
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
16
16
|
spec.require_paths = ['lib']
|
data/test/conref_fs_test.rb
CHANGED
@@ -97,4 +97,20 @@ class DatafilesTest < MiniTest::Test
|
|
97
97
|
assert_equal output_file, test_file
|
98
98
|
end
|
99
99
|
end
|
100
|
+
|
101
|
+
def test_it_obfuscates_content
|
102
|
+
with_site(name: FIXTURES_DIR) do |site|
|
103
|
+
|
104
|
+
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
105
|
+
site.compile
|
106
|
+
|
107
|
+
output_file = read_output_file('obfuscation', 'admonitions')
|
108
|
+
test_file = read_test_file('obfuscation', 'admonitions')
|
109
|
+
assert_equal output_file, test_file
|
110
|
+
|
111
|
+
output_file = read_output_file('obfuscation', 'octicon')
|
112
|
+
test_file = read_test_file('obfuscation', 'octicon')
|
113
|
+
assert_equal output_file, test_file
|
114
|
+
end
|
115
|
+
end
|
100
116
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>
|
5
|
+
|
6
|
+
</title>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
|
11
|
+
[[#tip]]
|
12
|
+
|
13
|
+
Here's a hot tip: **line one**
|
14
|
+
Here's a hot tip: line two
|
15
|
+
|
16
|
+
[[/tip]]
|
17
|
+
|
18
|
+
[[#note]]
|
19
|
+
|
20
|
+
This is something you should know! line one
|
21
|
+
This is something you should know! line two
|
22
|
+
|
23
|
+
[[/note]]
|
24
|
+
|
25
|
+
[[#warning]]
|
26
|
+
|
27
|
+
Yo, check this out: line one
|
28
|
+
Yo, check this out: line two
|
29
|
+
|
30
|
+
[[/warning]]
|
31
|
+
|
32
|
+
[[#danger]]
|
33
|
+
|
34
|
+
Sheeeeit, this is a problem: ~~line one~~
|
35
|
+
Sheeeeit, this is a problem: line two
|
36
|
+
|
37
|
+
[[/danger]]
|
38
|
+
|
39
|
+
</body>
|
40
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{{#tip}}
|
2
|
+
|
3
|
+
Here's a hot tip: **line one**
|
4
|
+
Here's a hot tip: line two
|
5
|
+
|
6
|
+
{{/tip}}
|
7
|
+
|
8
|
+
{{#note}}
|
9
|
+
|
10
|
+
This is something you should know! line one
|
11
|
+
This is something you should know! line two
|
12
|
+
|
13
|
+
{{/note}}
|
14
|
+
|
15
|
+
{{#warning}}
|
16
|
+
|
17
|
+
Yo, check this out: line one
|
18
|
+
Yo, check this out: line two
|
19
|
+
|
20
|
+
{{/warning}}
|
21
|
+
|
22
|
+
{{#danger}}
|
23
|
+
|
24
|
+
Sheeeeit, this is a problem: ~~line one~~
|
25
|
+
Sheeeeit, this is a problem: line two
|
26
|
+
|
27
|
+
{{/danger}}
|
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.1.
|
4
|
+
version: 0.1.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-10-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc
|
@@ -110,6 +110,10 @@ files:
|
|
110
110
|
- test/fixtures/content/frontmatter/different.md
|
111
111
|
- test/fixtures/content/frontmatter/title.html
|
112
112
|
- test/fixtures/content/frontmatter/title.md
|
113
|
+
- test/fixtures/content/obfuscation/admonitions.html
|
114
|
+
- test/fixtures/content/obfuscation/admonitions.md
|
115
|
+
- test/fixtures/content/obfuscation/octicon.html
|
116
|
+
- test/fixtures/content/obfuscation/octicon.md
|
113
117
|
- test/fixtures/content/parents/missing_title.html
|
114
118
|
- test/fixtures/content/parents/missing_title.md
|
115
119
|
- test/fixtures/content/parents/single_parent.html
|
@@ -160,6 +164,10 @@ test_files:
|
|
160
164
|
- test/fixtures/content/frontmatter/different.md
|
161
165
|
- test/fixtures/content/frontmatter/title.html
|
162
166
|
- test/fixtures/content/frontmatter/title.md
|
167
|
+
- test/fixtures/content/obfuscation/admonitions.html
|
168
|
+
- test/fixtures/content/obfuscation/admonitions.md
|
169
|
+
- test/fixtures/content/obfuscation/octicon.html
|
170
|
+
- test/fixtures/content/obfuscation/octicon.md
|
163
171
|
- test/fixtures/content/parents/missing_title.html
|
164
172
|
- test/fixtures/content/parents/missing_title.md
|
165
173
|
- test/fixtures/content/parents/single_parent.html
|