docs(aio): adjust zips/plunker paths

This commit is contained in:
Jesus Rodriguez 2017-04-20 13:33:31 +02:00 committed by Pete Bacon Darwin
parent d855e90524
commit 4598af23c0
6 changed files with 18 additions and 7 deletions

View File

@ -26,7 +26,7 @@ You'll pursue these ends in the following high-level steps:
3. [Serve](guide/cli-quickstart#serve) the application. 3. [Serve](guide/cli-quickstart#serve) the application.
4. [Edit](guide/cli-quickstart#first-component) the application. 4. [Edit](guide/cli-quickstart#first-component) the application.
And you can also <a href="/resources/zips/cli-quickstart/cli-quickstart.zip">download the example.</a> And you can also <a href="/content/zips/cli-quickstart/cli-quickstart.zip" target="_blank">download the example.</a>

View File

@ -34,7 +34,7 @@ can read and write Angular apps in their preferred dialect.
* [View and Child Decorators](guide/ts-to-js#view-child-decorators)<br> * [View and Child Decorators](guide/ts-to-js#view-child-decorators)<br>
* [AOT compilation in _TypeScript_ Only](guide/ts-to-js#aot)<br> * [AOT compilation in _TypeScript_ Only](guide/ts-to-js#aot)<br>
**Run and compare the live <live-example name="cb-ts-to-js">TypeScript</live-example> and <live-example name="cb-ts-to-js" lang="js">JavaScript</live-example> **Run and compare the live <live-example name="cb-ts-to-js/ts">TypeScript</live-example> and <live-example name="cb-ts-to-js/js">JavaScript</live-example>
code shown in this cookbook.** code shown in this cookbook.**

View File

@ -57,7 +57,7 @@ This guide offers a taste of Webpack and explains how to use it with Angular app
* [Highlights](guide/webpack#highlights) * [Highlights](guide/webpack#highlights)
* [Conclusion](guide/webpack#conclusion) * [Conclusion](guide/webpack#conclusion)
You can also <a href="/resources/zips/webpack/webpack.zip">download the final result.</a> You can also <a href="/content/zips/webpack/webpack.zip" target="_blank">download the final result.</a>
{@a what-is-webpack} {@a what-is-webpack}

View File

@ -200,6 +200,15 @@ describe('LiveExampleComponent', () => {
expect(anchor.getAttribute('title')).toBe(liveExampleContent, 'title'); expect(anchor.getAttribute('title')).toBe(liveExampleContent, 'title');
}); });
})); }));
it('should not duplicate the exampleDir on a zip when there is a / on the name', async(() => {
setHostTemplate('<live-example name="testing/ts"></live-example>');
testComponent(() => {
const hrefs = getHrefs();
expect(hrefs[0]).toContain('/testing/ts/eplnkr.html');
expect(hrefs[1]).toContain('/testing/ts/testing.zip');
});
}));
}); });
describe('when embedded', () => { describe('when embedded', () => {

View File

@ -80,6 +80,7 @@ export class LiveExampleComponent implements OnInit {
showEmbedded = false; showEmbedded = false;
title: string; title: string;
zip: string; zip: string;
zipName: string;
constructor( constructor(
private elementRef: ElementRef, private elementRef: ElementRef,
@ -92,8 +93,9 @@ export class LiveExampleComponent implements OnInit {
exampleDir = location.path(false).match(/[^\/?\#]+(?=\/?(?:$|\#|\?))/)[0]; exampleDir = location.path(false).match(/[^\/?\#]+(?=\/?(?:$|\#|\?))/)[0];
} }
this.exampleDir = exampleDir.trim(); this.exampleDir = exampleDir.trim();
this.zipName = exampleDir.indexOf('/') === -1 ? this.exampleDir : exampleDir.split('/')[0];
this.plnkrName = attrs.plnkr ? attrs.plnkr.trim() + '.' : ''; this.plnkrName = attrs.plnkr ? attrs.plnkr.trim() + '.' : '';
this.zip = `${zipBase}${exampleDir}/${this.plnkrName}${exampleDir}.zip`; this.zip = `${zipBase}${exampleDir}/${this.plnkrName}${this.zipName}.zip`;
const noDownload = this.getAttrValue(['noDownload', 'nodownload']); // noDownload aliases const noDownload = this.getAttrValue(['noDownload', 'nodownload']); // noDownload aliases
this.enableDownload = !boolFromAtty(noDownload); this.enableDownload = !boolFromAtty(noDownload);

View File

@ -56,7 +56,7 @@ class ExampleZipper {
let exampleZipName; let exampleZipName;
if (relativeDirName.indexOf('/') !== -1) { // Special example if (relativeDirName.indexOf('/') !== -1) { // Special example
[relativeDirName, exampleZipName] = relativeDirName.split('/'); exampleZipName = relativeDirName.split('/')[0];
} else { } else {
exampleZipName = jsonFileName.replace(/(plnkr|zipper).json/, relativeDirName); exampleZipName = jsonFileName.replace(/(plnkr|zipper).json/, relativeDirName);
} }