include.awk revision 285830
150477Speter# Assume `source' is set with -vsource=filename on the command line.
281077Speter# 
341199Skato/^\[\[\[/	{ inclusion = $2; # name of the thing to include.
416359Sasami                  printing = 0;
516359Sasami                  while ((getline line < source) > 0)
699862Speter                    {
734458Skato                      if (match (line, "\\[\\[\\[end " inclusion "\\]\\]\\]"))
899862Speter                        printing = 0;
955966Skato
1044082Skato                      if (printing)
1129006Skato                        print line;
1229006Skato
1329006Skato                      if (match (line,"\\[\\[\\[begin " inclusion "\\]\\]\\]"))
1416359Sasami                        printing = 1;
1532939Skato                    }
1616359Sasami                  close (source);
1716359Sasami		  next;
1832092Skato                }
1958287Speter		{ print }
2061628Skato