Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 713a428

Browse files
committed
Fix for triply or greater nested fragments and trailing nullLine markers
1 parent 826e3da commit 713a428

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

public/doc-shredder/regionExtractor.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ module.exports = function regionExtractor() {
1717
lines.forEach(function(line, ix) {
1818
if (isCommentLine(line, commentPrefixes)) {
1919
if (hasRegionTag(line)) {
20+
if (doc) docStack.push(doc);
2021
doc = {startIx: ix, regionName: getRegionName(line)};
2122
lines[ix] = nullLine;
2223
docs.push(doc);
23-
docStack.push(doc);
2424
} else if (hasEndRegionTag(line)) {
2525
lines[ix] = nullLine;
2626
doc.endIx = ix;
@@ -38,8 +38,11 @@ module.exports = function regionExtractor() {
3838
}
3939
// eliminate all #docregion lines
4040
var rx = new RegExp(nullLine + '\n', 'g');
41-
doc.content = content.replace(rx, '');
42-
41+
var content = content.replace(rx, '');
42+
if (content.substr(-3) === nullLine) {
43+
content = content.substr(0, content.length-3);
44+
}
45+
doc.content = content;
4346
});
4447
return docs;
4548
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// #docregion
2+
// #docregion import
3+
import {Component, View, bootstrap} from 'angular2/angular2';
4+
// #enddocregion
5+
6+
//#docregion class-w-annotations
7+
@Component({
8+
selector: 'my-app'
9+
})
10+
@View({
11+
template: '<h1 id="output">Hello, Angular 2!</h1>'
12+
})
13+
//#docregion class
14+
class MyAppComponent {
15+
}
16+
//#enddocregion
17+
//#enddocregion
18+
19+
//#docregion bootstrap
20+
bootstrap(MyAppComponent);
21+
//#enddocregion
22+
//#enddocregion

0 commit comments

Comments
 (0)