This looks like it's caused by nanoc's `capture` helper, which is called by
`filter`, and doesn't take into account the indentation added by Haml. Haml's
own capture helper - `capture_haml` - does strip off the extra indentation.
One possible workaround would be to pass the `:ugly` option to Haml, so that
the extra indentation isn't added at all. In nanoc I think you can do this by
passing an option to `filter` in your Rules file:
filter '/foo/', :ugly => true
Another possibility would be to patch the nanoc `capture` helper so that it
calls the Haml helper when in a Haml template, similar to how this is done for
Rails' `capture` method. Add something like this to a file in `lib`:
require 'haml'
module Nanoc::Helpers::Capturing
def capture_with_haml(&block)
if Haml::Helpers.block_is_haml?(block)
capture_haml &block
else
capture_without_haml(&block)
end
end
alias_method :capture_without_haml, :capture
alias_method :capture, :capture_with_haml
end
It does strike me as a little odd that `filter` is a method that first
evaluates the block as the current language before passing it onto the filter
language. The native Haml filters don't treat the filter text as Haml, which
suggests another possibility of creating a `:pandoc` Haml filter (I don't have
Pancoc installed so can't test that).
It might be worth raising an issue with nanoc about this.
Hope this helps.
Matt
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/haml?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.