Skip to content

Commit

Permalink
add complementary links
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeux committed Jul 30, 2014
1 parent 0e7eaf9 commit dee24b0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: API Reference
layout: docs
category: Reference
permalink: docs/api.html
next: react
---

#### The `jest` object
Expand Down Expand Up @@ -260,7 +261,7 @@ An object that, when present, indicates a set of files for which coverage inform
### `config.globals` [object]
(default: `{}`)

A set of global variables that need to be available in all test environments.
A set of global variables that need to be available in all test environments.

For example, the following would create a global `__DEV__` variable set to `true` in all test environments:

Expand Down
7 changes: 7 additions & 0 deletions docs/Flux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
id: flux
title: Flux – Application Architecture
layout: docs
category: Complementary
permalink: http://facebook.github.io/flux/
---
8 changes: 8 additions & 0 deletions docs/React.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: react
title: React – UI Library
layout: docs
category: Complementary
permalink: http://facebook.github.io/react/
next: flux
---
10 changes: 9 additions & 1 deletion website/core/DocsSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ var DocsSidebar = React.createClass({
return categories;
},

getLink: function(metadata) {
if (metadata.permalink.match(/^https?:/)) {
return metadata.permalink;
}
return '/jest/' + metadata.permalink + '#content';
},

render: function() {
return <div className="nav-docs">
{this.getCategories().map((category) =>
Expand All @@ -70,9 +77,10 @@ var DocsSidebar = React.createClass({
{category.links.map((metadata) =>
<li key={metadata.id}>
<a
target={metadata.permalink.match(/^https?:/) && '_blank'}
style={{marginLeft: metadata.indent ? 20 : 0}}
className={metadata.id === this.props.metadata.id ? 'active' : ''}
href={'/jest/' + metadata.permalink + '#content'}>
href={this.getLink(metadata)}>
{metadata.title}
</a>
</li>
Expand Down
6 changes: 5 additions & 1 deletion website/server/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,17 @@ function execute() {
for (var i = 0; i < lines.length - 1; ++i) {
var keyvalue = lines[i].split(':');
var key = keyvalue[0].trim();
var value = keyvalue[1].trim();
var value = keyvalue.slice(1).join(':').trim();
// Handle the case where you have "Community #10"
try { value = JSON.parse(value); } catch(e) { }
metadata[key] = value;
}
metadatas.files.push(metadata);

if (metadata.permalink.match(/^https?:/)) {
return;
}

// Create a dummy .js version that just calls the associated layout
var layout = metadata.layout[0].toUpperCase() + metadata.layout.substr(1) + 'Layout';

Expand Down

0 comments on commit dee24b0

Please sign in to comment.