<Palmik>
Hi guys. Can I have a multiple pattern matches to use the same compile/route rule?
<ddfreyne>
Palmik: Hi! You can loop over them like this:
<ddfreyne>
[ '/foo/*/', '/bar/*/' ].each do |rule|
<ddfreyne>
compile rule do … end
<ddfreyne>
end
<Palmik>
ddfreyne: Thanks! :)
Palmik has quit [Quit: Lost terminal]
Palmik has joined #nanoc
jadd- has quit [Quit: Leaving...]
jadd_ has joined #nanoc
kitallis has joined #nanoc
jadd_ has quit [Client Quit]
jadd_ has joined #nanoc
Rym has joined #nanoc
<Palmik>
Hmm, I have a default template that contains <html> ... </html> etc. and have a yield slot. I would like to also have a 'post' template that is basically the default template, plus wraps the yield. Is that possible? I know that it is possible the otherway round (to render template inside the current one).
jadd_ has quit [Quit: Leaving...]
<ddfreyne>
Palmik: You can have multiple layouts in a single compilation rule
<Palmik>
ddfreyne: Ah, thanks, I will try that out. :)
<Palmik>
Yes, that works.
<Palmik>
This is mine project structure: http://hpaste.org/85883 this is mine compass/config.rb http://hpaste.org/85884 and this is the relevant part of Rules http://hpaste.org/85885 (it's on the very top of Rules). The problem is that when I do 'nanoc', the stylesheets are not generated. Any guess as to what am I doing wrong?
yogsototh has joined #nanoc
<ddfreyne>
Palmik: the last #compile should be #route
<Palmik>
Om my, you are right.
<Palmik>
Hmm, is it possible to add a kind to an item based on a wildcard? For example when the item matches '/post/*' I would like to assign [:type] = :post
<ddfreyne>
Palmik: You can do that in the preprocess block. In the rules: preprocess do ; @items.select { |i| i.identifier.start_with?('/post/') }.each { |i| i[:type] = :post } ; end
<Palmik>
Yeah, I guess start_with will suffice for my purposes. :)
<Palmik>
Thanks.
<Palmik>
Is code in lib/ run before preprocess or the other way round? I'm asking because I have some code in lib/ that depends on the :type defined in preprocess, but I would also like to add 'prev' and 'next' links to items.
<Palmik>
The text after the last comma is not relevant.
<ddfreyne>
Yes, lib/ is loaded first
<Palmik>
I guess it should not matter in my case since I will call the code from lib/ after preprocess anyway.
<Palmik>
I though the post call in the template would happen after preprocess.
<ddfreyne>
Palmik: Hmm, that looks correct. lib/ is loaded first, then preprocessing is done, then the actual compilation is done
<ddfreyne>
Palmik: I’m at work atm, so not really a lot of time to help sadly. Maybe this evening?
<Palmik>
No problem, I should also probably work on something else right now. :)
pavelkunc has joined #nanoc
bghost has quit [Ping timeout: 264 seconds]
<guardian>
google still hasn't downloaded my robots.txt
<guardian>
weird
bghost has joined #nanoc
bghost has quit [Changing host]
bghost has joined #nanoc
pyro111 has joined #nanoc
xo__ has joined #nanoc
Segismond_ has quit [Read error: Connection reset by peer]
pavelkunc has quit [Quit: Leaving.]
jimjimovich has joined #nanoc
<jimjimovich>
how do you access variables from nanoc.yaml in your layouts?
<ddfreyne>
jimjimovich: @config[:foo]
<ddfreyne>
jimjimovich: Assuming that you have “foo: something” in your nanoc.yaml of course
<jimjimovich>
that's what I thought, but it doesn't seem to be working for some reason ... hmm
<jimjimovich>
do I have to load nanoc.yaml somewhere first? @config[:foo] returns nil
<ddfreyne>
No, that should work right away. Can you share the config file and the code you use to access attributes there?
<darix>
jimjimovich: you mean config.yaml not nanoc.yaml right?
<ddfreyne>
darix: nanoc.yaml is also possible as of 3.7
<darix>
or is nanoc.yaml content/.../nanoc.yaml
<darix>
aha
<ddfreyne>
(it makes sense to call it that, and con<tab> now autocompletes nicely)
<darix>
so jimjimovich are you using 3.7?
<jimjimovich>
actually, no, I'm not. I guess the docs are more up to date than the gem :)
<jimjimovich>
changed it back to config.yaml (what it was originally) and it still doesn't work
jugglinmike has joined #nanoc
<ddfreyne>
jimjimovich: Are you replacing :foo with the exact attribute you’re trying to access?
<jimjimovich>
yes, and even added in foo: 'bar' and try to access it with @config[:foo] with no luck
<ddfreyne>
Hmmmmmm… strange
<jimjimovich>
even if that's the only thing in the yaml file
<jimjimovich>
was the yaml format updated? I got this from a site I made like 6 months ago.
<ddfreyne>
No, YAML is a fixed format
<ddfreyne>
jimjimovich: Care to share your config file?
<ddfreyne>
Probably something silly
<jimjimovich>
also, the config file wasn't generated when I generated the site, that's why I copied it from an old one. I have just foo: bar in there now ... and still doesn't work.
<ddfreyne>
jimjimovich: Okay, very weird. Do you have both config.yaml and nanoc.yaml?
<ddfreyne>
jimjimovich: What nanoc version are you using?
<jimjimovich>
no
<ddfreyne>
(All 3.x releases are backwards compatible, so upgrading to a newer version shouldn’t have changed anything)
<ddfreyne>
afk for a meeting in a minute
<jimjimovich>
um, okay, now it's working but my @item.path is not. I'll dig into that now.
<jimjimovich>
oh geesh, this is dumb! in the yaml.config file that I copied from the other site, the output folder was changed from 'output' to 'public' ... so I wasn't seeing the changes show up. DOH!