Update README.md

This commit is contained in:
Cutieguwu
2025-07-21 13:26:31 -04:00
parent a7fe30ae4c
commit 5e8e1ea1f9

View File

@@ -43,3 +43,56 @@ With the actual composing file, say `index.html` looking like this:
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.
Setting or getting values from `<const>` and `<insert>` depends on whether the element self-closes or not.
For example, this will set a value to the const id of 'my_const':
<!DOCTYPE html>
<const id="my_const">Value</const>
This will pull the value:
<!DOCTYPE html>
<const id="my_const" />
A full example:
src/title.html
<!DOCTYPE html>
<title>
<insert id="my_title" />
</title>
src/index.html
<!DOCTYPE html>
<!-- title_const = "My Homepage" -->
<const id="title_const">My Homepage</const>
<html>
<head>
<include src="title.html">
<!-- my_title = title_const -->
<insert id="my_title">
<const id="title_const" />
</insert>
</include>
</head>
</html>
target/index.html
<!DOCTYPE html>
<html>
<head>
<title>My Homepage</title>
</head>
</html>