If he's only worked with people who don't indent their HTML, then he's only worked with bad (probably), lazy (definitely) devs. That's no excuse.
It isn't just a nightmare trying to READ unindented code, it's hell on earth trying to find that div you forgot to close.
Put your foot down with him, now.
And to distract you from what you're supposed to be working on, have you tried haml?
I'm learning Rust and want to make a static site generator as a project and thought about using Haml as the templating language but then saw there were no Rust libraries for Haml, which made me want to create one. I learned a lot doing this project and wrestled with the borrow checker more times than I want to admit (though it did teach me about arenas, which is neat). I would welcome any feedback as well as any tips to make this more idiomatic Rust.
Emacs is not indenting properly because although that's valid HTML5, it's not valid XHTML. If you make the li tags self-closing with <li /> (Similar to how <br /> works), I bet you emacs will indent it properly.
But if you really want to avoid ever writing a closing tag, use haml, which is another markup syntax that compiles into html. Saves a ton of typing (although as an emacs user, you probably don't care about wasted keystrokes. BAH-ZING!)
I'm following Angular 2 and some stacks include HAML which is quite similar to Slim.
If you use Webpack, there is a loader: haml-haml-loader.
HAML is designed to be a MVC view template language, and as such, it has some restrictions in place. Namely, you are discouraged from having multiple lines of code.
You can do it, but its intentionally yucky. You are encouraged to put complex code in a helper file, and keep your views as clean as possible.
As for interpolating variables in text, HAML is written as such that you can use #{}
in any text to interpolate, much like ruby.
If you want to iterate over a collection and format it as a list, its quite simple:
%ul - my_list.each do |l| %li= l
Rubyists every other year or so: Man, I hate writing HTML...
Sources:
I'm sure there are others
I'm learning as well but I noticed up top that it was rendered as HAML.
Seems that the % is there to make specific HTML element happen and the plain "." creates a div with that class. Someone else can probably elaborate more but this was just after some quick googling.
"The program" is made up of many files. There should be an installation guide on that git.
You can use a cms with a wysiwyg and never have to write any html. But what they probably mean is that they use a wrapper like HAML or generate most of it in loops and database calls.
There a few different approaches here. If all you're looking to do is save the duplicative nature of the markup, HAML has the great helper: list_of.
Using it is pretty simple, but you can do some very powerful things with it.
At it's most basic you can use it to just dump out a single level deep of menu items:
%ul = list_of [['Users', '#'] ['Staff, '#'] ['Managers, '#'] ['Delivery, '#']] do |item| %a{href: item[1]}= item[0]
If you're looking for a bit more complexity, you can have the entire markup generated with a couple of blocks:
:ruby menu = [ {href: '#', text: 'Samples'}, {href: '#', text: 'Samples', sub: [ {href: '#', text: 'Users'}, {href: '#', text: 'Staff'}, {href: '#', text: 'Managers'}, {href: '#', text: 'Delivery'} ]}, ]
%ul = list_of menu do |item| %a{href: item[:href]} = item[:text] - if item[:sub].present? %ul = list_of item[:sub] do |sub_item| %a{href: item[:href]}= item[:text]
If you're leaning towards the latter (and maybe you want to go more than 2 levels deep), I'd recommend making a helper. This way it can recurse through your menu array building the menu up as it goes.
Well sure, I'm a solo miner, and I could tip you if you'd like. You can write your stuff and then use text to HTML to wrap it in paragraph tags, unless you like using markup yourself. Or you can consider using a template engine like HAML or Jade.