A fix for directories that contain both a manifest-based machine reference and Markdown-based machine definition (to avoid having redundant machines)
This commit is contained in:
parent
2aa7663d98
commit
82766dbfdf
11 changed files with 175 additions and 11 deletions
|
|
@ -1464,7 +1464,7 @@ HTMLOut.prototype.getMachineXML = function(sToken, sIndent, aParms, sXMLFile, sS
|
|||
s = m.convertMD(" ").trim();
|
||||
|
||||
obj.processMachines(m.getMachines(), m.getBuildOptions(), function doneProcessXMLMachines() {
|
||||
obj.getMarkdownFile(obj.sFile, sToken, sIndent, aParms, s, true);
|
||||
obj.getMarkdownFile(obj.sFile, sToken, sIndent, aParms, s, sXMLFile);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
@ -1689,7 +1689,7 @@ HTMLOut.prototype.getManifestXML = function(sToken, sIndent, aParms)
|
|||
};
|
||||
|
||||
/**
|
||||
* getMarkdownFile(sFile, sToken, sIndent, aParms, sPrevious, fMachineXML)
|
||||
* getMarkdownFile(sFile, sToken, sIndent, aParms, sPrevious, sMachineFile)
|
||||
*
|
||||
* If sFile exists in the current directory, open it, convert it, and prepare for replacement.
|
||||
*
|
||||
|
|
@ -1699,9 +1699,9 @@ HTMLOut.prototype.getManifestXML = function(sToken, sIndent, aParms)
|
|||
* @param {string} [sIndent]
|
||||
* @param {Array.<string>} [aParms]
|
||||
* @param {string|null} [sPrevious] is text, if any, that should precede the file
|
||||
* @param {boolean} [fMachineXML] true if a machine.xml file has already been processed by the caller
|
||||
* @param {string} [sMachineFile] name (if any) of machine.xml file already processed by the caller
|
||||
*/
|
||||
HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPrevious, fMachineXML)
|
||||
HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPrevious, sMachineFile)
|
||||
{
|
||||
var obj = this;
|
||||
|
||||
|
|
@ -1731,8 +1731,11 @@ HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPr
|
|||
}
|
||||
}
|
||||
} else {
|
||||
var m = new MarkOut(s, sIndent, obj.req, aParms, obj.fDebug, fMachineXML, obj.sExt == "md");
|
||||
var m = new MarkOut(s, sIndent, obj.req, aParms, obj.fDebug, sMachineFile, obj.sExt == "md");
|
||||
s = m.convertMD(" ").trim();
|
||||
|
||||
if (sMachineFile && m.hasMachines()) sPrevious = null;
|
||||
|
||||
/*
|
||||
* If the Markdown document begins with a heading, stuff that into the <title> tag;
|
||||
* it would be cleaner if this replacement could be performed by getTitle(), but unfortunately,
|
||||
|
|
|
|||
|
|
@ -95,10 +95,10 @@ var sDefaultFile = "./README.md";
|
|||
* @param {Object} [req] is the web server's (ie, Express) request object, if any
|
||||
* @param {Array.<string>|null} [aParms] is an array of overrides to use (see below)
|
||||
* @param {boolean} [fDebug] turns on debugging features (eg, debug comments, special URL encodings, etc)
|
||||
* @param {boolean} [fMachineXML] true if a machine.xml file has already been processed by the caller
|
||||
* @param {string} [sMachineFile] name of any machine.xml file already processed by the caller
|
||||
* @param {boolean} [fAutoHeading] true to automatically generate a page heading
|
||||
*/
|
||||
function MarkOut(sMD, sIndent, req, aParms, fDebug, fMachineXML, fAutoHeading)
|
||||
function MarkOut(sMD, sIndent, req, aParms, fDebug, sMachineFile, fAutoHeading)
|
||||
{
|
||||
this.sMD = sMD;
|
||||
this.sIndent = (sIndent || "");
|
||||
|
|
@ -111,7 +111,7 @@ function MarkOut(sMD, sIndent, req, aParms, fDebug, fMachineXML, fAutoHeading)
|
|||
this.sClassImageLabel = this.sClassImage + "-label";
|
||||
}
|
||||
this.fDebug = fDebug;
|
||||
this.fMachineXML = fMachineXML;
|
||||
this.sMachineFile = sMachineFile;
|
||||
this.fAutoHeading = fAutoHeading;
|
||||
this.sHTML = null;
|
||||
this.aIDs = []; // this keeps track of auto-generated ID attributes for page elements, to insure uniqueness
|
||||
|
|
@ -266,6 +266,17 @@ MarkOut.prototype.getMachines = function()
|
|||
return this.aMachines;
|
||||
};
|
||||
|
||||
/**
|
||||
* hasMachines()
|
||||
*
|
||||
* @this {MarkOut}
|
||||
* @return {boolean} true if machine(s) exist, false if not
|
||||
*/
|
||||
MarkOut.prototype.hasMachines = function()
|
||||
{
|
||||
return this.aMachines.length > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* getBuildOptions()
|
||||
*
|
||||
|
|
@ -1136,12 +1147,12 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
|||
while ((aMatch = reIncludes.exec(sBlock))) {
|
||||
sReplacement = "";
|
||||
sMachineID = aMatch[2];
|
||||
if (!this.fMachineXML && this.aMachineDefs[sMachineID]) {
|
||||
if (this.aMachineDefs[sMachineID]) {
|
||||
var machine = this.aMachineDefs[sMachineID];
|
||||
sMachine = machine['type'] || "pc";
|
||||
sMachineOptions = ((sMachine.indexOf("-dbg") > 0 || machine['debugger'] == "true")? "debugger" : "");
|
||||
sMachine = sMachine.replace("-dbg", "").toUpperCase();
|
||||
sMachineXMLFile = machine['config'] || "machine.xml";
|
||||
sMachineXMLFile = machine['config'] || this.sMachineFile || "machine.xml";
|
||||
sMachineXSLFile = machine['template'] || "";
|
||||
sMachineVersion = ((machine['uncompiled'] == "true")? "uncompiled" : "");
|
||||
sMachineParms = machine['parms'] || "";
|
||||
|
|
|
|||
Loading…
Reference in a new issue