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

Commit 237593a

Browse files
authored
chore(website): Add async-await.md and typescript.md to website (#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.
1 parent d5d9393 commit 237593a

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

docs/toc.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ Protractor Tests
1919
Reference
2020
- [Config File](/lib/config.ts)
2121
- [Protractor API](/docs/api.md)
22+
- [Style Guide](style-guide.md)
23+
- [Protractor Syntax vs WebDriverJS Syntax](webdriver-vs-protractor.md)
2224
- [Browser Support](/docs/browser-support.md)
25+
- [Plugins](plugins.md)
2326
- [Timeouts](/docs/timeouts.md)
2427
- [The WebDriver Control Flow](/docs/control-flow.md)
28+
- [Using TypeScript](typescript.md)
29+
- [Using `async`/`await`](async-await.md)
2530
- [How It Works](/docs/infrastructure.md)
2631
- [Upgrading to Jasmine 2.x](/docs/jasmine-upgrade.md)
2732
- [Mobile Setup](/docs/mobile-setup.md)

website/gulpfile.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var path = require('path');
12
var concat = require('gulp-concat');
23
var connect = require('gulp-connect');
34
var del = require('del');
@@ -111,22 +112,27 @@ gulp.task('watch', function() {
111112

112113
// Transform md files to html.
113114
gulp.task('markdown', function() {
115+
var version = require('../package.json').version
114116
gulp.src(['../docs/*.md', '!../docs/api.md'])
115117
// Parse markdown.
116118
.pipe(markdown())
117119
// Fix urls which reference files only on github.
118120
.pipe(replace(
119-
/"(?:\/([\-\.\w\/]+)\/)?(\w+\.\w+(?:#.*)?)"/g,
120-
function(match, path, file) {
121-
var ext = file.match(/\w+\.(\w+)(?:#.*)?/)[1];
121+
/(href|src)="(?:([\-\.\w\/]+)\/)?(\w+\.\w+(?:#.*)?)?"/g,
122+
function(match, attr, folder, file) {
123+
var ext = file ? file.match(/\w+\.(\w+)(?:#.*)?/)[1] : null;
122124
// Don't process .md and .png files which are on the website
123-
if (((ext == 'md') || (ext == 'png')) &&
124-
!(path && ((path.substr(0,2) == '..') || (path[0] == '/')))) {
125+
if (((ext == 'md') || (ext == 'png')) && (!folder ||
126+
(path.resolve('/docs', folder).split('/')[1] == 'docs'))) {
125127
return match;
126128
}
127-
path = path || 'docs';
128-
return '"https://github.com/angular/protractor/blob/master/' +
129-
path + '/' + file + '"';
129+
if (!folder) {
130+
folder = 'docs';
131+
} else if (folder[0] == '/') {
132+
folder = folder.slice(1);
133+
}
134+
return attr + '="https://github.com/angular/protractor/blob/' +
135+
version + '/' + folder + '/' + (file || '') + '"';
130136
}
131137
))
132138
// Fix in-page hash paths.

website/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
<li><a tabindex="-1" href="#/plugins">Plugins</a></li>
7676
<li><a tabindex="-1" href="#/timeouts">Timeouts</a></li>
7777
<li><a tabindex="-1" href="#/control-flow">The WebDriver Control Flow</a></li>
78+
<li><a tabindex="-1" href="#/typescript">Using TypeScript</a></li>
79+
<li><a tabindex="-1" href="#/async-await">Using async/await</a></li>
7880
<li><a tabindex="-1" href="#/infrastructure">How It Works</a></li>
7981
<li><a tabindex="-1" href="#/jasmine-upgrade">Upgrading to Jasmine 2.x</a></li>
8082
<li><a tabindex="-1" href="#/mobile-setup">Mobile Setup</a></li>

website/js/routes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ angular.module('protractorApp').config(function($routeProvider) {
9797
templateUrl: 'partials/mobile-setup.html',
9898
controller: 'MarkdownCtrl'
9999
}).
100+
when('/typescript', {
101+
templateUrl: 'partials/typescript.html',
102+
controller: 'MarkdownCtrl'
103+
}).
104+
when('/async-await', {
105+
templateUrl: 'partials/async-await.html',
106+
controller: 'MarkdownCtrl'
107+
}).
100108
otherwise({
101109
redirectTo: '/'
102110
});

website/test/e2e/navigation_spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ describe('Navigation', function() {
6767
'Plugins',
6868
'Timeouts',
6969
'The WebDriver Control Flow',
70+
'Using TypeScript',
71+
'Using async/await',
7072
'How It Works',
7173
'Upgrading to Jasmine 2.x',
7274
'Mobile Setup',

0 commit comments

Comments
 (0)