diff --git a/Jakefile b/Jakefile index 04049837f6e..db8d670b0bf 100644 --- a/Jakefile +++ b/Jakefile @@ -2,6 +2,7 @@ var fs = require("fs"); var path = require("path"); +var child_process = require("child_process"); // Variables var compilerDirectory = "src/compiler/"; @@ -9,6 +10,7 @@ var servicesDirectory = "src/services/"; var harnessDirectory = "src/harness/"; var libraryDirectory = "src/lib/"; var scriptsDirectory = "scripts/"; +var docDirectory = "doc/"; var builtDirectory = "built/"; var builtLocalDirectory = "built/local/"; @@ -260,6 +262,38 @@ task("clean", function() { jake.rmRf(builtDirectory); }); +// Generate Markdown spec +var word2mdJs = path.join(scriptsDirectory, "word2md.js"); +var word2mdTs = path.join(scriptsDirectory, "word2md.ts"); +var specWord = path.join(docDirectory, "TypeScript Language Specification.docx"); +var specMd = path.join(docDirectory, "spec.md"); +var headerMd = path.join(docDirectory, "header.md"); + +file(word2mdTs); + +// word2md script +compileFile(word2mdJs, + [word2mdTs], + [word2mdTs], + [], + false); + +// The generated spec.md; built for the 'generate-spec' task +file(specMd, [word2mdJs, specWord], function () { + jake.cpR(headerMd, specMd, {silent: true}); + var specWordFullPath = path.resolve(specWord); + var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" >>' + specMd; + console.log(cmd); + child_process.exec(cmd, function () { + complete(); + }); +}, {async: true}) + + +desc("Generates a Markdown version of the Language Specification"); +task("generate-spec", [specMd]) + + // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", libraryTargets, function() { diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index 403daa64ad1..d3a189853c5 100644 Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ diff --git a/doc/spec.md b/doc/spec.md index 50f4c07fb00..fa233248afa 100644 --- a/doc/spec.md +++ b/doc/spec.md @@ -1354,7 +1354,7 @@ Object type literals are the primary form of type literals and are described in As the table above illustrates, an array type literal is shorthand for a reference to the generic interface type ‘Array’ in the global module, a function type literal is shorthand for an object type containing a single call signature, and a constructor type literal is shorthand for an object type containing a single construct signature. Note that function and constructor types with multiple call or construct signatures cannot be written as function or constructor type literals but must instead be written as object type literals. -In order to avoid grammar ambiguities, array type literals permit only a restricted set of notations for the element type. Specifically, an A*rrayType* cannot start with a *FunctionType* or *ConstructorType*. To use one of those forms for the element type, an array type must be written using the ‘Array’ notation. For example, the type +In order to avoid grammar ambiguities, array type literals permit only a restricted set of notations for the element type. Specifically, an *ArrayType* cannot start with a *FunctionType* or *ConstructorType*. To use one of those forms for the element type, an array type must be written using the ‘Array’ notation. For example, the type ```TypeScript () => string[] diff --git a/scripts/word2md.js b/scripts/word2md.js index b09b14c2373..cfbdfcb47de 100644 --- a/scripts/word2md.js +++ b/scripts/word2md.js @@ -1,11 +1,3 @@ -// word2md - Word to Markdown conversion tool -// -// word2md converts a Microsoft Word document to Markdown formatted text. The tool uses the -// Word Automation APIs to start an instance of Word and access the contents of the document -// being converted. The tool must be run using the cscript.exe script host and requires Word -// to be installed on the target machine. The name of the document to convert must be specified -// as a command line argument and the resulting Markdown is written to standard output. The -// tool recognizes the specific Word styles used in the TypeScript Language Specification. var sys = (function () { var args = []; for (var i = 0; i < WScript.Arguments.length; i++) { @@ -163,9 +155,9 @@ function convertDocumentToMarkdown(doc) { writeBlockEnd(); } findReplace("", { font: { subscript: true } }, "^&", { font: { subscript: false } }); - findReplace("", { style: "Code Fragment" }, "`^&`", { style: -66 /* default font */ }); - findReplace("", { style: "Production" }, "*^&*", { style: -66 /* default font */ }); - findReplace("", { style: "Terminal" }, "`^&`", { style: -66 /* default font */ }); + findReplace("", { style: "Code Fragment" }, "`^&`", { style: -66 }); + findReplace("", { style: "Production" }, "*^&*", { style: -66 }); + findReplace("", { style: "Terminal" }, "`^&`", { style: -66 }); findReplace("", { font: { bold: true, italic: true } }, "***^&***", { font: { bold: false, italic: false } }); findReplace("", { font: { italic: true } }, "*^&*", { font: { italic: false } }); doc.fields.toggleShowCodes(); diff --git a/scripts/word2md.ts b/scripts/word2md.ts index 75a6e4eb35b..41fb2ad13f9 100644 --- a/scripts/word2md.ts +++ b/scripts/word2md.ts @@ -97,7 +97,7 @@ module Word { } export interface Fields extends Collection { - toggleShowCodes(); + toggleShowCodes(): void; } export interface Document { @@ -138,7 +138,7 @@ function convertDocumentToMarkdown(doc: Word.Document): string { var tableCellIndex: number; var columnAlignment: number[] = []; - function setProperties(target: {}, properties: {}) { + function setProperties(target: any, properties: any) { for (var name in properties) { if (properties.hasOwnProperty(name)) { var value = properties[name];