chore(util-fns): minor cleanup and refactoring (#1562)

This only impacts language dependent variable and path definitions:
- Removed deprecated variable.
- Hoisted useful variable definitions from quickstart into _util-fns.
- Minor fix in regexp of path translation function
This commit is contained in:
Patrice Chalin 2016-05-31 15:25:59 -07:00 committed by Kathy Walrath
parent 2bc166c34f
commit 5e50b2ef10
5 changed files with 14 additions and 9 deletions

View File

@ -23,13 +23,18 @@
//- TS arrays vs. Dart lists //- TS arrays vs. Dart lists
- var _Array = 'Array'; - var _Array = 'Array';
- var _array = 'array'; - var _array = 'array';
//- Deprecate now that we have the articles _a and _an
- var _an_array = 'an array';
//- Promise vs. Future, etc //- Promise vs. Future, etc
- var _Promise = 'Promise'; - var _Promise = 'Promise';
- var _PromiseUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise';
- var _PromiseLinked = '<a href="' + _PromiseUrl + '">' + _Promise + '</a>';
- var _Observable = 'Observable'; - var _Observable = 'Observable';
//- Directories & folders
- var _appDir = 'app';
- var _indexHtmlDir = 'project root';
- var _mainDir = _appDir;
//- Location of sample code //- Location of sample code
- var _liveLink = 'live link'; - var _liveLink = 'live link';

View File

@ -5,16 +5,20 @@ include ../../../_includes/_util-fns
- var _decorator = 'annotation'; - var _decorator = 'annotation';
- var _Array = 'List'; - var _Array = 'List';
- var _array = 'list'; - var _array = 'list';
- var _an_array = 'a list'; //- Deprecate now that we have the articles
- var _a = 'an'; - var _a = 'an';
- var _an = 'a'; - var _an = 'a';
- var _priv = '_'; - var _priv = '_';
- var _Lang = 'Dart'; - var _Lang = 'Dart';
- var _Promise = 'Future'; - var _Promise = 'Future';
- var _FutureUrl = 'https://api.dartlang.org/dart_async/Future.html';
- var _PromiseLinked = '<a href="' + _FutureUrl + '">' + _Promise + '</a>';
- var _Observable = 'Stream'; - var _Observable = 'Stream';
- var _liveLink = 'sample repo'; - var _liveLink = 'sample repo';
- var _truthy = 'true'; - var _truthy = 'true';
- var _falsey = 'false'; - var _falsey = 'false';
- var _appDir = 'lib';
- var _indexHtmlDir = 'web';
- var _mainDir = 'web';
mixin liveExampleLink(linkText, exampleUrlPartName) mixin liveExampleLink(linkText, exampleUrlPartName)
- var text = linkText || 'live example'; - var text = linkText || 'live example';
@ -36,7 +40,7 @@ mixin liveExampleLink2(linkText, exampleUrlPartName)
- // if(extn == 'dart') return path; - // if(extn == 'dart') return path;
- var baseName = getBaseFileName(path) || path; // TODO: have getBaseFileName() return path - var baseName = getBaseFileName(path) || path; // TODO: have getBaseFileName() return path
- var baseNameNoExt = baseName.substr(0,baseName.length - (extn.length + 1)); - var baseNameNoExt = baseName.substr(0,baseName.length - (extn.length + 1));
- var inWebFolder = baseNameNoExt.match(/^(main|index(\.\d)?)$/); - var inWebFolder = baseNameNoExt.match(/^(main|index)(\.\d)?$/);
- // Adjust the folder path, e.g., ts -> dart - // Adjust the folder path, e.g., ts -> dart
- folder = folder.replace(/(^|\/)ts($|\/)/, '$1dart$2').replace(/(^|\/)app($|\/)/, inWebFolder ? '$1web$2' : '$1lib$2'); - 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 - // Special case not handled above: e.g., index.html -> web/index.html

View File

@ -6,8 +6,6 @@ block includes
- var _prereq = 'the Dart SDK' - var _prereq = 'the Dart SDK'
- var _angular_browser_uri = 'package:angular2/platform/browser.dart' - var _angular_browser_uri = 'package:angular2/platform/browser.dart'
- var _angular_core_uri = 'package:angular2/core.dart' - var _angular_core_uri = 'package:angular2/core.dart'
- var _appDir = 'lib'
- var _indexHtmlDir = 'web'
block setup-tooling block setup-tooling
:marked :marked

View File

@ -31,7 +31,7 @@ p Run the #[+liveExampleLink2()] of the code shown in this chapter.
specifying any selectors, rules, and media queries that we need. specifying any selectors, rules, and media queries that we need.
One way to do this is to set the `styles` property in the component metadata. One way to do this is to set the `styles` property in the component metadata.
The `styles` property takes #{_an_array} of strings that contain CSS code. The `styles` property takes #{_an} #{_array} of strings that contain CSS code.
Usually we give it one string as in this example: Usually we give it one string as in this example:
+makeExample('component-styles/ts/app/hero-app.component.ts')(format='.') +makeExample('component-styles/ts/app/hero-app.component.ts')(format='.')

View File

@ -4,8 +4,6 @@ block includes
- var _prereq = 'Node.js' - var _prereq = 'Node.js'
- var _angular_browser_uri = '@angular/platform-browser-dynamic' - var _angular_browser_uri = '@angular/platform-browser-dynamic'
- var _angular_core_uri = '@angular/core' - var _angular_core_uri = '@angular/core'
- var _appDir = 'app'
- var _indexHtmlDir = 'project root'
:marked :marked
Our QuickStart goal is to build and run a super-simple Our QuickStart goal is to build and run a super-simple