When Webgenz CMS finds a Macro definition, it may alter the Macro's value before it replaces the Macro reference with the
Macro value. Why would Webgenz CMS do this? Webgenz CMS does this in order to preserve the formatting of the
HTML document that it generates. Here's an example:
Consider the following Template File:
<HTML>
<HEAD>
<TITLE>My Title</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>
[@MY_CONTENT]
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
And the following Content File:
[@MY_CONTENT]:
This is a block of content that
is a few lines long. This is
just an example.
[@]
If Webgenz CMS were to simply insert the Macro value in place of the Macro reference, the result would be the following:
<HTML>
<HEAD>
<TITLE>My Title</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>
This is a block of content that
is a few lines long. This is
just an example.
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Since the formatting of this output is undesirable, Webgenz CMS will alter the Macro value. Webgenz will add
whatever characters appear before and after the Macro reference in the Template file (usually just
white space) to each line of the Macro value. In the example above, the output will be as follows:
<HTML>
<HEAD>
<TITLE>My Title</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>
This is a block of content that
is a few lines long. This is
just an example.
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
As you can see, this formatting is much more desirable and reflects the formatting that the
author of the Template File intended. However, this feature can be the source of confusion.
To see what I mean, lets assume that the Template File in the example above is the following:
<HTML>
<HEAD>
<TITLE>My Title</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>[@MY_CONTENT]</TD>
</TR>
</TABLE>
</BODY>
</HTML>
In this case, Webgenz CMS will generate the following:
<HTML>
<HEAD>
<TITLE>My Title</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>This is a block of content that</TD>
<TD>is a few lines long. This is</TD>
<TD>just an example.</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Obviously, this is very undesirable. However, it is a side effect of the fact that Webgenz CMS
is designed to maintain the formatting and indentation that appears in the Template File so that the
generated file will have the same formatting that it would have if you were to write it by hand.
So, if you find yourself with Webgenz CMS output that you do not understand, just make sure that you
place Macro references on lines by themselves.