Merge branch 'next-release'

This commit is contained in:
Jeff Parsons 2017-01-25 11:45:34 -08:00
commit fb6743900e
10 changed files with 88 additions and 45 deletions

View file

@ -14,10 +14,10 @@ machines:
sticky: top
commands:
bootXXDP: |
select rl11 listDrives RL0
select rl11 listDisks "XXDP+ Diagnostics"
load rl11
boot rl11
select rl11 listDrives RL0;
select rl11 listDisks "XXDP+ Diagnostics";
click rl11 loadDisk;
click rl11 bootDisk
---
This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT RL0") and run

View file

@ -14,11 +14,11 @@
<xsl:variable name="CSSCLASS">pcjs</xsl:variable>
<xsl:variable name="APPCLASS">pcx86</xsl:variable>
<xsl:variable name="APPNAME">PCx86</xsl:variable>
<xsl:variable name="APPVERSION">1.32.1</xsl:variable>
<xsl:variable name="APPVERSION">1.32.2</xsl:variable>
<xsl:variable name="SITEHOST">www.pcjs.org</xsl:variable>
<xsl:template name="componentStyles">
<link rel="stylesheet" type="text/css" href="/versions/pcx86/1.32.1/components.css"/>
<link rel="stylesheet" type="text/css" href="/versions/pcx86/1.32.2/components.css"/>
</xsl:template>
<xsl:template name="componentScripts">

View file

@ -1923,7 +1923,6 @@ HTMLOut.prototype.processMachines = function(aMachines, buildOptions, done)
var sScriptFolder = sScriptName == "c1p"? "c1pjs" : (sScriptName.substr(0, 3) == "pdp"? "pdpjs" : sScriptName);
asFiles.push("/versions/" + sScriptFolder + "/" + sVersion + "/components.css");
asFiles.push("/versions/" + sScriptFolder + "/" + sVersion + "/" + sScriptFile);
this.addFilesToHTML(asFiles, sScriptEmbed);
}
else if (asFiles = aMachineFiles[sType]) {
/*
@ -1968,13 +1967,21 @@ HTMLOut.prototype.processMachines = function(aMachines, buildOptions, done)
}
}
}
}
else {
HTMLOut.logDebug('HTMLOut.processMachines(): unrecognized machine type "' + sType + '"');
continue;
}
this.addFilesToHTML(asFiles, sScriptEmbed);
if (infoMachine['sticky']) {
asFiles = [];
asFiles.push("/modules/shared/lib/sticky.js");
sScriptEmbed = '<script type="text/javascript">addStickyMachine("' + infoMachine['id'] + '")</script>';
this.addFilesToHTML(asFiles, sScriptEmbed);
}
if (buildOptions.id) {
asFiles = [];
asFiles.push("/modules/build/lib/build.js");
@ -1982,10 +1989,6 @@ HTMLOut.prototype.processMachines = function(aMachines, buildOptions, done)
this.addFilesToHTML(asFiles, sScriptEmbed);
}
}
else {
HTMLOut.logDebug('HTMLOut.processMachines(): unrecognized machine type "' + sType + '"');
}
}
if (done) done();
};

View file

@ -114,6 +114,7 @@ function MarkOut(sMD, sIndent, req, aParms, fDebug, sMachineFile, fAutoHeading)
this.aMachines = []; // this keeps track of embedded machines on the page
this.buildOptions = {}; // this keeps track of any build options specified on the page
this.aMachineDefs = {}; // this keeps track of any machine definitions at the top of the file (as part of any Jekyll "Front Matter")
this.aCommandDefs = {}; // this keeps track of any command definitions at the top of the file (as part of any Jekyll "Front Matter")
}
/*
@ -426,10 +427,12 @@ MarkOut.prototype.convertMD = function(sIndent)
if (sMD.substr(0, 3) == "---") {
aMatch = sMD.match(/^---([\s\S]*?)---[ \t]*\n*/);
if (aMatch) {
/*
* Remove the Front Matter.
*/
sMD = sMD.replace(aMatch[0], "");
/*
* Extract machine definitions, if any, from the Front Matter.
*/
@ -519,14 +522,31 @@ MarkOut.prototype.convertMD = function(sIndent)
if (id) this.aMachineDefs[id] = machine;
}
}
var aCommandDefs = aMatch[1].match(/\ncommands:([\s\S]*?)\n([^\s]|$)/);
if (aCommandDefs) {
var reCommand = /[ \t]+([^:]+):\s*\|/g;
var aCommands = aCommandDefs[1].split(reCommand);
/*
* If a "title" element existed in the Front Matter, this code auto-generates a top-level
* heading with the same value.
* Since the preceding RegExp contains a capture group (representing the name of the command),
* it will be "spliced" into the split results. So, aCommands[0] will be whatever characters precede
* the first command (which we can ignore), followed by the first command name, followed by one or more
* command lines, followed by the second command name, followed by one or more command lines, and so on.
*/
for (var iCommand = 1; iCommand < aCommands.length; iCommand += 2) {
this.aCommandDefs[aCommands[iCommand]] = aCommands[iCommand+1].trim().replace(/\n[ \t]*/g, "").replace(/"/g, "&quot;");
}
}
/*
* If a "title" element existed in the Front Matter, this code auto-generates a top-level heading
* with the same value.
*/
if (this.fAutoHeading) {
aSubMatch = aMatch[1].match(/title:\s*(.*?)\s*?\n/);
if (aSubMatch) sMD = aSubMatch[1] + "\n---\n\n" + sMD;
}
/*
* If a "build" ID element existed in the Front Matter, capture it.
*/
@ -576,7 +596,7 @@ MarkOut.prototype.convertMD = function(sIndent)
* you want the second paragraph to appear as a code block, it must be indented TWICE (by 8 spaces
* or 2 tabs). That behavior should fall out of this hack as well.
*/
var re = /(^|\n)( ? ?)([\*+-]|[0-9]+\.)([^\n]*\n)([ \t]+[^\n]*\n|\n)+([ \t]+[^\n]+)/g;
var re = /(^|\n)( ? ?)([*+-]|[0-9]+\.)([^\n]*\n)([ \t]+[^\n]*\n|\n)+([ \t]+[^\n]+)/g;
//noinspection UnnecessaryLocalVariableJS
var sMDOrig = sMD;
while ((aMatch = re.exec(sMDOrig))) {
@ -845,7 +865,7 @@ MarkOut.prototype.convertMDList = function(sBlock, sIndent)
var aMatch;
var aMatches = [];
var re = /(^|\n) ? ? ?([\*+-]|[0-9]+\.)[ \t]+/g;
var re = /(^|\n) ? ? ?([*+-]|[0-9]+\.)[ \t]+/g;
while ((aMatch = re.exec(sBlock))) {
aMatches.push(aMatch);
}
@ -946,8 +966,8 @@ MarkOut.prototype.convertMDLinks = function(sBlock)
* page's Front Matter; however, unless/until we start using Node again to host the public site,
* that's low priority.
*/
sBlock = sBlock.replace(/([^\t])\{([\{%]).*?\2}/g, "$1");
sBlock = sBlock.replace(/(\{)([\{%])(.*?\2})/g, "<pre><code>$1$2$3</code></pre>");
sBlock = sBlock.replace(/([^\t])\{([{%]).*?\2}/g, "$1");
sBlock = sBlock.replace(/(\{)([{%])(.*?\2})/g, "<pre><code>$1$2$3</code></pre>");
var aMatch;
var re = /\[([^\[\]]*)]\((.*?)(?:\s*"(.*?)"\)|\))/g;
@ -1283,11 +1303,17 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
var sControl = findParm(aParms, 'type') || 'button';
var sControlType = sControl == 'button'? ' type="button"' : '';
if (this.aMachineDefs[sMachineID]) {
var sCommand = findParm(aParms, 'command');
var sValue = findParm(aParms, 'value');
if (this.aCommandDefs[sCommand]) {
sValue = this.aCommandDefs[sCommand];
sCommand = "script";
}
sReplacement = '<' + sControl + sControlType + ' onclick="commandMachine(';
sReplacement += "'" + sMachineID + "',";
sReplacement += "'" + findParm(aParms, 'component') + "',";
sReplacement += "'" + findParm(aParms, 'command') + "',";
sReplacement += "'" + findParm(aParms, 'value') + "')";
sReplacement += "'" + sCommand + "',";
sReplacement += "'" + sValue + "')";
sReplacement += '">' + (findParm(aParms, 'label') || 'Try It!') + '</' + sControl + '>';
} else {
sReplacement = "<!-- Unrecognized machine ID: " + sMachineID + " -->";
@ -1350,8 +1376,8 @@ MarkOut.prototype.convertMDEmphasis = function(sBlock)
* *[modules](/modules/)*
*/
if (sBlock.indexOf('*') >= 0 || sBlock.indexOf('_') >= 0) {
sBlock = sBlock.replace(/(^|[^a-z0-9-])([\*_])\2([\s\S]*?)\2\2([^a-z0-9-]|$)/gi, "$1<strong>$3</strong>$4");
sBlock = sBlock.replace(/(^|[^a-z0-9-])([\*_])([\s\S]*?)\2([^a-z0-9-]|$)/gi, "$1<em>$3</em>$4");
sBlock = sBlock.replace(/(^|[^a-z0-9-])([*_])\2([\s\S]*?)\2\2([^a-z0-9-]|$)/gi, "$1<strong>$3</strong>$4");
sBlock = sBlock.replace(/(^|[^a-z0-9-])([*_])([\s\S]*?)\2([^a-z0-9-]|$)/gi, "$1<em>$3</em>$4");
}
return sBlock;
};

View file

@ -105,7 +105,18 @@ class Component {
this.name = parms['name'];
this.comment = parms['comment'];
this.parms = parms;
this['exports'] = {};
/*
* The following Component properties need to be accessible by other machines and/or command scripts;
* well, OK, or we could have exported some new functions to walk the contents of these properties, as we
* did with findMachineComponent(), but this works just as well.
*
* Also, while the double-assignment looks silly (ie, using both dot and bracket property notation), it
* resolves a complaint from the Closure Compiler, because if we use ONLY bracket notation here, then the
* Compiler wants us to change all the other references to bracket notation as well.
*/
this.exports = this['exports'] = {};
this.bindings = this['bindings'] = {};
var i = this.id.indexOf('.');
if (i < 0) {
@ -129,7 +140,6 @@ class Component {
this.fnReady = null;
this.clearError();
this.bindings = {};
this.bitsMessage = bitsMessage || 0;
/** @type {Object|null} controlPrint is the HTML control, if any, that we can print to */

View file

@ -112,6 +112,9 @@ function commandMachine(idMachine, sComponent, sCommand, sValue)
if (window.findMachineComponent) {
var component = window.findMachineComponent(idMachine, sComponent);
if (component) {
if (sCommand == "script") {
window.alert("commandScript('" + sValue + "')");
} else {
var exports = component['exports'];
if (exports) {
var fnCommand = exports[sCommand];
@ -125,6 +128,7 @@ function commandMachine(idMachine, sComponent, sCommand, sValue)
}
}
}
}
console.log("unimplemented: commandMachine('" + idMachine + "','" + sComponent + "','" + sCommand + "','" + sValue + "')");
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long