Luitjes IT | erb2builder

As we were building a new kind of ruby-based no-code platform, we ran into a problem. There is great tooling for parsing Ruby code, and there is great tooling for parsing HTML code. But when you deal with HTML ERB templates, you end up mostly ignoring either the Ruby or the HTML.This is why editors, linters, and tools like Rubocop generally don’t do quite as well on HTML ERB templates.We ended up combining Nokogumbo, Treetop, and the parser gem, to build a custom HTML ERB parser. This parser generates an abstract syntax tree that retains both the HTML structure and the Ruby structure.Pretty cool, but of course there is zero tooling for our weird custom abstract syntax tree format.
Luitjes IT | erb2builder #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/luitjes-it-erb2builder

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles