<jugglinmike>
bobthecow: I have a quick Mustache question for you
<jugglinmike>
I
<jugglinmike>
m misunderstanding something basic, because I expect this code to execute the lambda when expanding the template, but it prints the empty string
<bobthecow>
Mustache.render "{{ str }}", {str: -> { "this is a string" }}
<bobthecow>
to be honest, i haven't used mustache on ruby enough to know whether that's considered a lambda value or just a dynamic value. different mustaches treat "anonymous function as a value in a hash" differently.
<jugglinmike>
whoaa I've never seen that syntax before
<jugglinmike>
anonymous function
<jugglinmike>
hmm.. ideally, I would like to be able to pass a Module
<jugglinmike>
This is in service of Nanoc's Mustache filter
<jugglinmike>
Because there ought to be a way to specify Nanoc "helpers" so that you can do something like, "{{ helpers.gravatar }}" from a Mustache template run through a nanoc filter
<jugglinmike>
...where, in your Rules file, you wrote something like `filter '*', :mustache, :helpers => MyHelpersModule
<jugglinmike>
`
<bobthecow>
that syntax is called a "stabby lambda"
<bobthecow>
it was introduced in 1.9
<bobthecow>
-> { foo } == lambda { foo }
<bobthecow>
which is approximately the same as Proc.new { foo }
<jugglinmike>
then the value of `helpers.shout` will be used as a boolean
<jugglinmike>
and that works--if I specify `helpers => { :shout => true } }`, the "X" prints
<jugglinmike>
and when I set it to `false`, the empty string is rendered
<jugglinmike>
but!
<jugglinmike>
If I define a `Helpers` module
<jugglinmike>
no
<jugglinmike>
uhg I don't know
<jugglinmike>
It's getting late here. I think I'll head out. Thanks for humoring me, bobthecow
jugglinmike has quit [Quit: Leaving.]
<bobthecow>
number-six: tell jugglinmike try it with a class instance rather than a module.
<bobthecow>
hrm.
prxq_ has joined #nanoc
prxq has quit [Ping timeout: 260 seconds]
VitamineD has joined #nanoc
relix has joined #nanoc
<ddfreyne>
bobthecow: !tell
<ddfreyne>
!tell bobthecow this is how it works
<number-six>
ddfreyne: I'll pass that on when I see bobthecow here.
<ddfreyne>
I haven't really spent a lot of time on nanoc lately. There's a big project at work and it is sucking all the energy out of me, I think.
<gnufied>
is there an easy to reuse base nanoc structure between projects?
<gnufied>
way*
<gnufied>
such as - Rules, layouts, base CSS
<gnufied>
I know I can reuse by simply copying stuff, but it gets painful to share base styles and rules etc
pavelkunc has joined #nanoc
VitamineD has quit [Quit: VitamineD]
relix has quit [Read error: Connection reset by peer]
relix has joined #nanoc
pavelkunc has quit [Quit: Leaving.]
VitamineD has joined #nanoc
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
VitamineD has quit [Ping timeout: 276 seconds]
pavelkunc has joined #nanoc
prxq_ is now known as prxq
relix has joined #nanoc
gnufied has quit [Ping timeout: 246 seconds]
gnufied has joined #nanoc
jugglinmike has joined #nanoc
<bobthecow>
gnufied: git submodules ftw.
<number-six>
bobthecow: ddfreyne (10 hours ago): this is how it works
<bobthecow>
!tell ddfreyne thanks.
<number-six>
bobthecow: I'll pass that on when I see ddfreyne here.
<bobthecow>
gnufied: in one of my projects, my rules file just imports other rules files from rules/*.rb ... i do it because my rules file was enormous.
<bobthecow>
but you could have a rules submodule, with generic shared rules between different sites.
<bobthecow>
rules/assets.rb that handles generic routing and compiling of less, sass, css, js, coffeescript, etc.
<bobthecow>
rules/articles.rb with blog-specific stuff.
<bobthecow>
whatever.
alerante has joined #nanoc
jugglinmike has quit [Quit: Leaving.]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]