<#-- Renders a "book" XML to multiple HTML files. This is a rather complex stuff... check the product.html first. --> <#escape x as x?html> <@pp.dropOutputFile /> <#-- Calculating the prefix of output file names --> <#assign prefix = pp.sourceFileName> <#assign prefix = prefix?substring(0, prefix?last_index_of('.'))> <#assign prefix = prefix + '_'> <#-- Calculate the ordered list of HTML pages, used for the nav. bar. --> <#assign pages = pp.doc["//*[@ppFile != '']"]> <#-- Render the HTML pages --> <#recurse pp.doc> <#-- *********************************************************************************** Node handlers *********************************************************************************** --> <#macro book> <@pp.nestOutputFile name="${prefix}index.html"> <@Html title="${.node.@title}">

Table of Contents

<#recurse> <#macro part> <@pp.nestOutputFile name=prefix+.node.@ppFile> <@Html title="${.node.@title}"> <#local cs = .node.chapter> <#if cs?has_content>

Part Contents

<#recurse> <#macro chapter> <@pp.nestOutputFile name=prefix+.node.@ppFile> <@Html title="${.node.@title}"> <#recurse> <#macro p>

<#recurse>

<#macro quote>
<#recurse>
<#macro e> <#recurse><#t> <#macro mark> <#recurse><#t> <#macro @text> ${.node}<#t> <#-- *********************************************************************************** Other macros *********************************************************************************** --> <#macro Html title> ${title} <@NavBar />

${title}

<#nested>
<@NavBar /> <#macro NavBar> <#local nodeName = .node?node_name> <#if nodeName == 'book'> Prev | Up | Next | ToC | Home <#else> <#local ppFile = .node.@ppFile> <#local max = pages?size - 1> <#list 0..max as i> <#if pages[i].@ppFile == ppFile> <#local idx = i> <#break> <#if idx != 0> Prev<#t> <#else> Prev<#t> | <#list .node?ancestors as a> <#if a.@ppFile[0]??> Up<#t> <#break> <#elseif a?node_name == 'book'> Up<#t> <#break> | <#if idx != max> Next <#else> Next<#t> | ToC | Home