From f390bdb76b41b3eef0c33fee90b66df559c14bb9 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 19 Apr 2016 17:04:53 -0700 Subject: [PATCH] First step moving toward a shared component template and stylesheet across multiple machines --- .gitignore | 1 + Gruntfile.js | 2 +- modules/markout/lib/markout.js | 6 +++++- modules/pcjs/templates/README.md | 14 -------------- modules/shared/templates/README.md | 5 +++++ modules/{pcjs => shared}/templates/components.css | 0 modules/{pcjs => shared}/templates/components.xsl | 0 7 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 modules/pcjs/templates/README.md rename modules/{pcjs => shared}/templates/components.css (100%) rename modules/{pcjs => shared}/templates/components.xsl (100%) diff --git a/.gitignore b/.gitignore index dc0e6f10d..39790485a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ node_modules archive/ c64/ ecp/ +projects/ private/ src/ tmp/ diff --git a/Gruntfile.js b/Gruntfile.js index a8b4cf298..1eb6dfaa8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -365,7 +365,7 @@ module.exports = function(grunt) { "pcjs": { files: [ { - cwd: "modules/pcjs/templates/", + cwd: "modules/shared/templates/", src: ["components.*"], dest: "versions/pcjs/<%= pkg.version %>/", expand: true diff --git a/modules/markout/lib/markout.js b/modules/markout/lib/markout.js index af5842e3a..3b30bc680 100644 --- a/modules/markout/lib/markout.js +++ b/modules/markout/lib/markout.js @@ -1205,7 +1205,11 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock) */ if (!sMachineXSLFile || sMachineXSLFile.indexOf("components.xsl") >= 0) { if (this.fDebug) { - sMachineXSLFile = "/modules/" + sMachineClass + "js/templates/components.xsl"; + if (sMachineClass == "c1p") { + sMachineXSLFile = "/modules/c1pjs/templates/components.xsl"; + } else { + sMachineXSLFile = "/modules/shared/templates/components.xsl"; + } } } diff --git a/modules/pcjs/templates/README.md b/modules/pcjs/templates/README.md deleted file mode 100644 index 31443047a..000000000 --- a/modules/pcjs/templates/README.md +++ /dev/null @@ -1,14 +0,0 @@ -PCjs Templates -=== -Template folders contain a variety of XML and HTML templates and supporting files, including: - -- DTD files (Document Type Definitions) -- XSD files (XML schemas -- eventually) -- XSL files (XML stylesheets) -- CSS files (stylesheets that the XSL files rely upon) -- HTML files (HTML fragments used to generate part or all of a web page) - -[*components.xsl*](components.xsl) transforms all the elements of a machine XML file into an HTML fragment -that includes a series of **DIV** tags with corresponding *id* and *data-value* attributes that allow our -JavaScript components to bind themselves to visual elements (eg, virtual screen, virtual keyboard, control -panel) on a web page. diff --git a/modules/shared/templates/README.md b/modules/shared/templates/README.md index 85add3174..c40209254 100644 --- a/modules/shared/templates/README.md +++ b/modules/shared/templates/README.md @@ -15,6 +15,11 @@ or none of the above. [*common.xsl*](common.xsl) is a collection of XSL templates used by *machine.xsl* (and deprecated *outline.xsl*) files. +[*components.xsl*](components.xsl) transforms all the elements of a machine XML file into an HTML fragment +that includes a series of **DIV** tags with corresponding *id* and *data-value* attributes that allow our +JavaScript components to bind themselves to visual elements (eg, virtual screen, virtual keyboard, control +panel) on a web page. + [*machine.xsl*](machine.xsl) is an XML stylesheet that takes things a step further and transforms a machine XML into a stand-alone HTML document, which also includes all necessary compiled scripts (eg, c1p.js, c1p-dbg.js, pc.js or pc-dbg.js). Most machine XML files explicitly link to this stylesheet, so that simply loading the XML diff --git a/modules/pcjs/templates/components.css b/modules/shared/templates/components.css similarity index 100% rename from modules/pcjs/templates/components.css rename to modules/shared/templates/components.css diff --git a/modules/pcjs/templates/components.xsl b/modules/shared/templates/components.xsl similarity index 100% rename from modules/pcjs/templates/components.xsl rename to modules/shared/templates/components.xsl