HTML would have you repeat several elements across webpages if it were completely up to it itself.
This is probably one of the big reasons that any abstractions have been made, and web development is riddled with frameworks.
I will never learn JavaScript.
##include fileNameHere. At a later date this may be corrected to something else should it be necessary.##include include/footer.ihtml from the source file into the contents of include/footer.ihtml in the output...
< contents of include/footer.ihtml >:
<!DOCTYPE html>
<!--
footer.ihtml
bottom of the content on the website
-->
<footer>
<p>
Nate Wichers<br>
Electrical Engineer doing Embedded Software, GE Aerospace<br>
<p>Views expressed are my own--any employer that I may have at any given time should not be associated with my own thoughts and opinions as expressed here.</p>
<a href="https://github.com/BluRosie" style="color: rgb(184, 184, 184)"><b>GitHub</b></a>
<a href="https://twitter.com/bluroseai" style="color: rgb(184, 184, 184)"><b>Twitter (currently X)</b></a>
</p>
<p>
<a href="mailto:ncwicher@mtu.edu" style="color: rgb(184, 184, 184)"><b>ncwicher@mtu.edu</b></a>
</p>
</footer>awk '/##include include\/footer.ihtml/{while((getline<"'include/footer.ihtml'") > 0){print};next}{print}' index.html > output.htmlawk essentially has an outer loop that prints each line of index.html.cp -f index.ihtml output.html
for file in $(grep "##include" index.ihtml | sed -e "s+##include ++g"); do
awk '/##include '$file'/{while((getline<"'$file'") > 0){print};next}{print}' output.html > intermed.html;
mv -f intermed.html output.html
donegrep command just finds all of the ##include lines in the file and essentially generates a list of the files that are to be included.
Note that I had to include the \ in front of the /, but only for the first filename to escape the awk script.awk character '/'.cp -f index.ihtml output.html
for file in $(grep "##include" index.ihtml | sed -e "s+##include ++g"); do
awk '/##include '$(echo $file | sed -e 's|/|\\/|g')'/{while((getline<"'$file'") > 0){print};next}{print}' output.html > intermed.html;
mv -f intermed.html output.html
done$ passed to the shell actually needs to be $$$$ instead of the typical 2. I still can not find any documentation that states this, but found it out before digging in too deeply.
SOURCE_DOCS := $(wildcard *.ihtml)
BUILD := build
ARTEFACTS := $(patsubst %.ihtml,$(BUILD)/%.html, $(SOURCE_DOCS))
all: $(ARTEFACTS)
define INDIVIDUAL_OUTPUT_DEFINE
$(BUILD)/$2: $1 $(shell grep "##include" $1 | sed -e "s+##include ++g")
cp -f $1 $(BUILD)/$2
for file in $(shell grep "##include" $1 | sed -e "s+##include ++g"); do \
awk '/##include '$$$$(echo $$$$file | sed -e 's|/|\\/|g')'/{while((getline<"'$$$$file'") > 0){print};next}{print}' $(BUILD)/$2 > intermed.html; \
mv intermed.html $(BUILD)/$2; \
done
endef
$(foreach source, $(SOURCE_DOCS), $(eval $(call INDIVIDUAL_OUTPUT_DEFINE,$(source),$(subst ihtml,html,$(source)))))make and redeploy the website.grep/sed commands is accomplished with a zero-width space character splitting up the tags as necessary!print-% : ; $(info $($*)) @truemake print-ARTEFACTS and get the output:
build/other-things.html build/code_injection_nds.html build/index.html build/hg-engine.html build/this-website.html build/html-include-functionality.html