Skip to content

Update Language Specification #4033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified doc/TypeScript Language Specification (Change Markup).docx
Binary file not shown.
Binary file modified doc/TypeScript Language Specification (Change Markup).pdf
Binary file not shown.
Binary file modified doc/TypeScript Language Specification.docx
Binary file not shown.
Binary file modified doc/TypeScript Language Specification.pdf
Binary file not shown.
2,736 changes: 1,596 additions & 1,140 deletions doc/spec.md

Large diffs are not rendered by default.

35 changes: 29 additions & 6 deletions scripts/word2md.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions scripts/word2md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,19 @@ module Word {
toggleShowCodes(): void;
}

export interface Hyperlink {
address: string;
textToDisplay: string;
range: Range;
}

export interface Hyperlinks extends Collection<Hyperlink> {
}

export interface Document {
fields: Fields;
paragraphs: Paragraphs;
hyperlinks: Hyperlinks;
builtInDocumentProperties: Collection<any>;
close(saveChanges: boolean): void;
range(): Range;
Expand Down Expand Up @@ -195,6 +205,18 @@ function convertDocumentToMarkdown(doc: Word.Document): string {
find.execute(findText, false, false, false, false, false, true, 0, true, replaceText, 2);
}

function fixHyperlinks() {
var count = doc.hyperlinks.count;
for (var i = 0; i < count; i++) {
var hyperlink = doc.hyperlinks.item(i + 1);
var address = hyperlink.address;
if (address && address.length > 0) {
var textToDisplay = hyperlink.textToDisplay;
hyperlink.textToDisplay = "[" + textToDisplay + "](" + address + ")";
}
}
}

function write(s: string) {
result += s;
}
Expand Down Expand Up @@ -347,6 +369,8 @@ function convertDocumentToMarkdown(doc: Word.Document): string {
findReplace("^19 REF", {}, "[^&](#^&)", {});
doc.fields.toggleShowCodes();

fixHyperlinks();

writeDocument();

result = result.replace(/\x85/g, "\u2026");
Expand Down