Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(website): Add async-await.md and typescript.md to website (#…
Browse files Browse the repository at this point in the history
…4081)

Had to fix link parsing in website generation while I was at it.

Also updated docs/toc.md, which was very out of date.
  • Loading branch information
sjelin authored Feb 8, 2017
1 parent d5d9393 commit 237593a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ Protractor Tests
Reference
- [Config File](/lib/config.ts)
- [Protractor API](/docs/api.md)
- [Style Guide](style-guide.md)
- [Protractor Syntax vs WebDriverJS Syntax](webdriver-vs-protractor.md)
- [Browser Support](/docs/browser-support.md)
- [Plugins](plugins.md)
- [Timeouts](/docs/timeouts.md)
- [The WebDriver Control Flow](/docs/control-flow.md)
- [Using TypeScript](typescript.md)
- [Using `async`/`await`](async-await.md)
- [How It Works](/docs/infrastructure.md)
- [Upgrading to Jasmine 2.x](/docs/jasmine-upgrade.md)
- [Mobile Setup](/docs/mobile-setup.md)
Expand Down
22 changes: 14 additions & 8 deletions website/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var path = require('path');
var concat = require('gulp-concat');
var connect = require('gulp-connect');
var del = require('del');
Expand Down Expand Up @@ -111,22 +112,27 @@ gulp.task('watch', function() {

// Transform md files to html.
gulp.task('markdown', function() {
var version = require('../package.json').version
gulp.src(['../docs/*.md', '!../docs/api.md'])
// Parse markdown.
.pipe(markdown())
// Fix urls which reference files only on github.
.pipe(replace(
/"(?:\/([\-\.\w\/]+)\/)?(\w+\.\w+(?:#.*)?)"/g,
function(match, path, file) {
var ext = file.match(/\w+\.(\w+)(?:#.*)?/)[1];
/(href|src)="(?:([\-\.\w\/]+)\/)?(\w+\.\w+(?:#.*)?)?"/g,
function(match, attr, folder, file) {
var ext = file ? file.match(/\w+\.(\w+)(?:#.*)?/)[1] : null;
// Don't process .md and .png files which are on the website
if (((ext == 'md') || (ext == 'png')) &&
!(path && ((path.substr(0,2) == '..') || (path[0] == '/')))) {
if (((ext == 'md') || (ext == 'png')) && (!folder ||
(path.resolve('/docs', folder).split('/')[1] == 'docs'))) {
return match;
}
path = path || 'docs';
return '"https://github.com/angular/protractor/blob/master/' +
path + '/' + file + '"';
if (!folder) {
folder = 'docs';
} else if (folder[0] == '/') {
folder = folder.slice(1);
}
return attr + '="https://github.com/angular/protractor/blob/' +
version + '/' + folder + '/' + (file || '') + '"';
}
))
// Fix in-page hash paths.
Expand Down
2 changes: 2 additions & 0 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<li><a tabindex="-1" href="#/plugins">Plugins</a></li>
<li><a tabindex="-1" href="#/timeouts">Timeouts</a></li>
<li><a tabindex="-1" href="#/control-flow">The WebDriver Control Flow</a></li>
<li><a tabindex="-1" href="#/typescript">Using TypeScript</a></li>
<li><a tabindex="-1" href="#/async-await">Using async/await</a></li>
<li><a tabindex="-1" href="#/infrastructure">How It Works</a></li>
<li><a tabindex="-1" href="#/jasmine-upgrade">Upgrading to Jasmine 2.x</a></li>
<li><a tabindex="-1" href="#/mobile-setup">Mobile Setup</a></li>
Expand Down
8 changes: 8 additions & 0 deletions website/js/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ angular.module('protractorApp').config(function($routeProvider) {
templateUrl: 'partials/mobile-setup.html',
controller: 'MarkdownCtrl'
}).
when('/typescript', {
templateUrl: 'partials/typescript.html',
controller: 'MarkdownCtrl'
}).
when('/async-await', {
templateUrl: 'partials/async-await.html',
controller: 'MarkdownCtrl'
}).
otherwise({
redirectTo: '/'
});
Expand Down
2 changes: 2 additions & 0 deletions website/test/e2e/navigation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ describe('Navigation', function() {
'Plugins',
'Timeouts',
'The WebDriver Control Flow',
'Using TypeScript',
'Using async/await',
'How It Works',
'Upgrading to Jasmine 2.x',
'Mobile Setup',
Expand Down

0 comments on commit 237593a

Please sign in to comment.