nanoc 3.3.3 → 3.3.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.
- data/Gemfile +2 -0
- data/Gemfile.lock +26 -1
- data/NEWS.md +6 -1
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +4 -4
- data/lib/nanoc/base/compilation/rules_collection.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +14 -15
- data/lib/nanoc/helpers/link_to.rb +5 -0
- data/test/base/test_outdatedness_checker.rb +1 -1
- data/test/filters/test_relativize_paths.rb +27 -3
- data/test/helpers/test_link_to.rb +7 -0
- metadata +3 -3
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ gem 'builder'
|
|
8
8
|
gem 'coderay'
|
9
9
|
gem 'coffee-script'
|
10
10
|
gem 'erubis'
|
11
|
+
gem 'fog'
|
11
12
|
gem 'haml'
|
12
13
|
gem 'kramdown'
|
13
14
|
gem 'less', '~> 2.0'
|
@@ -16,6 +17,7 @@ gem 'maruku'
|
|
16
17
|
gem 'mime-types'
|
17
18
|
gem 'mustache'
|
18
19
|
gem 'nokogiri'
|
20
|
+
gem 'pygments.rb'
|
19
21
|
gem 'rack'
|
20
22
|
gem 'rainpress'
|
21
23
|
gem 'rdiscount'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (3.3.
|
4
|
+
nanoc (3.3.4)
|
5
5
|
cri (~> 2.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -10,6 +10,7 @@ GEM
|
|
10
10
|
RedCloth (4.2.9)
|
11
11
|
albino (1.3.3)
|
12
12
|
posix-spawn (>= 0.3.6)
|
13
|
+
blankslate (2.1.2.4)
|
13
14
|
bluecloth (2.2.0)
|
14
15
|
builder (3.0.0)
|
15
16
|
coderay (1.0.6)
|
@@ -20,8 +21,21 @@ GEM
|
|
20
21
|
commonjs (0.2.5)
|
21
22
|
cri (2.2.1)
|
22
23
|
erubis (2.7.0)
|
24
|
+
excon (0.13.4)
|
23
25
|
execjs (1.3.0)
|
24
26
|
multi_json (~> 1.0)
|
27
|
+
ffi (1.0.11)
|
28
|
+
fog (1.3.1)
|
29
|
+
builder
|
30
|
+
excon (~> 0.13.0)
|
31
|
+
formatador (~> 0.2.0)
|
32
|
+
mime-types
|
33
|
+
multi_json (~> 1.0)
|
34
|
+
net-scp (~> 1.0.4)
|
35
|
+
net-ssh (>= 2.1.3)
|
36
|
+
nokogiri (~> 1.5.0)
|
37
|
+
ruby-hmac
|
38
|
+
formatador (0.2.1)
|
25
39
|
haml (3.1.4)
|
26
40
|
json (1.6.6)
|
27
41
|
kramdown (0.13.5)
|
@@ -40,8 +54,13 @@ GEM
|
|
40
54
|
metaclass (~> 0.0.1)
|
41
55
|
multi_json (1.2.0)
|
42
56
|
mustache (0.99.4)
|
57
|
+
net-scp (1.0.4)
|
58
|
+
net-ssh (>= 1.99.1)
|
59
|
+
net-ssh (2.3.0)
|
43
60
|
nokogiri (1.5.2)
|
44
61
|
posix-spawn (0.3.6)
|
62
|
+
pygments.rb (0.2.12)
|
63
|
+
rubypython (~> 0.5.3)
|
45
64
|
rack (1.4.1)
|
46
65
|
rainpress (1.0)
|
47
66
|
rake (0.9.2.2)
|
@@ -49,7 +68,11 @@ GEM
|
|
49
68
|
rdoc (3.12)
|
50
69
|
json (~> 1.4)
|
51
70
|
redcarpet (2.1.1)
|
71
|
+
ruby-hmac (0.4.0)
|
52
72
|
rubypants (0.2.0)
|
73
|
+
rubypython (0.5.3)
|
74
|
+
blankslate (>= 2.1.2.3)
|
75
|
+
ffi (~> 1.0.7)
|
53
76
|
sass (3.1.15)
|
54
77
|
slim (1.2.0)
|
55
78
|
temple (~> 0.4.0)
|
@@ -82,6 +105,7 @@ DEPENDENCIES
|
|
82
105
|
coderay
|
83
106
|
coffee-script
|
84
107
|
erubis
|
108
|
+
fog
|
85
109
|
haml
|
86
110
|
kramdown
|
87
111
|
less (~> 2.0)
|
@@ -93,6 +117,7 @@ DEPENDENCIES
|
|
93
117
|
mustache
|
94
118
|
nanoc!
|
95
119
|
nokogiri
|
120
|
+
pygments.rb
|
96
121
|
rack
|
97
122
|
rainpress
|
98
123
|
rake
|
data/NEWS.md
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.3.4 (2012-04-23)
|
4
|
+
|
5
|
+
* Fixed bug which caused the compilation stack to be empty
|
6
|
+
* Restored Ruby 1.8 compatibility
|
7
|
+
|
3
8
|
## 3.3.3 (2012-04-11)
|
4
9
|
|
5
10
|
* Fixed directed graph implementation on Rubinius
|
6
11
|
* Made capturing helper not remember content between runs
|
7
12
|
* Fixed Date#freeze issue on Ruby 1.8.x
|
8
13
|
* Made it possible to have any kind of object as parameters in the Rules file
|
9
|
-
* Fixed bug which caused
|
14
|
+
* Fixed bug which caused changed routes not to cause a recompile
|
10
15
|
|
11
16
|
## 3.3.2 (2012-03-16)
|
12
17
|
|
data/lib/nanoc.rb
CHANGED
@@ -385,14 +385,14 @@ module Nanoc
|
|
385
385
|
|
386
386
|
rep.compiled = true
|
387
387
|
compiled_content_cache[rep] = rep.content
|
388
|
+
|
389
|
+
Nanoc::NotificationCenter.post(:visit_ended, rep.item)
|
390
|
+
Nanoc::NotificationCenter.post(:processing_ended, rep)
|
391
|
+
Nanoc::NotificationCenter.post(:compilation_ended, rep)
|
388
392
|
rescue => e
|
389
393
|
rep.forget_progress
|
390
394
|
Nanoc::NotificationCenter.post(:compilation_failed, rep, e)
|
391
395
|
raise e
|
392
|
-
ensure
|
393
|
-
Nanoc::NotificationCenter.post(:visit_ended, rep.item)
|
394
|
-
Nanoc::NotificationCenter.post(:processing_ended, rep)
|
395
|
-
Nanoc::NotificationCenter.post(:compilation_ended, rep)
|
396
396
|
end
|
397
397
|
|
398
398
|
# Clears the list of dependencies for items that will be recompiled.
|
@@ -34,21 +34,23 @@ module Nanoc::Filters
|
|
34
34
|
|
35
35
|
# Filter
|
36
36
|
case params[:type]
|
37
|
-
when :html
|
38
|
-
# FIXME parse HTML the proper way using nokogiri
|
39
|
-
content.gsub(/(<[^>]+\s+(src|href))=(['"]?)(\/(?:[^\/].*?)?)\3([\s\/>])/) do
|
40
|
-
$1 + '=' + $3 + relative_path_to($4) + $3 + $5
|
41
|
-
end
|
42
37
|
when :css
|
43
38
|
# FIXME parse CSS the proper way using csspool or something
|
44
39
|
content.gsub(/url\((['"]?)(\/(?:[^\/].*?)?)\1\)/) do
|
45
40
|
'url(' + $1 + relative_path_to($2) + $1 + ')'
|
46
41
|
end
|
47
|
-
when :xml, :xhtml
|
42
|
+
when :html, :xml, :xhtml
|
48
43
|
selectors = params.fetch(:select) { SELECTORS }
|
49
44
|
namespaces = params[:namespaces] || {}
|
50
45
|
|
51
|
-
|
46
|
+
require 'nokogiri'
|
47
|
+
case params[:type]
|
48
|
+
when :html
|
49
|
+
klass = ::Nokogiri::HTML
|
50
|
+
when :xml
|
51
|
+
klass = ::Nokogiri::XML
|
52
|
+
when :xhtml
|
53
|
+
klass = ::Nokogiri::XML
|
52
54
|
# FIXME cleanup because it is ugly
|
53
55
|
# this cleans the XHTML namespace to process fragments and full
|
54
56
|
# documents in the same way. At least, Nokogiri adds this namespace
|
@@ -56,7 +58,7 @@ module Nanoc::Filters
|
|
56
58
|
content.sub!(%r{(<html[^>]+)xmlns="http://www.w3.org/1999/xhtml"}, '\1')
|
57
59
|
end
|
58
60
|
|
59
|
-
nokogiri_process(content, selectors, namespaces, params[:type])
|
61
|
+
nokogiri_process(content, selectors, namespaces, klass, params[:type])
|
60
62
|
else
|
61
63
|
raise RuntimeError.new(
|
62
64
|
"The relativize_paths needs to know the type of content to " +
|
@@ -67,13 +69,11 @@ module Nanoc::Filters
|
|
67
69
|
|
68
70
|
private
|
69
71
|
|
70
|
-
def nokogiri_process(content, selectors, namespaces, type)
|
71
|
-
require 'nokogiri'
|
72
|
-
|
72
|
+
def nokogiri_process(content, selectors, namespaces, klass, type)
|
73
73
|
# Ensure that all prefixes are strings
|
74
74
|
namespaces = namespaces.inject({}) { |new, (prefix, uri)| new.merge(prefix.to_s => uri) }
|
75
75
|
|
76
|
-
doc =
|
76
|
+
doc = klass.fragment(content)
|
77
77
|
selectors.map { |sel| "descendant-or-self::#{sel}" }.each do |selector|
|
78
78
|
doc.xpath(selector, namespaces).each do |node|
|
79
79
|
node.content = relative_path_to(node.content)
|
@@ -88,7 +88,6 @@ module Nanoc::Filters
|
|
88
88
|
|
89
89
|
result
|
90
90
|
end
|
91
|
-
|
92
|
-
|
91
|
+
|
93
92
|
end
|
94
|
-
end
|
93
|
+
end
|
@@ -124,6 +124,11 @@ module Nanoc::Helpers
|
|
124
124
|
raise RuntimeError, "Cannot get the relative path to #{target.inspect} because this target is not outputted (its routing rule returns nil)" if path.nil?
|
125
125
|
end
|
126
126
|
|
127
|
+
# Handle Windows network (UNC) paths
|
128
|
+
if path.start_with?('//') || path.start_with?('\\\\')
|
129
|
+
return path
|
130
|
+
end
|
131
|
+
|
127
132
|
# Get source and destination paths
|
128
133
|
dst_path = Pathname.new(path)
|
129
134
|
raise RuntimeError, "Cannot get the relative path to #{path} because the current item representation, #{@item_rep.inspect}, is not outputted (its routing rule returns nil)" if @item_rep.path.nil?
|
@@ -399,7 +399,7 @@ class Nanoc::OutdatednessCheckerTest < MiniTest::Unit::TestCase
|
|
399
399
|
io.write("compile '/' do\n")
|
400
400
|
io.write(" c = Class.new {}\n")
|
401
401
|
io.write(" def c.inspect ; 'I am so classy' ; end\n")
|
402
|
-
io.write(" filter :erb, :stuff => c\n")
|
402
|
+
io.write(" filter :erb, :stuff => c, :more => 123\n")
|
403
403
|
io.write("end\n")
|
404
404
|
io.write("\n")
|
405
405
|
io.write("route '/' do\n")
|
@@ -46,7 +46,7 @@ class Nanoc::Filters::RelativizePathsTest < MiniTest::Unit::TestCase
|
|
46
46
|
|
47
47
|
# Set content
|
48
48
|
raw_content = %[<a href='/foo'>foo</a>]
|
49
|
-
expected_content = %[<a href=
|
49
|
+
expected_content = %[<a href="../..">foo</a>]
|
50
50
|
|
51
51
|
# Test
|
52
52
|
actual_content = filter.run(raw_content, :type => :html)
|
@@ -70,7 +70,7 @@ class Nanoc::Filters::RelativizePathsTest < MiniTest::Unit::TestCase
|
|
70
70
|
|
71
71
|
# Set content
|
72
72
|
raw_content = %[<a href=/foo>foo</a>]
|
73
|
-
expected_content = %[<a href
|
73
|
+
expected_content = %[<a href="../..">foo</a>]
|
74
74
|
|
75
75
|
# Test
|
76
76
|
actual_content = filter.run(raw_content, :type => :html)
|
@@ -101,6 +101,30 @@ class Nanoc::Filters::RelativizePathsTest < MiniTest::Unit::TestCase
|
|
101
101
|
assert_equal(expected_content, actual_content)
|
102
102
|
end
|
103
103
|
|
104
|
+
def test_filter_html_nested
|
105
|
+
# Create filter with mock item
|
106
|
+
filter = Nanoc::Filters::RelativizePaths.new
|
107
|
+
|
108
|
+
# Mock item
|
109
|
+
filter.instance_eval do
|
110
|
+
@item_rep = Nanoc::ItemRep.new(
|
111
|
+
Nanoc::Item.new(
|
112
|
+
'content',
|
113
|
+
{},
|
114
|
+
'/foo/bar/baz/'),
|
115
|
+
:blah)
|
116
|
+
@item_rep.path = '/foo/bar/baz/'
|
117
|
+
end
|
118
|
+
|
119
|
+
# Set content
|
120
|
+
raw_content = %[<a href="/"><img src="/bar.png" /></a>]
|
121
|
+
expected_content = %[<a href="../../../"><img src="../../../bar.png"></a>]
|
122
|
+
|
123
|
+
# Test
|
124
|
+
actual_content = filter.run(raw_content, :type => :html)
|
125
|
+
assert_equal(expected_content, actual_content)
|
126
|
+
end
|
127
|
+
|
104
128
|
def test_filter_html_outside_tag
|
105
129
|
# Create filter with mock item
|
106
130
|
filter = Nanoc::Filters::RelativizePaths.new
|
@@ -530,4 +554,4 @@ XML
|
|
530
554
|
end
|
531
555
|
|
532
556
|
|
533
|
-
end
|
557
|
+
end
|
@@ -200,6 +200,13 @@ class Nanoc::Helpers::LinkToTest < MiniTest::Unit::TestCase
|
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
203
|
+
def test_relative_path_to_to_windows_path
|
204
|
+
@item_rep = mock
|
205
|
+
@item_rep.stubs(:path).returns('/foo/quux/')
|
206
|
+
|
207
|
+
assert_equal '//mydomain/tahontaenrat', relative_path_to('//mydomain/tahontaenrat')
|
208
|
+
end
|
209
|
+
|
203
210
|
def test_examples_link_to
|
204
211
|
# Parse
|
205
212
|
YARD.parse('../lib/nanoc/helpers/link_to.rb')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cri
|
@@ -400,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
400
400
|
version: '0'
|
401
401
|
requirements: []
|
402
402
|
rubyforge_project:
|
403
|
-
rubygems_version: 1.8.
|
403
|
+
rubygems_version: 1.8.22
|
404
404
|
signing_key:
|
405
405
|
specification_version: 3
|
406
406
|
summary: a web publishing system written in Ruby for building small to medium-sized
|