- From: Shane McCarron via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 07 Apr 2010 03:50:10 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/ReSpec.js/js In directory hutz:/tmp/cvs-serv1344/js Modified Files: respec.js Log Message: Added experimental handling for diffmarking. Fixed case of heading titles to match recent publications. Index: respec.js =================================================================== RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -r1.102 -r1.103 --- respec.js 31 Mar 2010 17:48:18 -0000 1.102 +++ respec.js 7 Apr 2010 03:50:08 -0000 1.103 @@ -222,6 +222,11 @@ butH.onclick = function () { obj.hideSaveOptions(); obj.toHTML(); }; var butS = sn.element("button", {}, this.saveMenu, "Save as HTML (Source)"); butS.onclick = function () { obj.hideSaveOptions(); obj.toHTMLSource(); }; + if (this.diffTool && this.previousURI) { + var butD = sn.element("button", {}, this.saveMenu, "Diffmark"); + butD.onclick = function () { obj.hideSaveOptions(); obj.toDiffHTML(); }; + } + }, hideSaveOptions: function () { @@ -229,7 +234,7 @@ this.saveMenu.parentNode.removeChild(this.saveMenu); }, - toString: function () { +toString: function () { var str = "<!DOCTYPE html"; var dt = document.doctype; if (dt && dt.publicId) { @@ -250,6 +255,39 @@ return str; }, + toDiffHTMLSource: function () { + + }, + + toDiffHTML: function () { + // create a diff marked version against the previousURI + // strategy - open a window in which there is a form with the + // data needed for diff marking - submit the form so that the response populates + // page with the diff marked version + var base = window.location.href; + base = base.replace(/\/[^\/]*$/, "/"); + var str = "<!DOCTYPE html>\n"; + str += "<html"; + var ats = document.documentElement.attributes; + for (var i = 0; i < ats.length; i++) { + str += " " + ats[i].name + "=\"" + this._esc(ats[i].value) + "\""; + } + str += ">\n"; + str += "<head><title>diff form</title></head>\n"; + str += "<body><form name='form' method='POST' action='" + this.diffTool + "'>\n"; + str += "<input type='hidden' name='base' value='" + base + "'>\n"; + str += "<input type='hidden' name='oldfile' value='" + this.previousURI + "'>\n"; + str += '<input type="hidden" name="newcontent" value="' + this._esc(this.toString()) + '">\n'; + str += "<input type='submit'>\n"; + str += "</form></body></html>\n"; + + + var x = window.open() ; + x.document.write(str) ; + x.document.close() ; + x.document.form.submit() ; + }, + toHTML: function () { var x = window.open(); x.document.write(this.toString()); @@ -443,9 +481,10 @@ var latestVersion, prevVersion; if (this.previousPublishDate) { var pmat = (this.status2maturity[this.previousMaturity]) ? this.status2maturity[this.previousMaturity] : this.previousMaturity; - var prevURI = "http://www.w3.org/TR/" + this.previousPublishDate.getFullYear() + "/" + pmat + "-" + - this.shortName + "-" + this._concatDate(this.previousPublishDate) + "/"; - prevVersion = "<a href='" + prevURI + "'>" + prevURI + "</a>"; + if (!this.previousURI) { + this.previousURI = "http://www.w3.org/TR/" + this.previousPublishDate.getFullYear() + "/" + pmat + "-" + this.shortName + "-" + this._concatDate(this.previousPublishDate) + "/"; + } + prevVersion = "<a href='" + this.previousURI + "'>" + this.previousURI + "</a>"; // var latestURI = "http://www.w3.org/TR/" + this.shortName + "/"; // latestVersion = "<a href='" + latestURI + "'>" + latestURI + "</a>"; } @@ -469,9 +508,9 @@ "<h2>" + (this.specStatus == "unofficial" ? "" : "W3C ") + this.status2text[this.specStatus] + " " + this._humanDate(this.publishDate) + "</h2><dl>"; if (!this.isNoTrack) - header += "<dt>This Version:</dt><dd><a href='" + thisVersion + "'>" + thisVersion + "</a></dd>" + - "<dt>Latest Published Version:</dt><dd>" + latestVersion + "</dd>" + - "<dt>Latest Editor's Draft:</dt><dd><a href='" + this.edDraftURI + "'>" + this.edDraftURI + "</a></dd>"; + header += "<dt>This version:</dt><dd><a href='" + thisVersion + "'>" + thisVersion + "</a></dd>" + + "<dt>Latest published version:</dt><dd>" + latestVersion + "</dd>" + + "<dt>Latest editor's draft:</dt><dd><a href='" + this.edDraftURI + "'>" + this.edDraftURI + "</a></dd>"; if (this.specStatus != "FPWD" && !this.isNoTrack) header += "<dt>Previous version:</dt><dd>" + prevVersion + "</dd>"; @@ -1035,7 +1074,7 @@ warning("There was an error with the request to load " + URI + ", probably that you're working from disk."); } }, - + _humanMonths: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], _humanDate: function (date) {
Received on Wednesday, 7 April 2010 03:50:12 UTC