Fix for triply or greater nested fragments and trailing nullLine markers
This commit is contained in:
		
							parent
							
								
									49f8b32e6c
								
							
						
					
					
						commit
						c85d482b18
					
				| @ -17,10 +17,10 @@ module.exports = function regionExtractor() { | |||||||
|     lines.forEach(function(line, ix) { |     lines.forEach(function(line, ix) { | ||||||
|       if (isCommentLine(line, commentPrefixes)) { |       if (isCommentLine(line, commentPrefixes)) { | ||||||
|         if (hasRegionTag(line)) { |         if (hasRegionTag(line)) { | ||||||
|  |           if (doc) docStack.push(doc); | ||||||
|           doc = {startIx: ix, regionName: getRegionName(line)}; |           doc = {startIx: ix, regionName: getRegionName(line)}; | ||||||
|           lines[ix] = nullLine; |           lines[ix] = nullLine; | ||||||
|           docs.push(doc); |           docs.push(doc); | ||||||
|           docStack.push(doc); |  | ||||||
|         } else if (hasEndRegionTag(line)) { |         } else if (hasEndRegionTag(line)) { | ||||||
|           lines[ix] = nullLine; |           lines[ix] = nullLine; | ||||||
|           doc.endIx = ix; |           doc.endIx = ix; | ||||||
| @ -38,8 +38,11 @@ module.exports = function regionExtractor() { | |||||||
|       } |       } | ||||||
|       // eliminate all #docregion lines
 |       // eliminate all #docregion lines
 | ||||||
|       var rx = new RegExp(nullLine + '\n', 'g'); |       var rx = new RegExp(nullLine + '\n', 'g'); | ||||||
|       doc.content = content.replace(rx, ''); |       var content = content.replace(rx, ''); | ||||||
| 
 |       if (content.substr(-3) === nullLine) { | ||||||
|  |         content = content.substr(0, content.length-3); | ||||||
|  |       } | ||||||
|  |       doc.content = content; | ||||||
|     }); |     }); | ||||||
|     return docs; |     return docs; | ||||||
|   } |   } | ||||||
|  | |||||||
							
								
								
									
										22
									
								
								tools/doc-shredder/_test/test_source/no-multiregion/app2.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								tools/doc-shredder/_test/test_source/no-multiregion/app2.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | |||||||
|  | // #docregion
 | ||||||
|  | // #docregion import
 | ||||||
|  | import {Component, View, bootstrap} from 'angular2/angular2'; | ||||||
|  | // #enddocregion
 | ||||||
|  | 
 | ||||||
|  | //#docregion class-w-annotations
 | ||||||
|  | @Component({ | ||||||
|  |     selector: 'my-app' | ||||||
|  | }) | ||||||
|  | @View({ | ||||||
|  |     template: '<h1 id="output">Hello, Angular 2!</h1>' | ||||||
|  | }) | ||||||
|  | //#docregion class
 | ||||||
|  | class MyAppComponent { | ||||||
|  | } | ||||||
|  | //#enddocregion
 | ||||||
|  | //#enddocregion
 | ||||||
|  | 
 | ||||||
|  | //#docregion bootstrap
 | ||||||
|  | bootstrap(MyAppComponent); | ||||||
|  | //#enddocregion
 | ||||||
|  | //#enddocregion
 | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user