<bobthecow>
basically, it walks through the items and sets their parent link if there's an item with an identifier one "directory" above the item's identifier.
<bobthecow>
and adds that item to the parent's children.
<bobthecow>
the one caveat to this is, for example, if you have an item /foo/ and a bunch of /foo/bar/*/ items, but no /foo/bar/, there's no parent/child link.
<bobthecow>
since there's no item in the middle, the chain is broken.
<relix>
ah right
<relix>
thanks!
<relix>
I think I won't make it automatically though, it feels wrong to litter the directory that has the "pages" with directories of images for each page
<relix>
I think I'll run a preprocessor to add the items /assets/foo/* as children for /foo/
<bobthecow>
i would add them to a different property.
<bobthecow>
the parent/child relationship should be treated as read only.
<bobthecow>
it's regenerated periodically.
<bobthecow>
one thing you can do is make your pages index.html
<relix>
oh ok
<relix>
ah right, have a directory for each item
<bobthecow>
so you'd have a directory full of /foo/index.html, /foo/someimage.png
number-six has quit [Remote host closed the connection]
<bobthecow>
then you'd have content files hanging out with assets and the parent/child relationship would work.
number-six has joined #nanoc
<relix>
bobthecow yep that sounds nice
<bobthecow>
ddfreyne: feature request: instead of having the index magic handling at the filesystem data source level, can we specify "directory index" id slugs that are automatically treated as parents? Equivalent to apache's DirectoryIndex config option?
<bobthecow>
then /foo/index/ from any data source would be magic for /foo/
VitamineD has joined #nanoc
<relix>
so I've got /foo/index.html and /foo/someimage.png
<relix>
can I reference the /foo/index item from /foo/someimage?
<relix>
because I'm using index.html metadata to route it, which is not available to someimage
<relix>
ah parent probably
<bobthecow>
yep.
<bobthecow>
as you would expect, the parent/child relationship is symmetric.
VitamineD has quit [Quit: VitamineD]
<relix>
hmm
<relix>
I'm getting some weird results for this one file now
<relix>
so let's say /foo/index.html and /foo/bar1.png, bar2.png etc
<relix>
index.html gets updated twice during the compilation process
<relix>
one update
<relix>
then the images are processed
<relix>
and then foo/index.html is updated again, with a [-0.17s] in the log added for that file
<relix>
ah probably another item that uses the same path
<relix>
damn! of course
<relix>
yep found it
<relix>
thx for being a rubber duckie
VitamineD has joined #nanoc
<bobthecow>
:)
pavelkunc has quit [Quit: Leaving.]
<bobthecow>
i was going to ask that.
VitamineD has quit [Quit: VitamineD]
alerante has joined #nanoc
VitamineD has joined #nanoc
VitamineD has quit [Client Quit]
VitamineD has joined #nanoc
gerwitz has quit [Remote host closed the connection]
gerwitz has joined #nanoc
gerwitz has quit [Remote host closed the connection]
gerwitz has joined #nanoc
gerwitz has quit [Remote host closed the connection]
gerwitz has joined #nanoc
<ddfreyne>
bobthecow: The index logic is gone in nanoc 4.0
<ddfreyne>
So that should solve your issue :D
<ddfreyne>
(that also means the parent/children stuff is not defined anymore, because it's hard to find the parent of /foo/bar.md if you have /foo.md, /foo.erb etc)
<relix>
ddfreyne
<relix>
aww he's probably gone again
<relix>
if /foo/index.md and /foo/img1.png
<relix>
how can I best compile img1.png twice (once original size, once thumbnailed)
<bobthecow>
relix: you do that by making a separate :thumb rep
<relix>
bobthecow yep, but I can't pinpoint the images without the index.md as well
<bobthecow>
that's the answer for "how do i make two of x" for any value of x.
<relix>
can I just ignore "if not item.binary?"
<bobthecow>
ohhh. yeah, you'd route the non-binary ones to nil.
<bobthecow>
that would keep the second rep from compiling.
<bobthecow>
depends though.
<bobthecow>
you could route with regex as well, but that's probably not what you want to do.
<bobthecow>
so i'd stick with the binary switch.
<relix>
bobthecow so if I route a file to nil it will stop the other presentations as well? shitty
<bobthecow>
no, you route the rep to nil.
<bobthecow>
then it will only be compiled if its compiled content is a dependency of something else.