Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
nanoc/nanoc
ddfreyne/nanoc
01022012/nanoc
1234-/nanoc
99ANDREY99/nanoc
ASSTAROID/nanoc
AYCS/nanoc
CyberLeo/nanoc
DaveEveritt/nanoc
Evaliya/nanoc
Halfnhav/nanoc
HubleGiter/nanoc
Julianzz/nanoc
MFRWDesign/nanoc
PandelisZ/nanoc
PatMart/nanoc
Picklive/nanoc
RasTiRayKa/nanoc
RubenVerborgh/nanoc
Spooner/nanoc
TaXueWWL/nanoc
Takashi-U/nanoc
WhiteSymmetry/nanoc
YouthLab/nanoc
ZerGabriel/nanoc
adymo/nanoc
ahnan4arch/nanoc
akmassey/nanoc
alistairholt/nanoc
alkaha/nanoc
andydrop/nanoc
ansarbek/nanoc
ashang/nanoc
avdgaag/nanoc
avontd2868/nanoc
barkinet/nanoc
barraq/nanoc
benilovj/nanoc
billi29/nanoc
bitprophet/nanoc
bobthecow/nanoc
boutil/nanoc
brozzis/nanoc
burnto/nanoc
cakebaker/nanoc
callahad/nanoc
cam-woloshyn/nanoc
candlerb/nanoc
carriercomm/nanoc
cboone/nanoc
ccmtaylor/nanoc
cdchapman/nanoc
cdlm/nanoc
cgirish/nanoc
chenjunsheng/nanoc
chiehwen/nanoc
chiphogg/nanoc
chocopoche/nanoc
chondm/nanoc
chriseppstein/nanoc
connorshea/nanoc
croath/nanoc
delwaterman/nanoc
devdiva/nanoc
dheeraj510/nanoc
diegobarbosa/nanoc
diegoleme/nanoc
digideskio/nanoc
din982/nanoc
doubaokun/nanoc
doubleotoo/nanoc
dufour/nanoc
dv/nanoc
ef37/nanoc
eligoenergy/nanoc
elomatreb/nanoc
exceed/nanoc
fabianbuch/nanoc
fallback/nanoc
faraazkhan/nanoc
felix/nanoc
fj/nanoc
floreal/nanoc
framallo/nanoc
froderik/nanoc
fuzioncloud/nanoc
gaiyangjun/nanoc
geoffreylitt/nanoc
ggarnier/nanoc
gjtorikian/nanoc
gnuhub/nanoc
gpakosz/nanoc
gregkare/nanoc
gsdu8g9/nanoc
hugopeixoto/nanoc
ilkerde/nanoc
inoh/nanoc
jamiepg1/nanoc
jamiepg3/nanoc
jcambry/nanoc
jesshong/nanoc
jethrogb/nanoc
jimjimovich/nanoc
johnae/nanoc
johnbintz/nanoc
johnewart/nanoc
jokester/nanoc
joona/nanoc
joshamos/nanoc
jrocero561/nanoc
jugglinmike/nanoc
kaorukobo/nanoc
keltia/nanoc
kelvinst/nanoc
kongo2002/nanoc
kost/nanoc
krsreenatha/nanoc
legbigi/nanoc
lewisbrown/nanoc
lifepillar/nanoc
lymanlai/nanoc
lynaghk/nanoc
maccaches/nanoc
maciejczyzewski/nanoc
manlen/nanoc
marcenuc/nanoc
marmphco/nanoc
matthiasbeyer/nanoc
mba811/nanoc
michalsz/nanoc
migueljazz/nanoc
mikerus/nanoc
mikoyan/nanoc
mikz/nanoc
mispy/nanoc
mkeveney/nanoc
mmmm9999m/nanoc
momolog/nanoc
mpapis/nanoc
nagyistge/nanoc
nelsonjchen/nanoc
nickyp/nanoc
nikhilm/nanoc
nramya/nanoc
nstielau/nanoc
nu7hatch/nanoc
nudded/nanoc
nvie/nanoc
opatry/nanoc
pablox-cl/nanoc
parastoo-62/nanoc
paulboone/nanoc
pdestefano/nanoc
phamthaithinh/nanoc
pmalik56/nanoc
r14r-work/fork_staticgen_nanoc
radibit/nanoc
raimohanska/nanoc
raphinesse/nanoc
rayleyva/nanoc
reinh/nanoc
remko/nanoc
richardkmichael/nanoc
rlugojr/nanoc
rogernorling/nanoc
rongmic/nanoc
rrrene/nanoc
rubymofo/nanoc
scolytus/nanoc
scott-a-miller/nanoc
sergio/nanoc
silentbicycle/nanoc
smgt/nanoc
spwhitt/nanoc
stamhankar999/nanoc
stasbovanenko/nanoc
stbuehler/nanoc
stephenviles/nanoc
stephenxu/nanoc
stmontgomery/nanoc
strogo/nanoc
suppy/nanoc
suy/nanoc
symsec/nanoc
th-h/nanoc
theGreenJedi/nanoc
tkareine/nanoc
vesaoikonen/nanoc
victe/nanoc
vividtone/nanoc
vschwaberow/nanoc
webflo/nanoc
wellitsmk/nanoc
werthen/nanoc
wfschmitt/nanoc
xavier/nanoc
ydnax/nanoc
ytbryan/nanoc
zaiste/nanoc
zimbarush/nanoc
Nothing to show
...
Choose a Head Repository
nanoc/nanoc
ddfreyne/nanoc
01022012/nanoc
1234-/nanoc
99ANDREY99/nanoc
ASSTAROID/nanoc
AYCS/nanoc
CyberLeo/nanoc
DaveEveritt/nanoc
Evaliya/nanoc
Halfnhav/nanoc
HubleGiter/nanoc
Julianzz/nanoc
MFRWDesign/nanoc
PandelisZ/nanoc
PatMart/nanoc
Picklive/nanoc
RasTiRayKa/nanoc
RubenVerborgh/nanoc
Spooner/nanoc
TaXueWWL/nanoc
Takashi-U/nanoc
WhiteSymmetry/nanoc
YouthLab/nanoc
ZerGabriel/nanoc
adymo/nanoc
ahnan4arch/nanoc
akmassey/nanoc
alistairholt/nanoc
alkaha/nanoc
andydrop/nanoc
ansarbek/nanoc
ashang/nanoc
avdgaag/nanoc
avontd2868/nanoc
barkinet/nanoc
barraq/nanoc
benilovj/nanoc
billi29/nanoc
bitprophet/nanoc
bobthecow/nanoc
boutil/nanoc
brozzis/nanoc
burnto/nanoc
cakebaker/nanoc
callahad/nanoc
cam-woloshyn/nanoc
candlerb/nanoc
carriercomm/nanoc
cboone/nanoc
ccmtaylor/nanoc
cdchapman/nanoc
cdlm/nanoc
cgirish/nanoc
chenjunsheng/nanoc
chiehwen/nanoc
chiphogg/nanoc
chocopoche/nanoc
chondm/nanoc
chriseppstein/nanoc
connorshea/nanoc
croath/nanoc
delwaterman/nanoc
devdiva/nanoc
dheeraj510/nanoc
diegobarbosa/nanoc
diegoleme/nanoc
digideskio/nanoc
din982/nanoc
doubaokun/nanoc
doubleotoo/nanoc
dufour/nanoc
dv/nanoc
ef37/nanoc
eligoenergy/nanoc
elomatreb/nanoc
exceed/nanoc
fabianbuch/nanoc
fallback/nanoc
faraazkhan/nanoc
felix/nanoc
fj/nanoc
floreal/nanoc
framallo/nanoc
froderik/nanoc
fuzioncloud/nanoc
gaiyangjun/nanoc
geoffreylitt/nanoc
ggarnier/nanoc
gjtorikian/nanoc
gnuhub/nanoc
gpakosz/nanoc
gregkare/nanoc
gsdu8g9/nanoc
hugopeixoto/nanoc
ilkerde/nanoc
inoh/nanoc
jamiepg1/nanoc
jamiepg3/nanoc
jcambry/nanoc
jesshong/nanoc
jethrogb/nanoc
jimjimovich/nanoc
johnae/nanoc
johnbintz/nanoc
johnewart/nanoc
jokester/nanoc
joona/nanoc
joshamos/nanoc
jrocero561/nanoc
jugglinmike/nanoc
kaorukobo/nanoc
keltia/nanoc
kelvinst/nanoc
kongo2002/nanoc
kost/nanoc
krsreenatha/nanoc
legbigi/nanoc
lewisbrown/nanoc
lifepillar/nanoc
lymanlai/nanoc
lynaghk/nanoc
maccaches/nanoc
maciejczyzewski/nanoc
manlen/nanoc
marcenuc/nanoc
marmphco/nanoc
matthiasbeyer/nanoc
mba811/nanoc
michalsz/nanoc
migueljazz/nanoc
mikerus/nanoc
mikoyan/nanoc
mikz/nanoc
mispy/nanoc
mkeveney/nanoc
mmmm9999m/nanoc
momolog/nanoc
mpapis/nanoc
nagyistge/nanoc
nelsonjchen/nanoc
nickyp/nanoc
nikhilm/nanoc
nramya/nanoc
nstielau/nanoc
nu7hatch/nanoc
nudded/nanoc
nvie/nanoc
opatry/nanoc
pablox-cl/nanoc
parastoo-62/nanoc
paulboone/nanoc
pdestefano/nanoc
phamthaithinh/nanoc
pmalik56/nanoc
r14r-work/fork_staticgen_nanoc
radibit/nanoc
raimohanska/nanoc
raphinesse/nanoc
rayleyva/nanoc
reinh/nanoc
remko/nanoc
richardkmichael/nanoc
rlugojr/nanoc
rogernorling/nanoc
rongmic/nanoc
rrrene/nanoc
rubymofo/nanoc
scolytus/nanoc
scott-a-miller/nanoc
sergio/nanoc
silentbicycle/nanoc
smgt/nanoc
spwhitt/nanoc
stamhankar999/nanoc
stasbovanenko/nanoc
stbuehler/nanoc
stephenviles/nanoc
stephenxu/nanoc
stmontgomery/nanoc
strogo/nanoc
suppy/nanoc
suy/nanoc
symsec/nanoc
th-h/nanoc
theGreenJedi/nanoc
tkareine/nanoc
vesaoikonen/nanoc
victe/nanoc
vividtone/nanoc
vschwaberow/nanoc
webflo/nanoc
wellitsmk/nanoc
werthen/nanoc
wfschmitt/nanoc
xavier/nanoc
ydnax/nanoc
ytbryan/nanoc
zaiste/nanoc
zimbarush/nanoc
Nothing to show
Commits on Mar 26, 2012
Commits on Apr 06, 2012
Commits on Apr 07, 2012
David Everitt
David Everitt
Missing gem 'redcloth' needs camelcase for 'gem install RedCloth'
--HG--
extra : transplant_source : %2A%D0%BEj%00%F4%5EJ%CE%C5%26%F7%12%C5%F4%40%BDe%F49
Commits on Apr 08, 2012
Commits on Apr 11, 2012
Commits on Apr 12, 2012
Commits on Apr 15, 2012
View
@@ -54,3 +54,4 @@ a88b075869edf52b1e27cc51bbab864912bc9f27 3.2.2
18db8ee1a3cc9da13b1bacd813648a20fcb48b26 3.3.0
f5706db350efa78abf575c763c47b08320fbf1ed 3.3.1
42ef3c24a28852bca2597467fc1ea0155a0db3cc 3.3.2
+378b28f1e70de8ef7b78000c0c7779da076e3253 3.3.3
View
12 NEWS.md
@@ -7,6 +7,18 @@ Extensions:
* Added `:yield` key for Mustache filter
* Added Handebars filter
+## 3.3.4 (???)
+
+* Fixed bug which caused the compilation stack to be empty
+
+## 3.3.3 (2012-04-11)
+
+* Fixed directed graph implementation on Rubinius
+* Made capturing helper not remember content between runs
+* Fixed Date#freeze issue on Ruby 1.8.x
+* Made it possible to have any kind of object as parameters in the Rules file
+* Fixed bug which caused changed routes not to cause a recompile
+
## 3.3.2 (2012-03-16)
* Removed bin/nanoc3 (use nanoc3 gem if you want it)
@@ -385,14 +385,14 @@ def compile_rep(rep)
rep.compiled = true
compiled_content_cache[rep] = rep.content
+
+ Nanoc::NotificationCenter.post(:visit_ended, rep.item)
+ Nanoc::NotificationCenter.post(:processing_ended, rep)
+ Nanoc::NotificationCenter.post(:compilation_ended, rep)
rescue => e
rep.forget_progress
Nanoc::NotificationCenter.post(:compilation_failed, rep, e)
raise e
- ensure
- Nanoc::NotificationCenter.post(:visit_ended, rep.item)
- Nanoc::NotificationCenter.post(:processing_ended, rep)
- Nanoc::NotificationCenter.post(:compilation_ended, rep)
end
# Clears the list of dependencies for items that will be recompiled.
@@ -195,10 +195,28 @@ def inspect
def new_rule_memory_for_rep(rep)
recording_proxy = rep.to_recording_proxy
compilation_rule_for(rep).apply_to(recording_proxy, :compiler => @compiler)
- recording_proxy.rule_memory
+ recording_proxy.rule_memory << [ :write, rep.path ]
+ make_rule_memory_serializable(recording_proxy.rule_memory)
end
memoize :new_rule_memory_for_rep
+ # Makes the given rule memory serializable by calling `#inspect` on the
+ # filter arguments, so that objects such as classes and filenames can be
+ # serialized.
+ #
+ # @param [Array] rs The rule memory for a certain item rep
+ #
+ # @return [Array] The serializable rule memory
+ def make_rule_memory_serializable(rs)
+ rs.map do |r|
+ if r[0] == :filter
+ [ r[0], r[1], r[2].to_a.map { |a| a.inspect } ]
+ else
+ r
+ end
+ end
+ end
+
# @param [Nanoc::Layout] layout The layout to get the rule memory for
#
# @return [Array] The rule memory for the given layout
@@ -1,6 +1,7 @@
# encoding: utf-8
require 'nanoc/base/core_ext/array'
+require 'nanoc/base/core_ext/date'
require 'nanoc/base/core_ext/hash'
require 'nanoc/base/core_ext/pathname'
require 'nanoc/base/core_ext/string'
@@ -0,0 +1,27 @@
+require 'date'
+
+begin
+ d = ::Date.today
+ d.freeze
+ d.year
+ needs_patch = false
+rescue => e
+ needs_patch = true
+end
+
+if needs_patch
+
+ class ::Date
+
+ [ :amjd, :jd, :day_fraction, :mjd, :ld, :civil, :ordinal, :commercial, :weeknum0, :weeknum1, :time, :wday, :julian?, :gregorian?, :leap? ].each do |m|
+ module_eval <<EOS
+ alias_method :__orig_#{m}, :#{m}
+ def #{m}
+ self.frozen? ? self.dup.#{m} : self.send(:__orig_#{m})
+ end
+EOS
+ end
+
+ end
+
+end
@@ -36,6 +36,9 @@ class Item
# item’s content (only available for binary items)
attr_reader :raw_filename
+ # @return [Nanoc::Site] The site this item belongs to
+ attr_accessor :site
+
# @return [Nanoc::Item, nil] The parent item of this item. This can be
# nil even for non-root items.
attr_accessor :parent
@@ -311,7 +311,10 @@ def load_items
@items = []
data_sources.each do |ds|
items_in_ds = ds.items
- items_in_ds.each { |i| i.identifier = File.join(ds.items_root, i.identifier) }
+ items_in_ds.each do |i|
+ i.identifier = File.join(ds.items_root, i.identifier)
+ i.site = self
+ end
@items.concat(items_in_ds)
end
end
@@ -160,7 +160,7 @@ def stack
'rainpress' => 'rainpress',
'rdiscount' => 'rdiscount',
'redcarpet' => 'redcarpet',
- 'redcloth' => 'redcloth',
+ 'redcloth' => 'RedCloth',
'rubypants' => 'rubypants',
'sass' => 'sass',
'systemu' => 'systemu',
@@ -143,24 +143,6 @@ def run(content, params={})
doc.send(method, :encoding => 'UTF-8')
end
- private
-
- KNOWN_COLORIZERS = [ :coderay, :dummy, :pygmentize, :pygmentsrb, :simon_highlight ]
-
- # Removes the first blank lines and any whitespace at the end.
- def strip(s)
- s.lines.drop_while { |line| line.strip.empty? }.join.rstrip
- end
-
- def highlight(code, language, params={})
- colorizer = @colorizers[language.to_sym]
- if KNOWN_COLORIZERS.include?(colorizer)
- send(colorizer, code, language, params[colorizer] || {})
- else
- raise RuntimeError, "I don’t know how to highlight code using the “#{colorizer}” colorizer"
- end
- end
-
# Runs the code through [CodeRay](http://coderay.rubychan.de/).
#
# @api private
@@ -254,13 +236,15 @@ def pygmentsrb(code, language, params={})
#
# @api private
#
+ # @since 3.2.0
+ #
# @param [String] code The code to colorize
#
# @param [String] language The language the code is written in
#
# @option params [String] :style The style to use
#
- # @since 3.2.0
+ # @return [String] The colorized output
def simon_highlight(code, language, params={})
require 'systemu'
@@ -289,6 +273,24 @@ def simon_highlight(code, language, params={})
stdout.read
end
+ private
+
+ KNOWN_COLORIZERS = [ :coderay, :dummy, :pygmentize, :pygmentsrb, :simon_highlight ]
+
+ # Removes the first blank lines and any whitespace at the end.
+ def strip(s)
+ s.lines.drop_while { |line| line.strip.empty? }.join.rstrip
+ end
+
+ def highlight(code, language, params={})
+ colorizer = @colorizers[language.to_sym]
+ if KNOWN_COLORIZERS.include?(colorizer)
+ send(colorizer, code, language, params[colorizer] || {})
+ else
+ raise RuntimeError, "I don’t know how to highlight code using the “#{colorizer}” colorizer"
+ end
+ end
+
def check_availability(*cmd)
systemu cmd
raise "Could not spawn #{cmd.join(' ')}" if $?.exitstatus != 0
@@ -34,29 +34,31 @@ def run(content, params={})
# Filter
case params[:type]
- when :html
- # FIXME parse HTML the proper way using nokogiri
- content.gsub(/(<[^>]+\s+(src|href))=(['"]?)(\/(?:[^\/].*?)?)\3([\s\/>])/) do
- $1 + '=' + $3 + relative_path_to($4) + $3 + $5
- end
when :css
# FIXME parse CSS the proper way using csspool or something
content.gsub(/url\((['"]?)(\/(?:[^\/].*?)?)\1\)/) do
'url(' + $1 + relative_path_to($2) + $1 + ')'
end
- when :xml, :xhtml
+ when :html, :xml, :xhtml
selectors = params.fetch(:select) { SELECTORS }
namespaces = params[:namespaces] || {}
- if params[:type] == :xhtml
+ require 'nokogiri'
+ case params[:type]
+ when :html
+ klass = ::Nokogiri::HTML
+ when :xml
+ klass = ::Nokogiri::XML
+ when :xhtml
+ klass = ::Nokogiri::XML
# FIXME cleanup because it is ugly
# this cleans the XHTML namespace to process fragments and full
# documents in the same way. At least, Nokogiri adds this namespace
# if detects the `html` element.
content.sub!(%r{(<html[^>]+)xmlns="http://www.w3.org/1999/xhtml"}, '\1')
end
- nokogiri_process(content, selectors, namespaces, params[:type])
+ nokogiri_process(content, selectors, namespaces, klass, params[:type])
else
raise RuntimeError.new(
"The relativize_paths needs to know the type of content to " +
@@ -67,13 +69,11 @@ def run(content, params={})
private
- def nokogiri_process(content, selectors, namespaces, type)
- require 'nokogiri'
-
+ def nokogiri_process(content, selectors, namespaces, klass, type)
# Ensure that all prefixes are strings
namespaces = namespaces.inject({}) { |new, (prefix, uri)| new.merge(prefix.to_s => uri) }
- doc = ::Nokogiri::XML.fragment(content)
+ doc = klass.fragment(content)
selectors.map { |sel| "descendant-or-self::#{sel}" }.each do |selector|
doc.xpath(selector, namespaces).each do |node|
node.content = relative_path_to(node.content)
@@ -88,7 +88,6 @@ def nokogiri_process(content, selectors, namespaces, type)
result
end
-
-
+
end
-end
+end
@@ -39,9 +39,6 @@ module Capturing
# @api private
class CapturesStore
- require 'singleton'
- include Singleton
-
def initialize
@store = {}
end
@@ -58,6 +55,15 @@ def [](item, name)
end
+ class ::Nanoc::Site
+
+ # @api private
+ def captures_store
+ @captures_store ||= CapturesStore.new
+ end
+
+ end
+
# @overload content_for(name, &block)
#
# Captures the content inside the block and stores it so that it can be
@@ -96,7 +102,7 @@ def content_for(*args, &block)
# Capture and store
content = capture(&block)
- CapturesStore.instance[@item, name.to_sym] = content
+ @site.captures_store[@item, name.to_sym] = content
else # Get content
# Get args
if args.size != 2
@@ -107,7 +113,7 @@ def content_for(*args, &block)
name = args[1]
# Get content
- CapturesStore.instance[item, name.to_sym]
+ @site.captures_store[item, name.to_sym]
end
end
@@ -124,6 +124,11 @@ def relative_path_to(target)
raise RuntimeError, "Cannot get the relative path to #{target.inspect} because this target is not outputted (its routing rule returns nil)" if path.nil?
end
+ # Handle Windows network (UNC) paths
+ if path.start_with?('//') || path.start_with?('\\\\')
+ return path
+ end
+
# Get source and destination paths
dst_path = Pathname.new(path)
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?
@@ -31,7 +31,7 @@ module XMLSitemap
#
# @example Excluding binary items from the sitemap
#
- # <%= xml_sitemap :items => @items.reject{ |i| i[:is_hidden] || i[:binary] } %>
+ # <%= xml_sitemap :items => @items.reject{ |i| i[:is_hidden] || i.binary? } %>
#
# @option params [Array] :items A list of items to include in the sitemap
#
@@ -0,0 +1,15 @@
+# encoding: utf-8
+
+describe 'Date' do
+
+ it 'should not crash when requesting frozen attributes' do
+ # This test will pass without patch on MRI 1.9.x, but on MRI 1.8.x it
+ # crashes. (Untested on other Ruby implementations such as Rubinius and
+ # JRuby).
+ d = Date.today
+ d.freeze
+ d.year
+ end
+
+end
+
Oops, something went wrong.

No commit comments for this range