Generalize the choice of machine property separator

This commit is contained in:
Jeff Parsons 2016-02-01 10:33:06 -08:00
commit 2422ff1dc0

View file

@ -1040,8 +1040,8 @@ MarkOut.prototype.convertMDImageLinks = function(sBlock, sIndent)
* *
* If the link ends with a slash, then it's an implied reference to a "machine.xml". * If the link ends with a slash, then it's an implied reference to a "machine.xml".
* *
* UPDATE: Since parms containing JSON may also contain colons, machine Markdown links may now use '!' instead * UPDATE: Since parms containing JSON may also contain colons, machine Markdown links may now use '!' or '|'
* of ':' as separators; eg: * instead of ':' as separators. In fact, whichever separator is used first will be used throughout; eg:
* *
* [IBM PC](/devices/pc/machine/5150/mda/64kb/ "PCjs!demoPC!stylesheet!version!options!parms") * [IBM PC](/devices/pc/machine/5150/mda/64kb/ "PCjs!demoPC!stylesheet!version!options!parms")
* *
@ -1099,7 +1099,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
* Start looking for Markdown-style machine links now... * Start looking for Markdown-style machine links now...
*/ */
var cMatches = 0; var cMatches = 0;
var reMachines = /\[(.*?)]\((.*?)\s*"(PC|C1P)js[:!](.*?)"\)/gi; var reMachines = /\[(.*?)]\((.*?)\s*"(PC|C1P)js([:!|])(.*?)"\)/gi;
while ((aMatch = reMachines.exec(sBlock))) { while ((aMatch = reMachines.exec(sBlock))) {
@ -1109,7 +1109,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
sMachine = aMatch[3].toUpperCase(); sMachine = aMatch[3].toUpperCase();
var sMachineFunc = "embed" + sMachine; var sMachineFunc = "embed" + sMachine;
var sMachineClass = sMachine.toLowerCase(); var sMachineClass = sMachine.toLowerCase();
var aMachineParms = aMatch[4].split(aMatch[4].indexOf('|') > 0? '!' : ':'); var aMachineParms = aMatch[5].split(aMatch[4]);
var sMachineMessage = "Waiting for " + sMachine + "js to load"; var sMachineMessage = "Waiting for " + sMachine + "js to load";
sMachineID = aMachineParms[0]; sMachineID = aMachineParms[0];