From b9ab60719767bda61ca55e0f8e86a60bdebc9ec3 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Wed, 4 Mar 2015 21:03:24 -0800 Subject: [PATCH] Use docs/ComponentName.md at the end of the component docs --- website/core/Marked.js | 4 +++- website/layout/AutodocsLayout.js | 8 ++++++-- website/server/extractDocs.js | 11 ++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/website/core/Marked.js b/website/core/Marked.js index f9baeaf49..f7f6c5007 100644 --- a/website/core/Marked.js +++ b/website/core/Marked.js @@ -1085,7 +1085,9 @@ marked.parse = marked; var Marked = React.createClass({ render: function() { - return React.DOM.div(null, marked(this.props.children, this.props)); + return this.props.children ? + React.DOM.div(null, marked(this.props.children, this.props)) : + null; } }); diff --git a/website/layout/AutodocsLayout.js b/website/layout/AutodocsLayout.js index 7ec0846d7..9ff344199 100644 --- a/website/layout/AutodocsLayout.js +++ b/website/layout/AutodocsLayout.js @@ -17,8 +17,9 @@ var Autodocs = React.createClass({
{name} {' '} - {prop.type.name}
- {prop.description} + {prop.type && {prop.type.name}} + + {prop.description && {prop.description}} ); }, @@ -43,6 +44,9 @@ var Autodocs = React.createClass({ {content.description} {this.renderProps(content.props)} + + {content.fullDescription} +
{metadata.previous && ← Prev} {metadata.next && Next →} diff --git a/website/server/extractDocs.js b/website/server/extractDocs.js index db59a25e1..095a9ac1a 100644 --- a/website/server/extractDocs.js +++ b/website/server/extractDocs.js @@ -19,9 +19,13 @@ function docsToMarkdown(filepath, i) { docs.resolver.findAllReactCreateClassCalls(node, recast)[0]; } ); - var componentName = getNameFromPath(filepath); + var docFilePath = '../docs/' + componentName + '.md'; + if (fs.existsSync(docFilePath)) { + json.fullDescription = fs.readFileSync(docFilePath).toString(); + } + var res = [ '---', 'id: ' + slugify(componentName), @@ -37,15 +41,16 @@ function docsToMarkdown(filepath, i) { } var components = [ - '../Libraries/Components/Navigation/NavigatorIOS.ios.js', + '../Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js', + '../Libraries/Text/ExpandingText.js', '../Libraries/Image/Image.ios.js', '../Libraries/Components/ListView/ListView.js', '../Libraries/Components/Navigation/NavigatorIOS.ios.js', '../Libraries/Components/ScrollView/ScrollView.ios.js', '../Libraries/Text/Text.js', - '../Libraries/Image/Image.ios.js', '../Libraries/Components/TextInput/TextInput.ios.js', '../Libraries/Components/Touchable/TouchableHighlight.js', + '../Libraries/Components/Touchable/TouchableOpacity.js', '../Libraries/Components/Touchable/TouchableWithoutFeedback.js', '../Libraries/Components/View/View.js', ];