This is example 4 as described in the Wsmake User Manual.

Have you read example 3 yet? We assume that you have, so if you haven't read
it yet, please do so now.

We cover PageParts and PageOrders in this example. We are going to use the
same configuration from example 3. 

This example can be found in the doc/examples/ex4/ directory of the source
distribution.

PageParts and PageOrders work together for creating the order of a page.
A PagePart works the same as a Page except that it doesn't have an output
location. Now where would we want to use a pageorder in our example? Well,
it seems there is some common HTML for every page in the header and footer.
Specifically, the header that is the same for each page is:

  <html>
  <head>
  <title><sitename></title>
  <!-- Last make: <makedate> -->
  </head>
  <body>
  <b><sitename></b>
  <hr>

And the footer that is the same is:

  </body>
  </html>

So our task would be to take out these common areas of the pages, and put
them in header and footer files. This has already been done for you. The
new header and footer HTML files are in a directory named "templates". The
original ("source") pages in the "html" directory have the common information
stripped from them.

Now, how do we tell wsmake to string all of these things together? Well, first
we need to tell about the new header and footer files. These files are the
PageParts. According to the manual, a typical definition for our header
file could be:

  PagePart {
    name "header"
    filename "header.html"
    directory "templates"
  }

The footer, in the same respect, would look like:

  PagePart {
    name "footer"
    filename "footer.html"
    directory "templates"
  }

Note, the names I chose are arbitrary, you can choose your own. But remember
to use the names you define here later. These definitions would appear in the
PageGroup section of the configuration file *before* any Pages that would use
the PageParts. Go ahead and add them before our three pages now.

Well, now wsmake knows about the files, but it doesn't know how to order them
or apply them to our pages. So first let's order them. We use a PageOrder
to do this. According to the manual, our pageorder should look something like:

  PageOrder {
    name "default"
    part "header"
    data
    part "footer"
  }

This says that whatever uses the pageorder (i.e. whatever "data" uses it) will
be pre-pended with the PagePart named "header" and the appended with the
PagePart named "footer". According to the manual, the PageOrder must be defined
after all of the PageParts that it uses. So put this PagePart after the
PageParts we defined earlier, but still before the Pages that will use it.

Now we need to tell our Pages to use this PageOrder. For each Page we need
to add this attribute:

  pageorder "default"

Add that to our 3 pages. Now we are ready to try out wsmake. Run it with
debug level 1. This time you should notice slightly different output than
the first example:

New Part   : header.html                   
New Part   : footer.html                   
New Webpage: index.html                    [...]
New Webpage: about.html                    [...]
New Webpage: help.html                     [...]

Notice how the header and footer are detected in the same way our pages
are detected? Go check the pages in the output directory to see that it
did what we expected it too. Ok, running wsmake again (with debug level 2)
should output:

Loading configuration:
1 PageGroup, 3 Pages.
Synchronizing database with filesystem:
--- Part   : header.html                   
--- Part   : footer.html                   
Making website:
--- Webpage: index.html                    
--- Webpage: about.html                    
--- Webpage: help.html                     

This indicates there are no changes. Now let's try updating the header. Edit
the "templates/header.html" file and make some changes. Now we want to re-run
wsmake and have it propagate the changes you've made to all pages that use
the header. In this case that is all three of our pages. Re-run wsmake and
you should see output like:

Loading configuration:
1 PageGroup, 3 Pages.
Synchronizing database with filesystem:
Upd Part   : header.html                   
--- Part   : footer.html                   
Making website:
PoU Webpage: index.html                    [...]
PoU Webpage: about.html                    [...]
PoU Webpage: help.html                     [...]

This tells us that "header.html" was updated and, consequently, our 3 pages
are updated as well. And you can see that it parses all three.

Changing the footer would yield the same results except that header.html would
show the "---" and footer.html would show "Upd".

Ok, this is the end of example 4.
