I've just published the first beta version of nanoc 3.0.0. To install
it, use rubygems the usual way but also pass a --prerelease flag, like
this:
sudo gem install nanoc3 --prerelease
This beta version differs from previous preview releases in that it
fixes a few bugs, and also gives the #render method the ability to
take a block. Take a look at <http://pastie.textmate.org/pastes/
575806> to see an example.
Note that the Render helper has been renamed to Rendering, for
consistency's sake. The migration guide on the web site doesn't
reflect this yet, but it will soon.
Do give this beta version a try and let me know what you think!
Regards,
Denis
--
Denis Defreyne
denis.d...@stoneship.org
> 1. When using the 'filesystem_combined' datasource, the yaml
> preamble of a newly generated page is ugly.
Yeah, it rather is. I've changed the format a little bit, so instead
of this:
> -----
> ---
> title: A New Item
>
> -----
> Hi, I'm a new item!
… you now have this:
> ---
> title: A New Item
>
> ---
> Hi, I'm a new item!
(The three dashes in the original format are actually generated by
YAML.dump.)
> 2. The rake 'clean' task does not seem to work. Generated pages are
> still in the output dir after execution.
Hm, that's odd. It seems to work fine here. If you want/can, send me
your site source and I'll check why it isn't working like it is
supposed to.
> 3. The generated 'default.html' erb layout has a 'filter: erb'
> attribute. Does it work ? Does this declaration overide the new
> 'layout' rules ?
Ahh, that's a bug. It's not supposed to be there. The 'filter'
attribute doesn't do anything special in nanoc3. Fixed!
> If I discover new issues , is there a bug tracking site or you
> prefer I post the problem in this group ?
You can use the issue tracker and create a new ticket there by going
to <http://projects.stoneship.org/trac/nanoc/newticket>. You may need
to log in; use username/password nanocuser/nospam. Feel free to leave
fields blank if you don't know what to put there.
> 1. Is there a way of storing site wide metadata in a central place
> and accessing the values from items, helper and layouts ?
I find the site configuration (config.yaml) to be a good location for
storing such stuff. You can access it using @config, which can be
addressed like a hash, e.g. <%= @config[:foo] %>.
> 2. I would like to use the 'coderay filter' on code excerpts in some
> items. However I do not want to filter the whole items with code
> ray. Is there a built-in way to apply a filter to just a part of a
> page ?
There is a "filtering" helper (Nanoc3::Helpers::Filtering), which,
once activated, will give you a #filter method that calls a filter and
outputs the filtered content. It works like this:
<% filter :coderay, :lang => 'ruby' do %>
@foo = bar.baz() - quux
<% end %>
I'll look into the 'rake clean' issue ASAP.
> I just opened a ticket for the 'rake clean' issue in traq. I
> uploaded a minimal website subject to this problem.
Thanks! I've fixed the issue (the Nanoc3::Site object wasn't created
the proper way).
Yeah, #reps simply returns an array now. To get the default rep, you'd
do
reps.find { |r| r.name == :default }
If you only have one rep, reps[0] works and this is something I use a
lot too. In any case, I've updated the documentation. Thanks for
letting me know!
> I am experiencing a weird behavior when playing with '@config[:foo]'
> while in 'nanoc3 auto' mode. The changes I do in the 'config.yaml'
> file are not reflected in the generated output.
Ahh, good catch!
This is actually a fundamental flaw in the Nanoc3::Extra::AutoCompiler
API: the initializer expects a Nanoc3::Site object, but a site cannot
reload its configuration file (because a Site does not necessarily
need an actual physical configuration file; it can use a hash as well).
Fortunately, it's only a tiny flaw that's easily corrected. I've
changed the AutoCompiler API a little: the initializer now expects the
path to a site directory. So, instead of doing
`Nanoc3::Extra::AutoCompiler.new(site)`, you'd do
`Nanoc3::Extra::AutoCompiler.new('.')`.
This is fixed in the repository, so you can either "hg pull -u" in
your existing repo, "hg clone" a new repo, or simply download a
compressed bz2/gz/zip archive at <http://projects.stoneship.org/hg/
nanoc>. To install, cd into the dir and "rake gem:install"--you need
the latest version of rubygems and rdoc, and possibly rake and yard
too. But I'm sure I've mentioned that somewhere else in another thread
already…
Hi,
mtime being nil means "the mtime isn't known" and setting it to
Time.now therefore doesn't seem like the right thing to do. It's true
that you can't change an Item/Layout's mtime once it is created, but
you can pass the mtime to the initializer. For example,
Item#initialize looks like this:
def initialize(raw_content, attributes, identifier, mtime=nil)
# ...
end
Does passing the mtime to the constructor solve your issue? I could
make a mtime setter, but I don't think it makes sense to allow
changing the mtime once the Item/Layout has been created already…