I want to merge one HTML file into another. Not just turn it on, but combine it.
Example
master.html:
<!DOCTYPE html> <html> <head> <title>My cat</title> </head> <body> <h1>My cat is awesome!</h1> </body> </html>
_index.html:
<!DOCTYPE html> <html> <body> <p><img src="cat.jpg"/></p> </body> </html>
Now I am combining _index.html into master.html.
$ html_merge master.html _index.html > result.html
result.html
<!DOCTYPE html> <html> <head> <title>My cat</title> </head> <body> <h1>My cat is awesome!</h1> <p><img src="cat.jpg"/></p> </body> </html>
html_merge is a script what I am looking for. I will use it to create static websites.
I would like to use Ruby, but this is not required.
Update
I do not want to invent another template language. There are many template languages ββwith include / yield and partial file support. Liquid , mustache and so on, I use them for different tasks. Now I need to combine the HTML files, nothing more.
source share