This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ module.exports = function regionExtractor() {
17
17
lines . forEach ( function ( line , ix ) {
18
18
if ( isCommentLine ( line , commentPrefixes ) ) {
19
19
if ( hasRegionTag ( line ) ) {
20
+ if ( doc ) docStack . push ( doc ) ;
20
21
doc = { startIx : ix , regionName : getRegionName ( line ) } ;
21
22
lines [ ix ] = nullLine ;
22
23
docs . push ( doc ) ;
23
- docStack . push ( doc ) ;
24
24
} else if ( hasEndRegionTag ( line ) ) {
25
25
lines [ ix ] = nullLine ;
26
26
doc . endIx = ix ;
@@ -38,8 +38,11 @@ module.exports = function regionExtractor() {
38
38
}
39
39
// eliminate all #docregion lines
40
40
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 ;
43
46
} ) ;
44
47
return docs ;
45
48
}
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments