Fixed relative links in generated docs

Summary:Relative links did not have 'docs/' prefix, so all of them lead to 404 page.
Fixes #5964
Closes https://github.com/facebook/react-native/pull/5975

Differential Revision: D2943886

Pulled By: androidtrunkagent

fb-gh-sync-id: dbc2355ecf7ea4f1dea0f8f6a5ef50e5f324dfda
shipit-source-id: dbc2355ecf7ea4f1dea0f8f6a5ef50e5f324dfda
This commit is contained in:
Konstantin Raev 2016-02-17 07:30:04 -08:00 committed by facebook-github-bot-5
parent 1e8991aa80
commit f73f41779a
2 changed files with 7 additions and 7 deletions

View File

@ -56,10 +56,10 @@ function renderType(type) {
if (type.name === 'custom') { if (type.name === 'custom') {
if (styleReferencePattern.test(type.raw)) { if (styleReferencePattern.test(type.raw)) {
var name = type.raw.substring(0, type.raw.indexOf('.')); var name = type.raw.substring(0, type.raw.indexOf('.'));
return <a href={slugify(name) + '.html#style'}>{name}#style</a> return <a href={'docs/' + slugify(name) + '.html#style'}>{name}#style</a>
} }
if (type.raw === 'ColorPropType') { if (type.raw === 'ColorPropType') {
return <a href={'colors.html'}>color</a> return <a href={'docs/colors.html'}>color</a>
} }
if (type.raw === 'EdgeInsetsPropType') { if (type.raw === 'EdgeInsetsPropType') {
return '{top: number, left: number, bottom: number, right: number}'; return '{top: number, left: number, bottom: number, right: number}';
@ -140,7 +140,7 @@ var ComponentDoc = React.createClass({
return ( return (
<div className="prop" key={name}> <div className="prop" key={name}>
<Header level={4} className="propTitle" toSlug={name}> <Header level={4} className="propTitle" toSlug={name}>
<a href={slugify(name) + '.html#props'}>{name} props...</a> <a href={'docs/' + slugify(name) + '.html#props'}>{name} props...</a>
</Header> </Header>
</div> </div>
); );
@ -506,8 +506,8 @@ var Autodocs = React.createClass({
{this.renderFullDescription(docs)} {this.renderFullDescription(docs)}
{this.renderExample(docs, metadata)} {this.renderExample(docs, metadata)}
<div className="docs-prevnext"> <div className="docs-prevnext">
{metadata.previous && <a className="docs-prev" href={metadata.previous + '.html#content'}>&larr; Prev</a>} {metadata.previous && <a className="docs-prev" href={'docs/' + metadata.previous + '.html#content'}>&larr; Prev</a>}
{metadata.next && <a className="docs-next" href={metadata.next + '.html#content'}>Next &rarr;</a>} {metadata.next && <a className="docs-next" href={'docs/' + metadata.next + '.html#content'}>Next &rarr;</a>}
</div> </div>
</div> </div>

View File

@ -32,8 +32,8 @@ var DocsLayout = React.createClass({
/> />
<Marked>{content}</Marked> <Marked>{content}</Marked>
<div className="docs-prevnext"> <div className="docs-prevnext">
{metadata.previous && <a className="docs-prev" href={metadata.previous + '.html#content'}>&larr; Prev</a>} {metadata.previous && <a className="docs-prev" href={'docs/' + metadata.previous + '.html#content'}>&larr; Prev</a>}
{metadata.next && <a className="docs-next" href={metadata.next + '.html#content'}>Next &rarr;</a>} {metadata.next && <a className="docs-next" href={'docs/' + metadata.next + '.html#content'}>Next &rarr;</a>}
</div> </div>
</div> </div>
</section> </section>