#
#  This file makes an excellent starter for your own site description!
#
#  Replace the contents of the file "Starter.text" with what you want
#  to have appear on your page, then run WebLord with the following
#  command:
#				weblord  starter.wl
#
#  And examine the files
#				Starter1a.html
#			and	Starter1b.html
#			and	Starter2.html
#
#  The first two are different versions of the same file, presented
#  differently to demonstrate the application of different patterns.
#  The 3rd file (Starter2.html) is a different page in the same style
#  as Starter1a.html
#
#  The formatting in all cases is supplied by THIS file (Starter.wl)
#  and can be applied just as easily to any number of pages by merely
#  creating a "PAGE=pagename{...}" definition for them.
#
#  To understand what's going on here, you should definitely read the
#  documentation that came with WebLord. It was produced with WebLord
#  itself (using much the same techniques as what this file uses). If
#  you don't read the documentation, then you're either incredibly
#  brilliant or you love doing things the hard way. It's your choice!
#
#   ._.  Udo Schuermann
#   ( )  walrus@wam.umd.edu
#



#include "global.wl"
#include "tools.wl"



###########################################################################
# This is our (first) SITE object. All pages inherit things from this
# object if they don't define the reference locally. If a reference is not
# found here, either, but an object with that name exists, then that
# object is instantiated and its value resolved to supply a value to the
# property reference. If you don't understand this, then read the docs!
#
site = main
{
	# A list of the PAGE objects that make up our site:
	#
	pages =		starter-page-#1a
			starter-page-#1b
			starter-page-#2
			demo-view-page;

	# A pattern inherited by each page (unless defined by a page) that
	# provides the name of the file to which the page is written
	#
	output =	page-out ".html";

	# Patterns referenced by the 'value' property of each page;
	# Version A of the pattern thus consists of the 'header' and the
	# 'footer', both of which enclose the 'page-text';
	# Version B of the pattern encloses the page-text in a simple
	# table construct;
	# the 'page-text' is supplied by each page uniquely, the 'header'
	# and 'footer' are defined in the "global.wl" file.
	# And the strange indentation is done only to improve readability;
	# WebLord could care less :-)
	#
	page-pattern-A =	header
					page-text
				footer;
	page-pattern-B =	header
					table-start
						page-text
					table-end
				footer;
	page-pattern-C =	header
					table-2-start
						page-text
					table-2-end
				footer;

	# A property used by the "global.wl" file that helps us build
	# really easy HTML headers, complete with optional colors, meta
	# tags, etc. This one here provides a default background color
	# that makes pages white (unless a page defines its own bgcolor)
	#
	bgcolor =	"#ffffff";
}



###########################################################################
# Here we begin our PAGE definitions. Each page references some global
# properties that are common to all files (such as
page = starter-page-#1a
{
	value =		page-pattern-A;	# 'page-pattern' is defined in
					# the SITE object (see above),
					# which defines our pages.

	# The following properties provide values unique to this page.
	#
	page-out =	"Starter1a";
	page-in =	"Starter";

	# The following properties are used by the 'header' as referenced
	# through the 'page-pattern'... Any items omitted here are simply
	# not used by the 'header'
	#
	title =		"Another version of the starter demo dage";
	description =	"Version two of the demo";
}



page = starter-page-#1b
{
	value =		page-pattern-B;	# same as previous page, but a
					# different pattern :-)
	page-out =	"Starter1b";
	page-in =	"Starter";
	title =		"A third version of the starter demo dage";
	description =	"More demo stuff";
	bgcolor =	"#ffff00";	# let's override the default!
	author =	"Put your name here!";
	post-exec =	'echo "*NYou could use this to upload the page!*N"';
}


page = starter-page-#2
{
	value =		page-pattern-C;
	page-out =	"Starter2";
	page-in =	"Starter";
	bgcolor =	"#000000";
	textcolor =	"#ffffff";
	# we leave the title blank; compare the HTML of the pages
	# i.e. look for the <HEAD>...</HEAD> portion near the top!
}



page = demo-view-page
{
	value =	header
		"<h3>Three versions of the <a href=Starter.text>same file</a></h3>\n"
        	"<a href=Starter1a.html>The plain version with white background</a><br>\n"
        	"<a href=Starter1b.html>The table version on yellow background</a><br>\n"
        	"<a href=Starter2.html>Another (borderless) table version in white-on-black</a><br>\n"
		"\n"
		"<h3>And what is this supposed to demonstrate?</h3>\n"
   		"<p>Yes, this is a terribly poor demo, but it demonstrates how <em>one input file</em>\n"
		"can be embedded in different \"formats\"; imagine that you have a site of dozens of\n"
		"pages using one of these formats (or one of your own devising), and later on you\n"
		"decide you want to apply a different format to all your pages. It would be as easy\n"
		"as changing the page value to a different pattern and re-processing the file!</p>\n"
		"\n"
		"<p><a href=Docs/WebLord.html>Read the documentation</a>. Study the\n"
		"'<a href=Starter.wl>Starter.wl</a>' file. Once you become more familiar with WebLord,\n"
		"you should also study the two include files (<a href=global.wl>global.wl</a> and\n"
		"<a href=tools.wl>tools.wl</a>) that ship with WebLord. These implement some fairly\n"
		"advanced stuff that you can use without much understanding. But understanding them\n"
		"will help you later dig ever deeper into WebLord's power!</p>\n"
        	footer;
	output =	"Demo.html";	# overrides global default
}



# A totally cool, multi-purpose object that uses an (inherited) 'page-name'
# property to return the contents of a file by that name and with the
# extension ".text"; is this EASY or what?
#     -----------------------------------------------------------------
# >>> An exercise for you: where is 'page-in' referenced and how is the
# >>> file name resolved (possibly differently) for each page?
#     -----------------------------------------------------------------
text = page-text
{
	value =		page-in ".text";
	value-in-file =	"1";		# any non-null means "yes" here
}



text = starter-page
{
	value =		"Starter.text";	# just fixed name, no magic here
	value-in-file =	"1";		# the 'value' is a file name
}


text = table-start
{
	# notice that even though it appears that we're formatting the
	# HTML with nice indents, we're actually not supplying any \n
	# symbols so the output will be just one hugely long line :-)
	#
	value =		"<table border=3 width=75% align=center>\n"
			"<tr>\n"
				"\t<td>\n"
					"\t\tHow<br>Do<br>You<br>Like<br>\n"
					"\t\tThis<br>Table?\n"
				"\t</td>\n"
				"\t<td>\n"      # start another column...
}



text = table-end
{
	value =			"\t</td>\n"	# end the column
			"</tr>\n"		# end the row
			"<tr>\n"		# start a new row
				"\t<td align=center colspan=2>\n"
					"\t\tAnd wasn't this easy?\n"
				"\t</td>"
			"</tr>\n"
			"</table>\n";
}


text = table-2-start
{
	value =		"<table border=0 width=75% align=center>"
			"<tr>\n"
			"\t<td>\n"
			"\t\t<font size=7 color=red><b>Yet Another Format Applied!</b></font>\n"
			"\t</td>\n"
			"</tr>\n"
			"<tr>\n"
			"\t<td>\n"
}

text = table-2-end
{
	value =		"\t</td>\n"
			"</tr>\n"
			"</table>\n";
}
