Blueprints
Blueprint pages are automatically created by the gen_indexes.py
script.
To add a new blueprint, create a file containing the blueprint string in the blueprints/
directory.
How blueprint pages work
- The mkdocs-gen-files script creates a page stub in
docs/blueprints/{basename}.md
and also copies the blueprint string to the static assets as a text filedoc/assets/{basename}.txt
- The stub document has an empty code fence for the blueprint string and an embedded
<script>
that callsprocessBlueprint(basename)
which is a function defined indocs/assets/blueprint.js
. - The script also populates code fence with the blueprint string which is fetched from
doc/assets/{basename}.txt
using an XMLHttpRequest after the page is loaded. - The
processBlueprint()
function deserializes the blueprint string and renders the html representation of the blueprint data. - Blueprint previews are left as image stubs with a
window.setTimeout()
function that staggers requests to the blueprint preview server to fetch image data, defined indoc/assets/factorio.js
as the constantFBSR_SERVER
.