diff --git a/public/_includes/_util-fns.jade b/public/_includes/_util-fns.jade
index 5e7afc0830..ce58638d07 100644
--- a/public/_includes/_util-fns.jade
+++ b/public/_includes/_util-fns.jade
@@ -1,7 +1,6 @@
//- Mixins and associated functions
mixin makeExample(path, fileName, title, stylePatterns)
-
- var language = attributes.language || getExtn(fileName);
- var format = attributes.format || "linenums";
- var extPath = getPathToFrags() + path + "/";
@@ -26,6 +25,7 @@ mixin makeTabs(path, fileNames, tabNames, stylePatterns)
code-pane(language="#{language}" name="#{tabName}" format="#{format}")
!= getFrag(extPath + fileName + ".md", sps)
+
- var getFrag = function(fileName, stylePatterns) {
- var frag = partial(fileName);
- if (frag == null) {
diff --git a/public/doc-shredder/regionExtractor.js b/public/doc-shredder/regionExtractor.js
index 3d9930bd12..e01bc718e0 100644
--- a/public/doc-shredder/regionExtractor.js
+++ b/public/doc-shredder/regionExtractor.js
@@ -34,14 +34,15 @@ module.exports = function regionExtractor() {
}
});
-
docs.forEach(function(doc) {
- var content;
+ var fragLines, content;
if (doc.endIx) {
- content = lines.slice(doc.startIx + 1, doc.endIx).join('\n');
+ fragLines = lines.slice(doc.startIx + 1, doc.endIx);
} else {
- content = lines.slice(doc.startIx + 1).join('\n');
+ fragLines = lines.slice(doc.startIx + 1);
}
+ fragLines = trimLeftIndent(fragLines);
+ content = fragLines.join('\n');
// eliminate all #docregion lines
content = content.replace(nullLinePattern, '');
if (content.substr(-3) === nullLine) {
@@ -54,6 +55,31 @@ module.exports = function regionExtractor() {
};
+function trimLeftIndent(lines) {
+ var minIx = 100;
+ var ok = lines.every(function(line) {
+ // var ix = line.search(/\S/);
+ var ix = line.search(/[^ ]/);
+ if (ix === 0) return false;
+ if (ix === -1) return true;
+ if (ix > 0) {
+ minIx = Math.min(minIx, ix);
+ }
+ return true;
+ });
+ if ( (!ok) || minIx === 100) return lines;
+
+ var result = lines.map(function(line) {
+ if (line.length > minIx) {
+ return line.substr(minIx);
+ } else {
+ // this can happen if line is all blanks and shorter than mixIx
+ return line;
+ }
+ });
+ return result;
+}
+
function isCommentLine(line, commentPrefixes) {
return commentPrefixes.some(function(prefix) {
return line.trim().indexOf(prefix) == 0;
diff --git a/public/docs/_fragments/gettingstarted/js/app-class.js.md b/public/docs/_fragments/gettingstarted/js/app-class.js.md
index 4984ff0eb7..814eeedd07 100644
--- a/public/docs/_fragments/gettingstarted/js/app-class.js.md
+++ b/public/docs/_fragments/gettingstarted/js/app-class.js.md
@@ -1,5 +1,5 @@
```
- .Class({
- constructor: function () { }
- });
+.Class({
+ constructor: function () { }
+});
```
\ No newline at end of file
diff --git a/public/docs/_fragments/gettingstarted/js/app-component.js.md b/public/docs/_fragments/gettingstarted/js/app-component.js.md
index df88ecafed..8015f6bac3 100644
--- a/public/docs/_fragments/gettingstarted/js/app-component.js.md
+++ b/public/docs/_fragments/gettingstarted/js/app-component.js.md
@@ -1,5 +1,5 @@
```
- .Component({
- selector: 'my-app'
- })
+.Component({
+ selector: 'my-app'
+})
```
\ No newline at end of file
diff --git a/public/docs/_fragments/gettingstarted/js/app-view.js.md b/public/docs/_fragments/gettingstarted/js/app-view.js.md
index 1bedef5b56..1bc141e57f 100644
--- a/public/docs/_fragments/gettingstarted/js/app-view.js.md
+++ b/public/docs/_fragments/gettingstarted/js/app-view.js.md
@@ -1,5 +1,5 @@
```
- .View({
- template: '
My First Angular 2 App
'
- })
+.View({
+ template: 'My First Angular 2 App
'
+})
```
\ No newline at end of file
diff --git a/public/docs/_fragments/gettingstarted/ts/src/app-bootstrap.js.md b/public/docs/_fragments/gettingstarted/ts/src/app-bootstrap.js.md
deleted file mode 100644
index 299a9059b4..0000000000
--- a/public/docs/_fragments/gettingstarted/ts/src/app-bootstrap.js.md
+++ /dev/null
@@ -1,3 +0,0 @@
-```
-angular2_1.bootstrap(AppComponent);
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/gettingstarted/ts/src/app-class-w-annotations.js.md b/public/docs/_fragments/gettingstarted/ts/src/app-class-w-annotations.js.md
deleted file mode 100644
index b9746100fa..0000000000
--- a/public/docs/_fragments/gettingstarted/ts/src/app-class-w-annotations.js.md
+++ /dev/null
@@ -1,16 +0,0 @@
-```
-var AppComponent = (function () {
- function AppComponent() {
- }
- AppComponent = __decorate([
- angular2_1.Component({
- selector: 'my-app'
- }),
- angular2_1.View({
- template: 'My First Angular 2 App
'
- }),
- __metadata('design:paramtypes', [])
- ], AppComponent);
- return AppComponent;
-})();
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/gettingstarted/ts/src/app-import.js.md b/public/docs/_fragments/gettingstarted/ts/src/app-import.js.md
deleted file mode 100644
index 8448db759c..0000000000
--- a/public/docs/_fragments/gettingstarted/ts/src/app-import.js.md
+++ /dev/null
@@ -1,3 +0,0 @@
-```
-var angular2_1 = require('angular2/angular2');
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/gettingstarted/ts/src/app.js.md b/public/docs/_fragments/gettingstarted/ts/src/app.js.md
deleted file mode 100644
index cd72a9055a..0000000000
--- a/public/docs/_fragments/gettingstarted/ts/src/app.js.md
+++ /dev/null
@@ -1,18 +0,0 @@
-```
-var angular2_1 = require('angular2/angular2');
-var AppComponent = (function () {
- function AppComponent() {
- }
- AppComponent = __decorate([
- angular2_1.Component({
- selector: 'my-app'
- }),
- angular2_1.View({
- template: 'My First Angular 2 App
'
- }),
- __metadata('design:paramtypes', [])
- ], AppComponent);
- return AppComponent;
-})();
-
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/quickstart/src/app-bootstrap.js.md b/public/docs/_fragments/quickstart/src/app-bootstrap.js.md
deleted file mode 100644
index 299a9059b4..0000000000
--- a/public/docs/_fragments/quickstart/src/app-bootstrap.js.md
+++ /dev/null
@@ -1,3 +0,0 @@
-```
-angular2_1.bootstrap(AppComponent);
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/quickstart/src/app-import.js.md b/public/docs/_fragments/quickstart/src/app-import.js.md
deleted file mode 100644
index 8448db759c..0000000000
--- a/public/docs/_fragments/quickstart/src/app-import.js.md
+++ /dev/null
@@ -1,3 +0,0 @@
-```
-var angular2_1 = require('angular2/angular2');
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/quickstart/src/app.js.md b/public/docs/_fragments/quickstart/src/app.js.md
deleted file mode 100644
index 6e85873c52..0000000000
--- a/public/docs/_fragments/quickstart/src/app.js.md
+++ /dev/null
@@ -1,21 +0,0 @@
-```
-var angular2_1 = require('angular2/angular2');
-var AppComponent = (function () {
- function AppComponent() {
- this.name = 'Alice';
- }
- AppComponent = __decorate([
- angular2_1.Component({
- selector: 'app'
- }),
- angular2_1.View({
- template: 'Hello {{ name }}
'
- }),
- __metadata('design:paramtypes', [])
- ], AppComponent);
- return AppComponent;
-})();
-exports.AppComponent = AppComponent;
-angular2_1.bootstrap(AppComponent);
-//# sourceMappingURL=app.js.map
-```
\ No newline at end of file
diff --git a/public/docs/_fragments/styleguide/js/app-class.js.md b/public/docs/_fragments/styleguide/js/app-class.js.md
index 4984ff0eb7..814eeedd07 100644
--- a/public/docs/_fragments/styleguide/js/app-class.js.md
+++ b/public/docs/_fragments/styleguide/js/app-class.js.md
@@ -1,5 +1,5 @@
```
- .Class({
- constructor: function () { }
- });
+.Class({
+ constructor: function () { }
+});
```
\ No newline at end of file
diff --git a/public/docs/_fragments/styleguide/js/app-component.js.md b/public/docs/_fragments/styleguide/js/app-component.js.md
index df88ecafed..8015f6bac3 100644
--- a/public/docs/_fragments/styleguide/js/app-component.js.md
+++ b/public/docs/_fragments/styleguide/js/app-component.js.md
@@ -1,5 +1,5 @@
```
- .Component({
- selector: 'my-app'
- })
+.Component({
+ selector: 'my-app'
+})
```
\ No newline at end of file
diff --git a/public/docs/_fragments/styleguide/js/app-view.js.md b/public/docs/_fragments/styleguide/js/app-view.js.md
index 1bedef5b56..1bc141e57f 100644
--- a/public/docs/_fragments/styleguide/js/app-view.js.md
+++ b/public/docs/_fragments/styleguide/js/app-view.js.md
@@ -1,5 +1,5 @@
```
- .View({
- template: 'My First Angular 2 App
'
- })
+.View({
+ template: 'My First Angular 2 App
'
+})
```
\ No newline at end of file