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

Commit 05b9e67

Browse files
authored
Fix example sources not loading on firebase (#67)
* regen filkes * Fix firebase not loading example sources
1 parent d42ea1a commit 05b9e67

File tree

140 files changed

+35
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+35
-22
lines changed

src/app/shared/example-viewer/example-viewer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ export class ExampleViewer {
4848
}
4949

5050
exampleFileUrl(extension: string) {
51-
return `/assets/examples/${this.example}-example.${extension.toLowerCase()}.html`;
51+
return `/assets/examples/${this.example}-example-${extension.toLowerCase()}.html`;
5252
}
5353
}

src/assets/examples/radio-ngmodel-example.ts.html renamed to src/assets/examples/radio-ng-model-example-ts.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
<span class="hljs-meta">@Component</span>({
5-
selector: <span class="hljs-string">'radio-ngmodel-example'</span>,
6-
templateUrl: <span class="hljs-string">'./radio-ngmodel-example.html'</span>,
7-
styleUrls: [<span class="hljs-string">'./radio-ngmodel-example.css'</span>],
5+
selector: <span class="hljs-string">'radio-ng-model-example'</span>,
6+
templateUrl: <span class="hljs-string">'./radio-ng-model-example.html'</span>,
7+
styleUrls: [<span class="hljs-string">'./radio-ng-model-example.css'</span>],
88
})
99
<span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> RadioNgModelExample {
1010
favoriteSeason: <span class="hljs-built_in">string</span>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">md-button</span> (<span class="hljs-attr">click</span>)=<span class="hljs-string">"openSnackBar()"</span> <span class="hljs-attr">aria-label</span>=<span class="hljs-string">"Show an example snack-bar"</span>&gt;</span>
2+
Pizza party
3+
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<span class="hljs-selector-class">.example-pizza-party</span> {
2+
<span class="hljs-attribute">color</span>: hotpink;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"example-pizza-party"</span>&gt;</span>
2+
🍕🍕🍕🍕🍕 Pizza party!!! 🍕🍕🍕🍕🍕
3+
<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>

src/assets/examples/snack-bar-component-example-snack.css.html

-3
This file was deleted.

src/assets/examples/snack-bar-component-example-snack.html.html

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
<span class="hljs-keyword">import</span> {Component, ViewEncapsulation} from <span class="hljs-string">'@angular/core'</span>;
1+
<span class="hljs-keyword">import</span> {Component} from <span class="hljs-string">'@angular/core'</span>;
22
<span class="hljs-keyword">import</span> {MdSnackBar} from <span class="hljs-string">'@angular/material'</span>;
33

44

55
<span class="hljs-meta">@Component</span>({
66
selector: <span class="hljs-string">'snack-bar-component-example'</span>,
7-
template: <span class="hljs-string">''</span>,
7+
templateUrl: <span class="hljs-string">'./snack-bar-component-example.html'</span>,
88
})
99
<span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> SnackBarComponentExample {
10-
<span class="hljs-keyword">constructor</span>(<span class="hljs-params">snackBar: MdSnackBar</span>) {
11-
snackBar.openFromComponent(SnackBarComponentExampleSnack);
10+
<span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">public</span> snackBar: MdSnackBar</span>) {}
11+
12+
openSnackBar() {
13+
<span class="hljs-keyword">this</span>.snackBar.openFromComponent(PizzaPartyComponent, {
14+
duration: <span class="hljs-number">500</span>,
15+
});
1216
}
1317
}
1418

@@ -17,9 +21,5 @@
1721
selector: <span class="hljs-string">'snack-bar-component-example-snack'</span>,
1822
templateUrl: <span class="hljs-string">'./snack-bar-component-example-snack.html'</span>,
1923
styleUrls: [<span class="hljs-string">'./snack-bar-component-example-snack.css'</span>],
20-
host: {
21-
<span class="hljs-string">'class'</span>: <span class="hljs-string">'example-snack'</span>,
22-
},
23-
encapsulation: ViewEncapsulation.None,
2424
})
25-
<span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> SnackBarComponentExampleSnack {}
25+
<span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> PizzaPartyComponent {}

src/assets/examples/snack-bar-overview-example.ts.html renamed to src/assets/examples/snack-bar-overview-example-ts.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">public</span> snackBar: MdSnackBar</span>) {}
1111

1212
openSnackBar(message: <span class="hljs-built_in">string</span>, action: <span class="hljs-built_in">string</span>) {
13-
<span class="hljs-keyword">this</span>.snackBar.open(message, action);
13+
<span class="hljs-keyword">this</span>.snackBar.open(message, action, {
14+
duration: <span class="hljs-number">2000</span>,
15+
});
1416
}
1517
}

tools/highlight-examples.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22
echo "Highlighting example sources. This may take 15 - 20 seconds..."
3-
find ./src/app/examples/ -mindepth 2 -type f \( -iname "*.css" -or -iname "*.ts" -or -iname "*.html" \) -exec sh -c './tools/syntax-highlight.js {} ./src/assets/examples/$(basename {}).html' \;
3+
find ./src/app/examples/ -mindepth 2 -type f \( -iname "*.css" -or -iname "*.ts" -or -iname "*.html" \) -exec sh -c './tools/syntax-highlight.js {} ./src/assets/examples/' \;

tools/syntax-highlight.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
* Creates a syntax highlighted HTML file from a source file using highlight.js.
66
*
77
* Use:
8-
* syntax-highlight path/to/input/file path/to/output/file
8+
* syntax-highlight path/to/input/file path/to/output/dir/
99
*/
1010

1111
const fs = require('fs');
1212
const path = require('path');
1313
const hljs = require('highlight.js');
1414

1515
const inputFile = process.argv[2];
16-
const outputFile = process.argv[3];
16+
const outputPath = process.argv[3];
1717

18-
let language = path.extname(inputFile).toLowerCase().slice(1);
18+
let extension = path.extname(inputFile).toLowerCase().slice(1);
19+
let language = extension;
1920

2021
// Highlight.js expects 'typescript' written out instead of 'ts'.
2122
if (language == 'ts') {
@@ -30,5 +31,10 @@ fs.readFile(inputFile, 'utf8', (error, content) => {
3031
}
3132

3233
let highlighted = hljs.highlight(language, content);
34+
35+
let filename = path.basename(inputFile);
36+
filename = filename.slice(0, filename.lastIndexOf('.')) + '-' + extension + '.html';
37+
let outputFile = path.join(outputPath, filename);
38+
3339
fs.writeFile(outputFile, highlighted.value, {encoding: 'utf8'});
3440
});

0 commit comments

Comments
 (0)