I am trying to enhance my HTML template that is used with HelpNDoc. One thing I find lacking is the fact that the meta description
tag is the same for all pages.
The template file is a mixture of pascal and HTML. At the moment this is the data in the template for showing the description tag:
<meta name="description" content="<% print(HndProjects.GetProjectSummary()); %>" />
I have created a mapping XML document which contains the needed descriptions. Example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<HelpTopics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Topic>
<Caption>Overview</Caption>
<ID>msa-overview</ID>
<ContextID>0</ContextID>
<Description>An introduction to Meeting Schedule Assistant.</Description>
</Topic>
<Topic>
<Caption>Quick Start - Getting Started</Caption>
<ID>msa-quick-start</ID>
<ContextID>1</ContextID>
<Description>A quick start guide to get you up and running with Meeting Schedule Assistant.</Description>
</Topic>
<Topic>
<Caption>Using Meeting Schedule Assistant</Caption>
<ID>msa</ID>
<ContextID>2</ContextID>
<Description>An overview of the menus in Meeting Schedule Assistant.</Description>
</Topic>
</HelpTopics>
Is it possible, using pascal inside this HelpnDoc script to read the XML file? On their site they provide the details about the HndProjects
and it mentions:
function GetProjectId: string;
Returns the currently open project id.
So I would basically like to get this value from the XML data file:
HelpTopics/Topic/ID[text()='<% HndProjects.GetProjectId(); %>'
But I don't know how to use such an XPath with a HelpNDoc Pascal script.
Update
I tried adding this code to get be going:
function GetDescription(sTopicID: string): String;
var
nodeTopic: TDOMNode;
doc: TXMLDocument;
begin
try
// Read in the xml file
ReadXMLFile(doc, '.\MSA-Help-Descriptions.xml');
// Get the node
//nodeTopic := doc.DocumentElement.FindNode(
// How do we get the node at: HelpTopics/Topic/ID[text()=sTopicID];
finally
doc.Free;
end;
GetDescription := 'xxxx';
end;
Then, inside HelpNDoc I tried to compile the script but I got these errors:
So I am not sure if I can even do what I want, unless I have missed some steps.