Allow both Liquid-style and Markdown-style image links in the same document

This commit is contained in:
Jeff Parsons 2015-12-31 15:12:55 -08:00
commit 224a19be4f
2 changed files with 18 additions and 7 deletions

View file

@ -13,9 +13,9 @@ machines:
Welcome to [PCjs](/docs/about/pcjs/), the first IBM PC simulation to run in your web browser without any plugins. Welcome to [PCjs](/docs/about/pcjs/), the first IBM PC simulation to run in your web browser without any plugins.
It was added to the [JavaScript Machines](/docs/about/) project in Fall 2012, and it is now part of the It was added to the [JavaScript Machines](/docs/about/) project in Fall 2012, and it is now part of the
[PCjs Project](https://github.com/jeffpar/pcjs) on GitHub. The project includes: [PCjs Project](https://github.com/jeffpar/pcjs) on [GitHub](http://github.com/). The project includes:
* [PCjs](/docs/about/pcjs/), a simulation of the original IBM PC (circa 1981) * [PCjs](/docs/pcjs/), a simulation of the original IBM PC (circa 1981)
* [C1Pjs](/docs/c1pjs/), a simulation of the OSI Challenger 1P (circa 1978) * [C1Pjs](/docs/c1pjs/), a simulation of the OSI Challenger 1P (circa 1978)
All the simulations are written entirely in JavaScript. No Flash, Java or other plugins are required. All the simulations are written entirely in JavaScript. No Flash, Java or other plugins are required.
@ -38,6 +38,16 @@ Demos
--- ---
Some pre-configured machines are shown below, ready to run BASIC, DOS, Windows 1.01, and assorted non-DOS software. Some pre-configured machines are shown below, ready to run BASIC, DOS, Windows 1.01, and assorted non-DOS software.
{% comment %}
![IBM PC running DONKEY.BAS](/devices/pc/machine/5150/cga/64kb/donkey/thumbnail.jpg "link:/devices/pc/machine/5150/cga/64kb/donkey/:200:100")
![IBM PC XT w/CGA, 10Mb Hard Drive](/devices/pc/machine/5160/cga/256kb/demo/thumbnail.jpg "link:/devices/pc/machine/5160/cga/256kb/demo/:200:100")
![IBM PC XT w/CGA, Windows 1.01](/devices/pc/machine/5160/cga/256kb/win101/thumbnail.jpg "link:/devices/pc/machine/5160/cga/256kb/win101/:200:100")
![IBM PC XT w/EGA, Windows 1.01](/devices/pc/machine/5160/ega/640kb/win101/thumbnail.jpg "link:/devices/pc/machine/5160/ega/640kb/win101/:200:100")
![IBM PC AT w/EGA, OS/2 1.0](/disks/pc/os2/ibm/1.0/thumbnail.jpg "link:/disks/pc/os2/ibm/1.0/:200:100")
![IBM PC w/MDA, CP/M-86](/disks/pc/cpm/1.1b/thumbnail.jpg "link:/disks/pc/cpm/1.1b/:200:100")
![IBM PC w/MDA, Microsoft Adventure](/disks/pc/games/microsoft/adventure/thumbnail.jpg "link:/disks/pc/games/microsoft/adventure/:200:100")
![IBM PC w/CGA, Zork I](/disks/pc/games/infocom/zork1/thumbnail.jpg "link:/disks/pc/games/infocom/zork1/:200:100")
{% endcomment %}
{% include screenshot.html src="/devices/pc/machine/5150/cga/64kb/donkey/thumbnail.jpg" width="200" height="120" title="IBM PC running DONKEY.BAS" link="/devices/pc/machine/5150/cga/64kb/donkey/" %} {% include screenshot.html src="/devices/pc/machine/5150/cga/64kb/donkey/thumbnail.jpg" width="200" height="120" title="IBM PC running DONKEY.BAS" link="/devices/pc/machine/5150/cga/64kb/donkey/" %}
{% include screenshot.html src="/devices/pc/machine/5160/cga/256kb/demo/thumbnail.jpg" width="200" height="120" title="IBM PC XT w/CGA, 10Mb Hard Drive" link="/devices/pc/machine/5160/cga/256kb/demo/" %} {% include screenshot.html src="/devices/pc/machine/5160/cga/256kb/demo/thumbnail.jpg" width="200" height="120" title="IBM PC XT w/CGA, 10Mb Hard Drive" link="/devices/pc/machine/5160/cga/256kb/demo/" %}
{% include screenshot.html src="/devices/pc/machine/5160/cga/256kb/win101/thumbnail.jpg" width="200" height="120" title="IBM PC XT w/CGA, Windows 1.01" link="/devices/pc/machine/5160/cga/256kb/win101/" %} {% include screenshot.html src="/devices/pc/machine/5160/cga/256kb/win101/thumbnail.jpg" width="200" height="120" title="IBM PC XT w/CGA, Windows 1.01" link="/devices/pc/machine/5160/cga/256kb/win101/" %}

View file

@ -128,7 +128,7 @@ function MarkOut(sMD, sIndent, req, aParms, fDebug, fMachineXML)
/** /**
* CLI() * CLI()
* *
* Provides a command-line interface for the markout module * Provides a command-line interface for the MarkOut module
* *
* Usage: * Usage:
* *
@ -323,7 +323,7 @@ MarkOut.prototype.convertMD = function(sIndent)
/* /*
* Before performing the original comment-elimination step, a new step has been added that * Before performing the original comment-elimination step, a new step has been added that
* allows blocks of Markdown to be excluded from the Markout process (eg, build instructions * allows blocks of Markdown to be excluded from the MarkOut process (eg, build instructions
* that you'd like to see on GitHub but that don't need to be displayed on the public website). * that you'd like to see on GitHub but that don't need to be displayed on the public website).
* *
* Basically, you wrap those kinds of blocks with a pair of special comments, like so: * Basically, you wrap those kinds of blocks with a pair of special comments, like so:
@ -334,8 +334,8 @@ MarkOut.prototype.convertMD = function(sIndent)
* triple-dash-style comments. * triple-dash-style comments.
*/ */
if (!this.fDebug) { if (!this.fDebug) {
sMD = sMD.replace(/\{%\s*if\s+page\.developer\s*%}[\s\S]*?{%\s*endif\s*%}\s*/, ""); sMD = sMD.replace(/\{%\s*if\s+page\.developer\s*%}[\s\S]*?{%\s*endif\s*%}\s*/g, "");
sMD = sMD.replace(/[ \t]*<!--+\s*begin:exclude\s*-+->[\s\S]*?<!--+\s*end:exclude\s*-+->[\r\n]*/i, ""); sMD = sMD.replace(/[ \t]*<!--+\s*begin:exclude\s*-+->[\s\S]*?<!--+\s*end:exclude\s*-+->[\r\n]*/gi, "");
} }
/* /*
@ -350,6 +350,7 @@ MarkOut.prototype.convertMD = function(sIndent)
* the lack of JavaScript support for the "s" (aka "dotall" or "multiline") option that enables * the lack of JavaScript support for the "s" (aka "dotall" or "multiline") option that enables
* "." to match newlines. * "." to match newlines.
*/ */
sMD = sMD.replace(/\{%\s*comment\s*%}[\s\S]*?{%\s*endcomment\s*%}\s*/g, "");
sMD = sMD.replace(/<!--[\s\S]*?-->/g, ""); sMD = sMD.replace(/<!--[\s\S]*?-->/g, "");
/* /*
@ -789,7 +790,7 @@ MarkOut.prototype.convertMDLinks = function(sBlock)
* TODO: These replacements should use appropriate values from _config.yml; however, unless/until * TODO: These replacements should use appropriate values from _config.yml; however, unless/until
* we start using Node again to host the public site, that's low priority. * we start using Node again to host the public site, that's low priority.
*/ */
sBlock = sBlock.replace(/\{([\{%]).*?\1}/, ""); sBlock = sBlock.replace(/\{([\{%]).*?\1}/g, "");
var aMatch; var aMatch;
var re = /\[([^\[\]]*)]\((.*?)(?:\s*"(.*?)"\)|\))/g; var re = /\[([^\[\]]*)]\((.*?)(?:\s*"(.*?)"\)|\))/g;