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

Commit 3bc9414

Browse files
johnpapawardbell
authored andcommitted
docs(style-guide): add style-guide - v.3
closes #1170
1 parent 59c7679 commit 3bc9414

File tree

9 files changed

+665
-315
lines changed

9 files changed

+665
-315
lines changed

public/_includes/_util-fns.jade

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ mixin makeExample(filePath, region, title, stylePatterns)
99
- var frag = getFrag(filePath, region);
1010
- var defaultFormat = frag.split('\n').length > 2 ? "linenums" : "";
1111
- var format = attributes.format || defaultFormat;
12+
- var avoid = !!attributes.avoid;
13+
1214
if (title)
13-
.example-title #{title}
15+
if (avoid)
16+
.example-title.avoid AVOID: #{title}
17+
else
18+
.example-title #{title}
1419
code-example(language="#{language}" format="#{format}")
1520
!= styleString(frag, stylePatterns)
1621

@@ -37,9 +42,13 @@ mixin makeJson( filePath, jsonConfig, title, stylePatterns)
3742
- var frag = getFrag(filePath, '');
3843
- var json = unescapeHtml(frag);
3944
- var jsonExtract = extractJson(json, jsonConfig);
45+
- var avoid = !!attributes.avoid;
4046

4147
if (title)
42-
.example-title #{title}
48+
if (avoid)
49+
.example-title.avoid #{title}
50+
else
51+
.example-title #{title}
4352
code-example(language="#{language}" format="#{format}")
4453
if (jsonExtract == 'ERROR')
4554
err ERROR: Unable to extract json using config: "#{jsonConfig.toString()}"
@@ -303,4 +312,4 @@ script.
303312
- }
304313
- }
305314
- }
306-
- }
315+
- }

public/docs/_examples/style-guide/ts/001/app/app.component.ts renamed to public/docs/_examples/style-guide/ts/01-01/app/app.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ import { Hero } from './hero';
1010
import { HeroService } from './hero.service';
1111

1212
@Component({
13-
selector: 'my-app',
13+
selector: 'toh-app',
1414
template: `
15-
<pre>{{heroes | json}}</pre>
15+
<pre>{{heroes | json}}</pre>
1616
`,
1717
styleUrls: ['app/app.component.css'],
1818
providers: [HeroService]
1919
})
2020
export class AppComponent implements OnInit{
2121
heroes: Hero[] = [];
2222

23-
constructor(private _heroService: HeroService) {}
23+
constructor(private heroService: HeroService) {}
2424

2525
ngOnInit() {
26-
this._heroService.getHeroes()
26+
this.heroService.getHeroes()
2727
.then(heroes => this.heroes = heroes);
2828
}
2929
}

public/docs/_examples/style-guide/ts/001/app/placeholder.ts renamed to public/docs/_examples/style-guide/ts/01-01/app/placeholder.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docplaster
22

3-
// #docregion 001-1
3+
// #docregion 01-01-1
44
/* avoid */
55
import { bootstrap } from 'angular2/platform/browser';
66
import { Component, OnInit } from 'angular2/core';
@@ -9,7 +9,7 @@
99
selector: 'my-app',
1010
template: `
1111
<h1>{{title}}</h1>
12-
<pre>{{heroes | json}}</pre>
12+
<pre>{{heroes | json}}</pre>
1313
`,
1414
styleUrls: ['app/app.component.css']
1515
})
@@ -27,11 +27,11 @@
2727

2828
function getHeroes() {
2929
return // some promise of data;
30-
}
31-
// #enddocregion 001-1
30+
}
31+
// #enddocregion 01-01-1
3232

3333

34-
// #docregion 001-2
34+
// #docregion 01-01-2
3535
/* recommended */
3636

3737
// main.ts
@@ -50,24 +50,24 @@
5050
@Component({
5151
selector: 'my-app',
5252
template: `
53-
<pre>{{heroes | json}}</pre>
53+
<pre>{{heroes | json}}</pre>
5454
`,
5555
styleUrls: ['app/app.component.css'],
5656
providers: [HeroService]
5757
})
5858
export class AppComponent implements OnInit{
5959
heroes: Hero[] = [];
6060

61-
constructor(private _heroService: HeroService) {}
61+
constructor(private heroService: HeroService) {}
6262

6363
ngOnInit() {
64-
this._heroService.getHeroes()
64+
this.heroService.getHeroes()
6565
.then(heroes => this.heroes = heroes);
6666
}
6767
}
68-
// #enddocregion 001-2
68+
// #enddocregion 01-01-2
6969

70-
// #docregion 001-3
70+
// #docregion 01-01-3
7171
/* recommended */
7272

7373
// hero.service.ts
@@ -80,14 +80,14 @@
8080
return Promise.resolve(HEROES);
8181
}
8282
}
83-
// #enddocregion 001-3
83+
// #enddocregion 01-01-3
8484

85-
// #docregion 001-4
85+
// #docregion 01-01-4
8686
/* recommended */
8787

8888
// hero.ts
8989
export class Hero {
9090
id: number;
9191
name: string;
9292
}
93-
// #enddocregion 001-4
93+
// #enddocregion 01-01-4

0 commit comments

Comments
 (0)