This repository has been archived by the owner on Dec 4, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: ability to generate plunkers for API
- Loading branch information
Showing
14 changed files
with
301 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
public/resources/images/icons/ic_keyboard_arrow_right_black_24px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,4 +59,4 @@ module.exports = function(encodeCodeBlock) { | |
return str; | ||
}; | ||
|
||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tools/api-builder/links-package/inline-tag-defs/liveExample.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
var path = require('canonical-path'); | ||
var fs = require("fs"); | ||
|
||
/** | ||
* @dgService liveExampleInlineTagDef | ||
* @description | ||
* Process inline liveExample tags (of the form {@liveExample demo-path embedded }), | ||
* replacing them with a <live-example> directive. | ||
* Examples: | ||
* {@liveExample core/animation/ts/dsl } | ||
* {@liveExample core/di/ts/contentChildren embedded } | ||
* @kind function | ||
*/ | ||
module.exports = function liveExampleInlineTagDef(getLinkInfo, parseArgString, getApiFragmentFileName, createDocMessage, log) { | ||
return { | ||
name: 'liveExample', | ||
description: 'Process inline liveExample tags (of the form {@liveExample demo-path embedded }), replacing them with <live-example>', | ||
handler: function(doc, tagName, tagDescription) { | ||
|
||
var tagArgs = parseArgString(tagDescription); | ||
var unnamedArgs = tagArgs._; | ||
var relativePath = unnamedArgs[0] !== 'embedded' ? unnamedArgs[0] : unnamedArgs[1]; | ||
var embedded = unnamedArgs.indexOf('embedded') >= 0 ? 'embedded' : ''; | ||
var imgPath = tagArgs.img; | ||
|
||
// check if fragment file actually exists. | ||
var apiPlunkerFile = getApiPlunkerFile(relativePath); | ||
if ( !fs.existsSync(apiPlunkerFile)) { | ||
log.warn(createDocMessage(`Invalid example (unable to locate plunker file: ${apiPlunkerFile}`)); | ||
} | ||
|
||
return [ `<live-example api="${relativePath}" ${embedded} ${imgPath ? `img="${imgPath}"` : 'noimg'}></live-example>` ]; | ||
} | ||
}; | ||
}; | ||
|
||
function getApiPlunkerFile(relativePath) { | ||
return path.join('/resources/api-live-examples', `${relativePath}/plnkr.html`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Animations</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<!-- Polyfill for Web Animations --> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
|
||
<!-- Polyfill(s) for older browsers --> | ||
<script src="https://unpkg.com/core-js/client/shim.min.js"></script> | ||
|
||
<script src="https://unpkg.com/[email protected]?main=browser"></script> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/system.src.js"></script> | ||
|
||
<script src="systemjs.config.js"></script> | ||
<script> | ||
System.import('app').catch(function(err){ console.error(err); }); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<example-app> | ||
Loading... | ||
</example-app> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
|
||
import { AppModule } from './module.ts'; | ||
|
||
platformBrowserDynamic().bootstrapModule(AppModule); |
Oops, something went wrong.