-
-
Couldn't load subscription status.
- Fork 579
Open
Description
I want to make haml autogenerate id attributes for all elements. The ids should be static at runtime, so my idea was to use a hash of "#{filename}:#{line}". Currently, I'm doing this using a small monkey patch (requires fix #1140):
module ParserPatch
extend ActiveSupport::Concern
def tag(line)
super.tap do |node|
node.value[:attributes]["id"] ||= Digest::MD5.hexdigest("#{@options.filename}:#{line.index}")
end
end
end
Haml::Parser.prepend(ParserPatch)
What about having HAML expose some hooks, which could be used to implement such a requirement without monkey-patching?
Metadata
Metadata
Assignees
Labels
No labels