diff --git a/public/doc-shredder/_test/doc-shredder.spec.js b/public/doc-shredder/_test/doc-shredder.spec.js index 31e369ae39..dade66aa3d 100644 --- a/public/doc-shredder/_test/doc-shredder.spec.js +++ b/public/doc-shredder/_test/doc-shredder.spec.js @@ -30,8 +30,8 @@ describe('doc-shredder', function() { fileNames.forEach(function(fileName) { console.log('comparing: ' + fileName); var origFileName = fileName.replace('.ovr.', '.'); - var origSource = fs.readFileSync(origFileName, 'utf8'); - var expectedSource = fs.readFileSync(fileName, 'utf8'); + var origSource = fs.readFileSync(origFileName, 'utf8').replace(/\r\n/g, '\n'); + var expectedSource = fs.readFileSync(fileName, 'utf8').replace(/\r\n/g, '\n'); var diffs = JsDiff.diffLines(expectedSource, origSource); errs = []; diffs.forEach(function(diff) { diff --git a/public/doc-shredder/_test/test_fragments/multiregion/mainBlankDocPlaster-import.ts.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/mainBlankDocPlaster-import.ts.ovr.md new file mode 100644 index 0000000000..c3ed2b425e --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/mainBlankDocPlaster-import.ts.ovr.md @@ -0,0 +1,3 @@ +``` +import {Component, View, bootstrap} from 'angular2/angular2'; +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/mainBlankDocPlaster-twoparts.ts.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/mainBlankDocPlaster-twoparts.ts.ovr.md new file mode 100644 index 0000000000..c30c8a1ea5 --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/mainBlankDocPlaster-twoparts.ts.ovr.md @@ -0,0 +1,6 @@ +``` +import {Component, View, bootstrap} from 'angular2/angular2'; + // indented comment + var x = 3; +// final comment +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/pubspec-bar.yaml.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/pubspec-bar.yaml.ovr.md new file mode 100644 index 0000000000..e7d2c3f77f --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/pubspec-bar.yaml.ovr.md @@ -0,0 +1,11 @@ +``` +name: angular2-getting-started +version: 0.0.1 +dependencies: + angular2: ^2.0.0-alpha.41 + browser: ^0.10.0 +transformers: +- angular2: + entry_points: web/main.dart + +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/pubspec-foo.yaml.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/pubspec-foo.yaml.ovr.md new file mode 100644 index 0000000000..1d439e9d74 --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/pubspec-foo.yaml.ovr.md @@ -0,0 +1,6 @@ +``` +name: angular2-getting-started +# special plaster + angular2: ^2.0.0-alpha.41 + browser: ^0.10.0 +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/simple-bar.html.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/simple-bar.html.ovr.md new file mode 100644 index 0000000000..06010ed890 --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/simple-bar.html.ovr.md @@ -0,0 +1,12 @@ +``` + + + + + + + + + + +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/simple-foo.html.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/simple-foo.html.ovr.md new file mode 100644 index 0000000000..3f25e6cb51 --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/simple-foo.html.ovr.md @@ -0,0 +1,7 @@ +``` + + + + + +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/style-bar.css.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/style-bar.css.ovr.md new file mode 100644 index 0000000000..dbcb0b0e9b --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/style-bar.css.ovr.md @@ -0,0 +1,6 @@ +``` +h2 { color: #444; font-weight: lighter; } +body { margin: 2em; } +/* plaster here */ +body, input[text], button { color: #888; font-family: Cambria, Georgia; } +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_fragments/multiregion/style-foo.css.ovr.md b/public/doc-shredder/_test/test_fragments/multiregion/style-foo.css.ovr.md new file mode 100644 index 0000000000..918f1598a4 --- /dev/null +++ b/public/doc-shredder/_test/test_fragments/multiregion/style-foo.css.ovr.md @@ -0,0 +1,6 @@ +``` +h2 { color: #444; font-weight: lighter; } +/* plaster here */ +body, input[text], button { color: #888; font-family: Cambria, Georgia; } +button {padding: 0.2em; font-size: 14px} +``` \ No newline at end of file diff --git a/public/doc-shredder/_test/test_source/multiregion/mainBlankDocPlaster.ts b/public/doc-shredder/_test/test_source/multiregion/mainBlankDocPlaster.ts new file mode 100644 index 0000000000..6d51f851ab --- /dev/null +++ b/public/doc-shredder/_test/test_source/multiregion/mainBlankDocPlaster.ts @@ -0,0 +1,26 @@ +// no docplaster +// #docplaster +// #docregion import,twoparts +import {Component, View, bootstrap} from 'angular2/angular2'; +// #enddocregion twoparts, import + +@Component({ + selector: 'my-app' +}) +@View({ + template: '

My first Angular 2 App

' +}) +class AppComponent { +} + +// #docregion twoparts + // indented comment + var x = 3; +// #enddocregion + +bootstrap(AppComponent); +// #docregion twoparts +// final comment +// #enddocregion twoparts + + diff --git a/public/doc-shredder/_test/test_source/multiregion/pubspec.yaml b/public/doc-shredder/_test/test_source/multiregion/pubspec.yaml new file mode 100644 index 0000000000..25843ab265 --- /dev/null +++ b/public/doc-shredder/_test/test_source/multiregion/pubspec.yaml @@ -0,0 +1,13 @@ +# #docplaster special plaster +# #docregion foo, bar +name: angular2-getting-started +# #enddocregion foo +version: 0.0.1 +dependencies: +# #docregion foo + angular2: ^2.0.0-alpha.41 + browser: ^0.10.0 +# #enddocregion foo +transformers: +- angular2: + entry_points: web/main.dart diff --git a/public/doc-shredder/_test/test_source/multiregion/simple.html b/public/doc-shredder/_test/test_source/multiregion/simple.html new file mode 100644 index 0000000000..b9070bbece --- /dev/null +++ b/public/doc-shredder/_test/test_source/multiregion/simple.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/public/doc-shredder/_test/test_source/multiregion/style.css b/public/doc-shredder/_test/test_source/multiregion/style.css new file mode 100644 index 0000000000..07a4f647ba --- /dev/null +++ b/public/doc-shredder/_test/test_source/multiregion/style.css @@ -0,0 +1,10 @@ +/* #docplaster plaster here */ +/* #docregion foo, bar */ +h2 { color: #444; font-weight: lighter; } +/* #enddocregion foo +body { margin: 2em; } +/* #enddocregion bar +/* #docregion foo, bar */ +body, input[text], button { color: #888; font-family: Cambria, Georgia; } +/* #enddocregion bar +button {padding: 0.2em; font-size: 14px} \ No newline at end of file diff --git a/public/doc-shredder/regionExtractor.js b/public/doc-shredder/regionExtractor.js index 97fda00190..d73b25c4ae 100644 --- a/public/doc-shredder/regionExtractor.js +++ b/public/doc-shredder/regionExtractor.js @@ -218,6 +218,7 @@ function getDocPlaster(line) { var rx = /#docplaster\s*(\S.*)/; try { var plaster = line.match(rx)[1]; + plaster = plaster.replace("-->","").replace('\*\/',""); return plaster.trim(); } catch (e) { return null;