Filenames

Appendix A: Resolving target filenames

The rule for resolving target filenames is the following:

if source filename has one extension
{
if extension is set to be copied ('.src' by default)
{ /* CONDITION 1 */
source file is a content file and
is inserted into a standard template,
target file will have a '.html' extension instead of '.src'
}
elseif extension is set to be copied
{ /* CONDITION 2 */
source file must be copied as is,
target filename will not change
}
}
elseif source filename has more than one extension
{
if last extension is set to be copied ('.src' by default)
{
source file is a content file,
last extension is removed,
checking new last extension
if new last extension is reserved for a template
{
source file is inserted in the above template,
new last extension is removed
if filename contains no more extensions
{ /* CONDITION 3 */
target file will have a default build extension ('.html')
}
else
{ /* CONDITION 4 */
target file will have a resulting filename
}
}
else
{ /* CONDITION 5 */
source file is inserted in the standard template,
target filename will have a resulting filename
}
}
elseif last extension is set to be copied
{ /* CONDITION 6 */
source file must be copied as is,
target filename will not change
}
}

Example: we have one standard template and one template for a .home extension. Files to be copied include .html and .php extensions. So we shall have the following situation:

Source file Target file Template Condition Action
=========== =========== ======== ========= =======
file.php file.php 2 copied
file.html file.html 2 copied
file.src file.html standard 1 built
file.new.php file.new.php 6 copied
file.php.src file.php standard 5 built
file.home.src file.html home 3 built
file.php.home.src file.php home 4 built
file.cfg none