Flow
Appendix B: Flow of commands resolution
This is how OSB works with sections:
When starting the build
read all the template files, determine a main list of sections in order of appearence;
When entering new folder
create target directory if it does not exist
duplicate all the sections from a main list, store each one under its name in temporary list;
scan all the sections in temporary list to find undefined sections and add them to the temporary list;
repeat previous step until no new sections are found;
all sections are recorded with the link to containing template;
When building particular content file
create a local list of sections corresponding to given template;
if .replace or .print commands provided in content files replace corresponding sections in local list in the order of appearance
put content file text in template;
for each section in local list put it in appropriate place in resulting template;
apply macros in order of appearance;
apply entities in order of appearance;
apply variables;
save the target file;
clear local list of sections;