Variables for use in Mustache templates.
Added: * `docs?`: True if `docs` contains text of any sort, False if it's empty. * `code?`: True if `code` contains text of any sort, False if it's empty. * `empty?`: True if both `code` and `docs` are empty. False otherwise. * `header?`: True if `docs` contains _only_ a HTML header. False otherwise.
This commit is contained in:
parent
bb8fcb9ef0
commit
bb9b167b13
@ -18,9 +18,15 @@ class Rocco::Layout < Mustache
|
||||
num = 0
|
||||
@doc.sections.map do |docs,code|
|
||||
{
|
||||
:docs => docs,
|
||||
:code => code,
|
||||
:num => (num += 1)
|
||||
:docs => docs,
|
||||
:docs? => !docs.empty?,
|
||||
:header? => /^<h.>.+<\/h.>$/.match( docs ),
|
||||
|
||||
:code => code,
|
||||
:code? => !code.empty?,
|
||||
|
||||
:empty? => ( code.empty? && docs.empty? ),
|
||||
:num => (num += 1)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user