-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of the automatically generated docs
- Loading branch information
Showing
10 changed files
with
169 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/react-native/docs/** | ||
core/metadata.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* @providesModule slugify | ||
*/ | ||
|
||
var slugify = function(string) { | ||
// var accents = 'àáäâèéëêìíïîòóöôùúüûñç'; | ||
var accents = '\u00e0\u00e1\u00e4\u00e2\u00e8' + | ||
'\u00e9\u00eb\u00ea\u00ec\u00ed\u00ef' + | ||
'\u00ee\u00f2\u00f3\u00f6\u00f4\u00f9' + | ||
'\u00fa\u00fc\u00fb\u00f1\u00e7'; | ||
|
||
var without = 'aaaaeeeeiiiioooouuuunc'; | ||
|
||
return string | ||
.toString() | ||
|
||
// Handle uppercase characters | ||
.toLowerCase() | ||
|
||
// Handle accentuated characters | ||
.replace( | ||
new RegExp('[' + accents + ']', 'g'), | ||
function (c) { return without.charAt(accents.indexOf(c)); }) | ||
|
||
// Dash special characters | ||
.replace(/[^a-z0-9]/g, '-') | ||
|
||
// Compress multiple dash | ||
.replace(/-+/g, '-') | ||
|
||
// Trim dashes | ||
.replace(/^-|-$/g, ''); | ||
}; | ||
|
||
module.exports = slugify; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var docs = require('../react-docgen'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var slugify = require('../core/slugify'); | ||
|
||
function getNameFromPath(filepath) { | ||
var ext = null; | ||
while (ext = path.extname(filepath)) { | ||
filepath = path.basename(filepath, ext); | ||
} | ||
return filepath; | ||
} | ||
|
||
function docsToMarkdown(filepath, i) { | ||
var json = docs.parseSource(fs.readFileSync(filepath)); | ||
var componentName = getNameFromPath(filepath); | ||
|
||
var res = [ | ||
'---', | ||
'id: ' + slugify(componentName), | ||
'title: ' + componentName, | ||
'layout: docs', | ||
'category: Components', | ||
'permalink: docs/' + slugify(componentName) + '.html', | ||
components[i + 1] && ('next: ' + slugify(getNameFromPath(components[i + 1]))), | ||
'---', | ||
' ', | ||
json.description, | ||
' ', | ||
'# Props', | ||
'```', | ||
JSON.stringify(json.props, null, 2), | ||
'```', | ||
].filter(function(line) { return line; }).join('\n'); | ||
return res; | ||
} | ||
|
||
var components = [ | ||
'../Libraries/Components/Navigation/NavigatorIOS.ios.js', | ||
'../Libraries/Components/Image/Image.ios.js', | ||
'../Libraries/Components/ListView/ListView.js', | ||
'../Libraries/Components/Navigation/NavigatorIOS.ios.js', | ||
'../Libraries/Components/ScrollView/ScrollView.ios.js', | ||
'../Libraries/Components/Text/Text.js', | ||
'../Libraries/Components/TextInput/TextInput.ios.js', | ||
'../Libraries/Components/Touchable/TouchableHighlight.js', | ||
'../Libraries/Components/Touchable/TouchableWithoutFeedback.js', | ||
// '../Libraries/Components/View/View.js', | ||
]; | ||
|
||
module.exports = function() { | ||
return components.map(docsToMarkdown); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
70f2833
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.