diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index 4eb94908b57..370e5e25d89 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 75745f32653..df3f4d90b0a 100644 --- a/doc/spec.md +++ b/doc/spec.md @@ -262,7 +262,7 @@ function f() { To benefit from this inference, a programmer can use the TypeScript language service. For example, a code editor can incorporate the TypeScript language service and use the service to find the members of a string object as in the following screen shot. -  +  In this example, the programmer benefits from type inference without providing type annotations. Some beneficial tools, however, do require the programmer to provide type annotations. In TypeScript, we can express a parameter requirement as in the following code fragment. @@ -410,7 +410,7 @@ This signature denotes that a function may be passed as the parameter of the '$' A typical client would not need to add any additional typing but could just use a community-supplied typing to discover (through statement completion with documentation tips) and verify (through static checking) correct use of the library, as in the following screen shot. -  +  Section [3.3](#3.3) provides additional information about object types. @@ -627,7 +627,7 @@ An important goal of TypeScript is to provide accurate and straightforward types JavaScript programming interfaces often include functions whose behavior is discriminated by a string constant passed to the function. The Document Object Model makes heavy use of this pattern. For example, the following screen shot shows that the 'createElement' method of the 'document' object has multiple signatures, some of which identify the types returned when specific strings are passed into the method. -  +  The following code fragment uses this feature. Because the 'span' variable is inferred to have the type 'HTMLSpanElement', the code can reference without static error the 'isMultiline' property of 'span'. @@ -638,7 +638,7 @@ span.isMultiLine = false; // OK: HTMLSpanElement has isMultiline property In the following screen shot, a programming tool combines information from overloading on string parameters with contextual typing to infer that the type of the variable 'e' is 'MouseEvent' and that therefore 'e' has a 'clientX' property. -  +  Section [3.9.2.4](#3.9.2.4) provides details on how to use string literals in function signatures. diff --git a/scripts/word2md.js b/scripts/word2md.js index 33dec3259fb..4804a9f0563 100644 --- a/scripts/word2md.js +++ b/scripts/word2md.js @@ -118,21 +118,24 @@ function convertDocumentToMarkdown(doc) { } } function writeParagraph(p) { - var text = p.range.text; + var range = p.range; + var text = range.text; var style = p.style.nameLocal; - var inTable = p.range.tables.count > 0; - var containsImage = p.range.inlineShapes.count > 0; + var inTable = range.tables.count > 0; var level = 1; var sectionBreak = text.indexOf("\x0C") >= 0; text = trimEndFormattingMarks(text); + if (text === "/") { + range.textRetrievalMode.includeHiddenText = true; + var fullText = range.text; + range.textRetrievalMode.includeHiddenText = false; + if (text !== fullText) { + text = " " + fullText.substr(1); + } + } if (inTable) { style = "Table"; } - else if (containsImage) { - imageCount++; - write(" \n\n"); - text = ""; - } else if (style.match(/\s\d$/)) { level = +style.substr(style.length - 1); style = style.substr(0, style.length - 2); @@ -143,7 +146,7 @@ function convertDocumentToMarkdown(doc) { switch (style) { case "Heading": case "Appendix": - var section = p.range.listFormat.listString; + var section = range.listFormat.listString; write("####".substr(0, level) + ' ' + section + " " + text + "\n\n"); break; case "Normal": @@ -152,7 +155,7 @@ function convertDocumentToMarkdown(doc) { } break; case "List Paragraph": - write(" ".substr(0, p.range.listFormat.listLevelNumber * 2 - 2) + "* " + text + "\n"); + write(" ".substr(0, range.listFormat.listLevelNumber * 2 - 2) + "* " + text + "\n"); break; case "Grammar": write(" " + text.replace(/\s\s\s/g, " ").replace(/\x0B/g, " \n ") + "\n\n"); @@ -168,7 +171,7 @@ function convertDocumentToMarkdown(doc) { break; case "Table": if (!lastInTable) { - tableColumnCount = p.range.tables.item(1).columns.count + 1; + tableColumnCount = range.tables.item(1).columns.count + 1; tableCellIndex = 0; } if (tableCellIndex < tableColumnCount) { diff --git a/scripts/word2md.ts b/scripts/word2md.ts index f8aecb8f611..266046cee37 100644 --- a/scripts/word2md.ts +++ b/scripts/word2md.ts @@ -67,18 +67,14 @@ module Word { export interface Tables extends Collection