<guardian>
ddfreyne: also, getalong has no plans for warnings in kramdown in a near future
<ddfreyne>
Did you talk to him?
<guardian>
ddfreyne: so I started wondering about having a setting to filter some warnings, but it turns out I don't know whether I should store filters as strings in my nanoc.yaml or as !ruby/regexp
<guardian>
ddfreyne: what would you do?
<ddfreyne>
guardian: I’d have it as arguments to the :kramdown filter
<guardian>
sure
<ddfreyne>
Hmm… those might be passed on to kramdown directly though
<guardian>
well I have it as arguments to my :kramdown
<guardian>
but I also want to be able to :filter kramdown, @config[:kramdown] || {}
<guardian>
so all in all, what's good solution to store regexps inside yaml ? :)
<ddfreyne>
guardian: Yeah, that makes sense. I guess you could edit the :kramdown filter to have both styles (if :config is present, pass that to kramdown, otherwise pass params)
<ddfreyne>
guardian: Strings work. You can convert them to regexes using Regexp.new() I believe
<guardian>
because right now, in my own kramdown.rb filter I'm reading params[:warning_filters]
<guardian>
and it's either a String or an Array of String
<guardian>
which in turn I convert to an array of Regexp
<guardian>
so that I can filter out from within the loop that prints the warnings
<guardian>
or remove_if
<guardian>
then again, I'm not sure I'll keep it because:
<guardian>
in fact I'm interested in seeing kramdown warnings, when the source markdown content is written by me
<guardian>
but I have the following situation
<guardian>
all my items are filered by :erb first, then .md files are filtered by :kramdown
<guardian>
I have a tabs() helper which I call like this <%= tabs('/_tab1/', /_tab2/') %>
<guardian>
this helper inserts tabs from partials (/_tabs1/ is content/_tabs1.md)
<guardian>
ultimately, in my _tabs.haml layout, I end up calling item.compiled_content where item is /_tab1/ then /_tab2/
<guardian>
and in fact when kramdown converts _tab1.md to an HTML fragment that gets reinjected in the parent .md file, kramdown outputs non self closing <img> and <br> tags
<guardian>
which in turn cause warnings because instead of being passed through kramdown, kramdown's XHTML(5) parser complains about non self closing tags
<guardian>
see the big picture?
<guardian>
so all in all, either I have my own kramdown filter that filters warnings out, OR I do item.compiled_content.gsub(/<((img|br)[^>]*)>/, '<\1/>') in my tabs helper
<guardian>
I know regexps are ugly in this case, but it narrows down the problem to what it really is, instead of ultimately eliminating ALL the warnings about non self closing <img> and <br>
<ddfreyne>
Yeah, that’s annoying
<ddfreyne>
I am not entirely sure how to solve this… I would like kramdown to optionally emit self-closing tags.
<ddfreyne>
That’d be ideal
<nanoc-gh>
[nanoc] ddfreyne force-pushed improve-errors from 2c47e75 to 5f32ce9: http://git.io/vIxan
<guardian>
Note that the parser basically supports only correct XHTML! However, there are some exceptions. For example, attributes without values (i.e. boolean attributes) are also supported and elements without content like <hr /> can be written as <hr>. If an invalid closing tag is found, it is ignored.
<ddfreyne>
Hm.
<ddfreyne>
Bah
<guardian>
:))
hal_9000 has joined #nanoc
hal_9000_ has quit [Ping timeout: 264 seconds]
jugglinmike has joined #nanoc
<nanoc-gh>
[nanoc] ddfreyne deleted improve-errors at fbd3ea2: http://git.io/vIhe5
<nanoc-gh>
[nanoc] ddfreyne force-pushed fix-show-rules from 87076d3 to 7db7832: http://git.io/vIheh
<nanoc-gh>
nanoc/fix-show-rules b8ab654 Denis Defreyne: Fix show rules (WIP)
<nanoc-gh>
nanoc/fix-show-rules 7db7832 Denis Defreyne: Fix things
<travis-ci>
nanoc/nanoc/master 1ebbb5e Denis Defreyne: The build passed.
jugglinmike has quit [Ping timeout: 264 seconds]
<nanoc-gh>
[nanoc] ddfreyne pushed 1 new commit to master: http://git.io/vIh2k