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

Commit 59f6ebe

Browse files
chalinkwalrath
authored andcommitted
docs(*): misc fixes to prose in support of jade2ng (#2266)
Fixes to prose “syntax”. Anomalies detected by jade2ng. Also updated the main _utils-fn.jade in support of jade2ng as well.
1 parent b16b058 commit 59f6ebe

File tree

6 files changed

+64
-64
lines changed

6 files changed

+64
-64
lines changed

public/_includes/_util-fns.jade

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -154,64 +154,66 @@ mixin makeJson( filePath, jsonConfig, title, stylePatterns)
154154
else
155155
!= styleString(jsonExtract, stylePatterns)
156156

157-
- // Open (and close) an explanation <div>. See QuickStart
158-
script.
159-
function why(id, backTo) {
160-
var id = "#"+id;
161-
var el = document.querySelector(id);
162-
el.hidden=el.hidden=!el.hidden;
163-
164-
if (el.hidden && backTo){
165-
// the next line is required to work around a bug in WebKit (Chrome / Safari)
166-
location.href = "#";
167-
location.href = "#" + backTo;
157+
if !jade2ng
158+
//- Open (and close) an explanation <div>. See QuickStart
159+
script.
160+
function why(id, backTo) {
161+
var id = "#"+id;
162+
var el = document.querySelector(id);
163+
el.hidden=el.hidden=!el.hidden;
164+
165+
if (el.hidden && backTo){
166+
// the next line is required to work around a bug in WebKit (Chrome / Safari)
167+
location.href = "#";
168+
location.href = "#" + backTo;
169+
}
170+
}
171+
script.
172+
function verbose(isVerbose) {
173+
isVerbose = !! isVerbose;
174+
var el = document.querySelector('button.verbose.off');
175+
el.style.display = isVerbose ? 'block' : 'none';
176+
var el = document.querySelector('button.verbose.on');
177+
el.style.display = isVerbose ? 'none' : 'block';
178+
179+
CCSStylesheetRuleStyle('main','.l-verbose-section', 'display',
180+
isVerbose ? 'block' : 'none');
168181
}
169-
}
170-
script.
171-
function verbose(isVerbose) {
172-
isVerbose = !! isVerbose;
173-
var el = document.querySelector('button.verbose.off');
174-
el.style.display = isVerbose ? 'block' : 'none';
175-
var el = document.querySelector('button.verbose.on');
176-
el.style.display = isVerbose ? 'none' : 'block';
177-
178-
CCSStylesheetRuleStyle('main','.l-verbose-section', 'display',
179-
isVerbose ? 'block' : 'none');
180-
}
181-
182-
script.
183-
function CCSStylesheetRuleStyle(stylesheet, selectorText, style, value){
184-
/* returns the value of the element style of the rule in the stylesheet
185-
* If no value is given, reads the value
186-
* If value is given, the value is changed and returned
187-
* If '' (empty string) is given, erases the value.
188-
* The browser will apply the default one
189-
*
190-
* string stylesheet: part of the .css name to be recognized, e.g. 'default'
191-
* string selectorText: css selector, e.g. '#myId', '.myClass', 'thead td'
192-
* string style: camelCase element style, e.g. 'fontSize'
193-
* string value optional : the new value
194-
*/
195-
var CCSstyle = undefined, rules, sheet;
196-
for(var m in document.styleSheets){
197-
sheet = document.styleSheets[m];
198-
if(sheet.href && sheet.href.indexOf(stylesheet) != -1){
199-
rules = sheet[document.all ? 'rules' : 'cssRules'];
200-
for(var n in rules){
201-
console.log(rules[n].selectorText);
202-
if(rules[n].selectorText == selectorText){
203-
CCSstyle = rules[n].style;
204-
break;
182+
183+
script.
184+
function CCSStylesheetRuleStyle(stylesheet, selectorText, style, value){
185+
/* returns the value of the element style of the rule in the stylesheet
186+
* If no value is given, reads the value
187+
* If value is given, the value is changed and returned
188+
* If '' (empty string) is given, erases the value.
189+
* The browser will apply the default one
190+
*
191+
* string stylesheet: part of the .css name to be recognized, e.g. 'default'
192+
* string selectorText: css selector, e.g. '#myId', '.myClass', 'thead td'
193+
* string style: camelCase element style, e.g. 'fontSize'
194+
* string value optional : the new value
195+
*/
196+
var CCSstyle = undefined, rules, sheet;
197+
for(var m in document.styleSheets){
198+
sheet = document.styleSheets[m];
199+
if(sheet.href && sheet.href.indexOf(stylesheet) != -1){
200+
rules = sheet[document.all ? 'rules' : 'cssRules'];
201+
for(var n in rules){
202+
console.log(rules[n].selectorText);
203+
if(rules[n].selectorText == selectorText){
204+
CCSstyle = rules[n].style;
205+
break;
206+
}
207+
}
208+
break;
205209
}
206210
}
207-
break;
208-
}
211+
if(value == undefined)
212+
return CCSstyle[style]
213+
else
214+
return CCSstyle[style] = value
209215
}
210-
if(value == undefined)
211-
return CCSstyle[style]
212-
else
213-
return CCSstyle[style] = value
214-
}
216+
215217
//---------------------------------------------------------------------------------------------------------
216218
//- Converts the given project-relative path (like 'app/main.ts')
217219
//- to a doc folder relative path (like 'quickstart/ts/app/main.ts')
@@ -298,7 +300,7 @@ script.
298300
- } else {
299301
- // ``` gets translated to <pre><code>.....</code></pre> and we need
300302
- // to remove this from the fragment prefix is 11 long and suffix is 13 long
301-
- frag = frag.substring(11, frag.length-13);
303+
- frag = jade2ng ? frag : frag.substring(11, frag.length-13);
302304
- // Uncomment next line for debugging.
303305
- // frag = "FileName: " + fullFileName + " Current path: " + current.path + " PathToDocs: " + getPathToDocs() + "\n" + frag;
304306
- return frag;

public/docs/ts/latest/cookbook/component-communication.jade

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ figure.image-display
172172
:marked
173173
[Back to top](#top)
174174

175-
parent-to-child-local-var
176-
.l-main-section
177-
<a id="parent-to-child-local-var"></a>
175+
.l-main-section#parent-to-child-local-var
178176
:marked
179177
## Parent interacts with child via *local variable*
180178

public/docs/ts/latest/cookbook/visual-studio-2015.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ h2#build-and-run Step 7: Build and run the app
139139

140140
.alert.is-important
141141
:marked
142-
Compiler errors such as "*Property map does not exist on type Observable<Response>*" and
142+
Compiler errors such as "*Property `map` does not exist on type `Observable<Response>`*" and
143143
"*Observable cannot be found*" indicate an old release of Visual Studio.
144144
Exit Visual Studio and follow the [instructions here](https://github.com/Microsoft/TypeScript/issues/8518).
145145

public/docs/ts/latest/guide/server-communication.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ a#HeroService
246246
:marked
247247
Let's return to our study of the `HeroService`.
248248

249-
l-main-section
249+
.l-main-section
250250
a#extract-data
251251
:marked
252252
## Process the response object
@@ -410,7 +410,7 @@ block hero-list-comp-add-hero
410410
h2#promises Fall back to Promises
411411
:marked
412412
Although the Angular `http` client API returns an `Observable<Response>` we can turn it into a
413-
[Promise<Response>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) if we prefer.
413+
[`Promise<Response>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) if we prefer.
414414
It's easy to do and a promise-based version looks much like the observable-based version in simple cases.
415415
.l-sub-section
416416
:marked

public/docs/ts/latest/guide/webpack.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ code-example(format="").
431431
p.
432432
The <code>app.component.html</code> displays this downloadable Angular logo
433433
<a href="https://raw.githubusercontent.com/angular/angular.io/master/public/resources/images/logos/angular2/angular.png" target="_blank">
434-
<img src="https://raw.githubusercontent.com/angular/angular.io/master/public/resources/images/logos/angular2/angular.png" height="40px" title="download Angular logo"></a>.
434+
<img src="/resources/images/logos/angular2/angular.png" height="40px" title="download Angular logo"></a>.
435435

436436

437437
+makeTabs(

public/docs/ts/latest/quickstart.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ h1 Overview
2626

2727
aside.is-right
2828
:marked
29-
The live example link opens the finished application <span if-docs="ts"> in
29+
The live example link opens the finished application in
3030
<a href="http://plnkr.co/" title="Plunker" target="_blank">Plunker</a> so that you can interact
3131
with the code. You'll find live examples at the start of most sections.
3232

@@ -48,7 +48,7 @@ h2 Build this application!
4848
:marked
4949
- [Prerequisite](#prereq): Install #{_prereq}.
5050
- [Step 1](#create-and-configure): Create and configure the project.
51-
<li if-docs="ts">[Step 2](#ngmodule): Create your application.</li>
51+
<span if-docs="ts"><li>[Step 2](#ngmodule): Create your application.</span>
5252
- [Step !{step++}](#root-component): Create a component and add it to your application.
5353
- [Step !{step++}](#main): Start up your application.
5454
- [Step !{step++}](#index): Define the web page that hosts the application.

0 commit comments

Comments
 (0)