And more PCjs/PCx86 disambiguation
This commit is contained in:
parent
a1e999e0c4
commit
2629e48bdf
57 changed files with 200 additions and 134 deletions
|
|
@ -232,7 +232,7 @@ MarkOut.setOptions = function(options)
|
|||
* The infoMachine object should contain, at a minimum:
|
||||
*
|
||||
* {
|
||||
* 'class': sMachineClass, // eg, "pcx86"
|
||||
* 'type': sMachineType, // eg, "PCx86"
|
||||
* 'func': sMachineFunc,
|
||||
* 'id': sMachineID,
|
||||
* 'xml': sMachineXMLFile,
|
||||
|
|
@ -951,7 +951,7 @@ MarkOut.prototype.convertMDLinks = function(sBlock)
|
|||
}
|
||||
sURL = sURL.replace(/\*/g, pkg.version);
|
||||
/*
|
||||
* My own goofy way of defining a named anchor (by using an exclamation point) in Markdown....
|
||||
* Check for my own syntax for defining a named anchor (by using an exclamation point) in Markdown....
|
||||
*/
|
||||
if (sURL.charAt(0) == '!') {
|
||||
sTag = "span"; // using <a> to name an anchor is deprecated
|
||||
|
|
@ -1097,9 +1097,9 @@ MarkOut.prototype.convertMDImageLinks = function(sBlock, sIndent)
|
|||
*
|
||||
* where a special title attribute triggers generation of an embedded machine rather than a link.
|
||||
*
|
||||
* Use "PCx86" or "C1Pjs" to automatically include the latest version of either "pcx86.js" or "c1p.js", followed
|
||||
* Use "PCx86" or "C1P" to automatically include the latest version of either "pcx86.js" or "c1p.js", followed
|
||||
* by a colon and the ID you want to use for the embedded <div>. If you need to use the script with the built-in
|
||||
* Debugger (ie, either "pc-dbg.js" or "c1p-dbg.js"), then include "debugger" in the list of comma-delimited
|
||||
* Debugger (ie, either "pcx86-dbg.js" or "c1p-dbg.js"), then include "debugger" in the list of comma-delimited
|
||||
* options, as in:
|
||||
*
|
||||
* [IBM PC](/devices/pcx86/machine/5150/mda/64kb/ "PCx86:demoPC:::debugger")
|
||||
|
|
@ -1135,7 +1135,7 @@ MarkOut.prototype.convertMDImageLinks = function(sBlock, sIndent)
|
|||
MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
||||
{
|
||||
var aMatch, sReplacement;
|
||||
var sMachine, sMachineID, sMachineXMLFile, sMachineXSLFile, sMachineVersion, sMachineOptions, sMachineParms;
|
||||
var sMachineType, sMachineID, sMachineXMLFile, sMachineXSLFile, sMachineVersion, sMachineOptions, sMachineParms;
|
||||
|
||||
/*
|
||||
* Before we start looking for Markdown-style machine links, see if there are any Liquid-style machines,
|
||||
|
|
@ -1149,16 +1149,15 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
|||
sMachineID = aMatch[2];
|
||||
if (this.aMachineDefs[sMachineID]) {
|
||||
var machine = this.aMachineDefs[sMachineID];
|
||||
sMachine = machine['type'] || "pcx86";
|
||||
sMachineOptions = ((sMachine.indexOf("-dbg") > 0 || machine['debugger'] == "true")? "debugger" : "");
|
||||
sMachine = sMachine.replace("-dbg", "").toUpperCase();
|
||||
sMachineType = machine['type'] || "PCx86";
|
||||
sMachineOptions = ((sMachineType.indexOf("-dbg") > 0 || machine['debugger'] == "true")? "debugger" : "");
|
||||
sMachineType = sMachineType.replace("-dbg", "");
|
||||
sMachineXMLFile = machine['config'] || this.sMachineFile || "machine.xml";
|
||||
sMachineXSLFile = machine['template'] || "";
|
||||
sMachineVersion = ((machine['uncompiled'] == "true")? "uncompiled" : "");
|
||||
sMachineParms = machine['parms'] || "";
|
||||
sReplacement = machine['name'] || "Embedded PC";
|
||||
if (sMachine == "pc" || sMachine == "c1p") sMachine += "js";
|
||||
sReplacement = "[" + sReplacement + "](" + sMachineXMLFile + ' "' + sMachine + '!' + sMachineID + '!' + sMachineXSLFile + '!!' + sMachineOptions + '!' + sMachineParms + '")';
|
||||
sReplacement = "[" + sReplacement + "](" + sMachineXMLFile + ' "' + sMachineType + '!' + sMachineID + '!' + sMachineXSLFile + '!!' + sMachineOptions + '!' + sMachineParms + '")';
|
||||
}
|
||||
sBlock = sBlock.replace(aMatch[0], sReplacement);
|
||||
reIncludes.lastIndex = 0; // reset lastIndex, since we just modified the string that reIncludes is iterating over
|
||||
|
|
@ -1170,20 +1169,17 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
|||
* Start looking for Markdown-style machine links now...
|
||||
*/
|
||||
var cMatches = 0;
|
||||
var reMachines = /\[(.*?)]\((.*?)\s*"(PC|C1P)([a-z0-9-]*)([:!|])(.*?)"\)/gi;
|
||||
var reMachines = /\[(.*?)]\((.*?)\s*"(PC|C1P)([^:!|]*)([:!|])(.*?)"\)/gi;
|
||||
|
||||
while ((aMatch = reMachines.exec(sBlock))) {
|
||||
|
||||
sMachineXMLFile = aMatch[2];
|
||||
if (sMachineXMLFile.slice(-1) == "/") sMachineXMLFile += "machine.xml";
|
||||
|
||||
sMachine = aMatch[3].toUpperCase();
|
||||
if (aMatch[4] != "js") sMachine += aMatch[4];
|
||||
var sMachineFunc = "embed" + sMachine;
|
||||
var sMachineClass = sMachine.toLowerCase();
|
||||
sMachineType = aMatch[3].toUpperCase() + (aMatch[4] != "js"? aMatch[4] : "");
|
||||
var sMachineFunc = "embed" + sMachineType;
|
||||
var aMachineParms = aMatch[6].split(aMatch[5]);
|
||||
if (aMatch[4] == "js") sMachine += aMatch[4];
|
||||
var sMachineMessage = "Waiting for " + sMachine + " to load";
|
||||
var sMachineMessage = "Waiting for " + sMachineType + " to load";
|
||||
|
||||
sMachineID = aMachineParms[0];
|
||||
sMachineXSLFile = aMachineParms[1] || "";
|
||||
|
|
@ -1199,7 +1195,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
|||
sReplacement = '<div id="' + sMachineID + '" class="machine-placeholder"><p>' + aMatch[1] + '</p><p class="machine-warning">' + sMachineMessage + '</p></div>\n';
|
||||
|
||||
/*
|
||||
* The embedPC()/embedC1P functions take an XSL file as the 3rd parameter, which defaults to:
|
||||
* The embedXXX() functions take an XSL file as the 3rd parameter, which defaults to:
|
||||
*
|
||||
* "/versions/" + APPCLASS + "/" + APPVERSION + "/components.xsl"
|
||||
*
|
||||
|
|
@ -1208,7 +1204,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
|||
*/
|
||||
if (!sMachineXSLFile || sMachineXSLFile.indexOf("components.xsl") >= 0) {
|
||||
if (this.fDebug) {
|
||||
if (sMachineClass == "c1p") {
|
||||
if (sMachineType == "C1P") {
|
||||
sMachineXSLFile = "/modules/c1pjs/templates/components.xsl";
|
||||
} else {
|
||||
sMachineXSLFile = "/modules/shared/templates/components.xsl";
|
||||
|
|
@ -1228,7 +1224,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
|
|||
cMatches++;
|
||||
|
||||
this.addMachine({
|
||||
'class': sMachineClass, // eg, a machine class, such as "pc" or "c1p"
|
||||
'type': sMachineType, // eg, a machine type, such as "PCx86" or "C1P"
|
||||
'func': sMachineFunc,
|
||||
'id': sMachineID,
|
||||
'xml': sMachineXMLFile,
|
||||
|
|
|
|||
Loading…
Reference in a new issue