You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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):
What about having HAML expose some hooks, which could be used to implement such a requirement without monkey-patching?
The text was updated successfully, but these errors were encountered: