Sha256: 0f73328149c2ec1dc6873d3f09f968662e6827947ed4c165e631797352302dcf
Contents?: true
Size: 834 Bytes
Versions: 3
Compression:
Stored size: 834 Bytes
Contents
<% require 'delegate' class MarkupNode < SimpleDelegator def title '#' * nesting_level + ' ' + super end def meta return '' if nesting_level == 0 hsh = {}.merge(super) hsh.delete(:parent) hsh.delete(:order_index) hsh.delete(:filename) return '' if hsh.empty? hsh.map{|k, v| "#{k}: #{v}"} .unshift("{{") .push("}}") .join("\n") end def markup [].tap do |o| o << title o << meta unless meta.empty? unless body.empty? o << "\n#{body}" end end.join("\n") end end -%> % <%= @object.title %> % generated by Clerq on <%= Time.now.strftime('%B %e, %Y at %H:%M') %> % default template <% for @node in @object.to_a.drop(1) -%> <% n = MarkupNode.new(@node) -%> <%= n.markup %> <% end %>
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clerq-0.3.2 | lib/assets/tt/default.md.erb |
clerq-0.3.1 | lib/assets/tt/default.md.erb |
clerq-0.3.0 | lib/assets/tt/default.md.erb |