2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								include ../../../_includes/_util-fns
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								//- See the _util-fns file included above for a description of the use of these variables.
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 06:17:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _docsFor = 'dart';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _decorator = 'annotation';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-10 00:51:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _array = 'list';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-14 17:40:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _an_array = 'a list'; //- Deprecate now that we have the articles
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- var _a = 'an';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- var _an = 'a';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _priv = '_';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-14 17:40:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _Lang = 'Dart';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-13 13:44:14 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _Promise = 'Future';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- var _Observable = 'Stream';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-18 13:43:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var _liveLink = 'sample repo';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 06:17:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								mixin liveExampleLink(linkText, exampleUrlPartName)
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-20 16:18:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  - var text = linkText || 'live example';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  - var ex = exampleUrlPartName || getExampleName();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  - var href = 'http://angular-examples.github.io/' + ex;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  a(href='#{href}' target="_blank")= text
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 06:17:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								mixin liveExampleLink2(linkText, exampleUrlPartName)
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-20 16:18:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  - var srcText = attributes.srcText || 'view source';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  - var ex = exampleUrlPartName || attributes.example || getExampleName();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  - var href = 'http://github.com/angular-examples/' + ex;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  span #[+liveExampleLink(linkText, ex)] (#[a(href='#{href}' target="_blank") #{srcText}])
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-04 05:18:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var adjustExamplePath = function(_path) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   if(!_path) return _path;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   var path = _path.trim();
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   var folder = getFolder(path);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   var extn = getExtn(path);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   // if(extn == 'dart') return path;
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-04 05:18:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   var baseName = getBaseFileName(path) || path; // TODO: have getBaseFileName() return path
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   var baseNameNoExt = baseName.substr(0,baseName.length - (extn.length + 1));
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-14 17:40:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   var inWebFolder = baseNameNoExt.match(/^(main|index(\.\d)?)$/);
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-18 13:43:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   // Adjust the folder path, e.g., ts -> dart
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-14 17:40:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   folder = folder.replace(/(^|\/)ts($|\/)/, '$1dart$2').replace(/(^|\/)app($|\/)/, inWebFolder ? '$1web$2' : '$1lib$2');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   // Special case not handled above: e.g., index.html -> web/index.html
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   if(baseNameNoExt.match(/^(index|styles)(\.\d)?$/)) folder = (folder ? folder + '/' : '') + 'web';
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   // In file name, replace special characters with underscore
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   baseNameNoExt = baseNameNoExt.replace(/[\-\.]/g, '_');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   // Adjust the file extension
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   if(extn == 'ts') extn = 'dart';
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-04 05:18:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   return (folder ? folder + '/' : '') + baseNameNoExt + (extn ? '.' + extn : '');
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-04 05:18:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- var adjustExampleTitle = function(_title) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   if(!_title || !adjustExamplePath) return _title;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   var title = _title.trim();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   // Assume title is a path if it ends with an extension like '.foo',
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   // optionally followed by some comment in parentheses.
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-14 17:40:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   var matches = title.match(/(.*\.\w+)($|\s*\([\w ]+\)$)/);
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-04 05:18:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   if(matches && matches.length == 3) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-     // e.g. matches == ['abc.ts (excerpt)', 'abc.ts', ' (excerpt)']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-     var path = adjustExamplePath(matches[1]);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-     title = path + matches[2];
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 10:54:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-   }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-   return title;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- }
							 |