Final implementation of <include> tag.
This commit is contained in:
42
README.md
42
README.md
@@ -2,6 +2,44 @@
|
||||
|
||||
Reuse chunks of HTML in other HTML files via preprocessing.
|
||||
|
||||
Reused the chunk in `global_nav.html` via `<include src="global_nav.html" />`.
|
||||
Reuse the chunk in `global_nav.html` via `<include src="global_nav.html" />`.
|
||||
|
||||
Balloon will inflate the chunk in place of the `<include>` tag in the source file, dumping a released target file which can be pushed to the web server.
|
||||
Balloon will inflate the chunk in place of the `<include>` tag in the source file, dumping a released target file which can be pushed to the web server.
|
||||
|
||||
--
|
||||
|
||||
I do plan to migrate this project to rust once I'm finished tinkering around with the concept. I am considering adding the ability to add includes which wrap other includes.
|
||||
|
||||
This could be useful for templates, so that the base html template could look like this:
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{Inserted Var}</title>
|
||||
<meta />
|
||||
<link />
|
||||
</head>
|
||||
<body>
|
||||
{Inserted Nav Chunk}
|
||||
{Inserted Page Chunk}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
With the actual composing file, say `index.html` looking like this:
|
||||
|
||||
<!-- Without the DOCTYPE line -->
|
||||
<!DOCTYPE html>
|
||||
|
||||
<include src="templates/template.html">
|
||||
<insert id="title">Home | MySite.tld</insert>
|
||||
<insert id="chunk_nav">
|
||||
<include src="nav.html"></include>
|
||||
<h1>Welcome</h1>
|
||||
<p>lorem ipsum...</p>
|
||||
</insert>
|
||||
</include>
|
||||
|
||||
Perhaps I could do this with a custom `<insert>` tag with maybe an `id` parameter. How you would declare a variable, I'm not sure. At the very least, I'll likely have to make a proper parser to make this happen. The script is kinda hacky as it is.
|
||||
|
||||
The idea being that `<include>` in effect pulls in stuff from another file, and `<insert>` places in within something. Perhaps think of it as sewing; you stitch both sides together by pushing the pin through, and pulling it back.
|
||||
|
||||
Reference in New Issue
Block a user