EHTML is an HTML validator and minimalistic preprocessor. It validates the basic structure (meaning doctype, html, head, title and body tags in correct order) of an HTML file passed as an argument. It also validates some basic SEO best practices. It has a simple template engine that can handle variables.
To declare a variable, use the following syntax:
<let name(:type)?=val>
Al varaiables work in a global inmutable way and they should be declare at the top of the file before the DOCTYPE tag (so they are hoisted by sintax). You can optionaly type check you variables by adding ":" and the type in front of the name. The suppoerted types are:
- int
- float
- bool
- char
- str
At the end of all the variable declarations and before the DOCTYPE tag there should be a <endvars/>
, for example:
<let name:str = "Pedro">
... other variable declarations ...
<endvars/>
<!DOCTYPE html>
...
To insert a variable in the document, use a pp tag like this:
<pp name>
cargo run <html_file>
- Validate html structure (doctype, html, head, title, body)
- SEO tips (lenght of title and description, images format, alt and lazy load)
- html simple variables (all vars global, declared before de doctype tag, and hoisted (hoisting))
- templates (some sort of macros/functions?, params would be declared, used and processed totaly diferent and separate from vars)
- css optimization
- check for bad practices like the use of eval or innetHTML
- compile jquery to js
- html simple conditional
- html loop