removed cookbook prefix from filenames
Connor McSheffrey committed
Oct 13, 2013 at 20:03 UTC
95f3caaaa49ac66d17f60df89fa6c5ce1cb420a4
9 files changed
+30
-28
docs/Gruntfile.js
+6
-4
@@ -52,17 +52,19 @@ module.exports = function(grunt) {
52
53
componentNameCamelCase = componentName;
54
55
- componentNameUpperCase = componentName.toUpperCase().replace(/[\. ,:-]+/g, "_");
55
+ componentNameUpperCase = componentName.toUpperCase().replace(/[\. ,:-]+/g, "_").slice(6);
56
57
- componentNameCamelCase = componentNameCamelCase.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });
57
+
58
+
59
+ componentNameCamelCase = componentNameCamelCase.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() }).slice(5);
60
61
// Add code sample to live edit
60
- liveEditJS = '/**\n * @jsx React.DOM\n */\n\n var ' + componentNameUpperCase + '_COMPONENT = "' + matchedJS + '";\n React.renderComponent(\n ReactPlayground( {codeText:' + componentNameUpperCase + '_COMPONENT} ),\n document.getElementById("' + componentNameCamelCase + 'Example")\n );'
62
+ liveEditJS = '/**\n * @jsx React.DOM\n */\n\n var ' + componentNameUpperCase + '_COMPONENT = "' + matchedJS + '";\n React.renderComponent(\n ReactPlayground( {codeText:' + componentNameUpperCase + '_COMPONENT} ),\n document.getElementById("' + componentNameCamelCase + '")\n );'
63
console.log(componentName);
64
65
writeToLiveSampleJS(liveEditJS, componentName);
66
65
- writeToHTML(markdown, componentName);
67
+ // writeToHTML(markdown, componentName);
68
}
69
70
grunt.registerTask('makeLiveSamples', 'Create live edit JS file for code samples in React Cookbook entries', function() {
docs/js/cookbook/cb-02-inline-styles tip.js
+3
-3
@@ -2,7 +2,7 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_02-INLINE-STYLES TIP_COMPONENT = "
5
+ var INLINE_STYLES_TIP_COMPONENT = "
6
/** @jsx React.DOM */
7
8
var divStyle = {
@@ -14,6 +14,6 @@ var divStyle = {
14
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
15
";
16
React.renderComponent(
17
- ReactPlayground( {codeText:CB_02-INLINE-STYLES TIP_COMPONENT} ),
18
- document.getElementById("cb-02InlineStyles tipExample")
17
+ ReactPlayground( {codeText:INLINE_STYLES_TIP_COMPONENT} ),
18
+ document.getElementById("InlineStyles tip")
19
);
\ No newline at end of file
docs/js/cookbook/cb-02-inline-styles.js
+3
-3
@@ -2,7 +2,7 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_02-INLINE-STYLES_COMPONENT = "
5
+ var INLINE_STYLES_COMPONENT = "
6
/** @jsx React.DOM */
7
8
var divStyle = {
@@ -14,6 +14,6 @@ var divStyle = {
14
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
15
";
16
React.renderComponent(
17
- ReactPlayground( {codeText:CB_02-INLINE-STYLES_COMPONENT} ),
18
- document.getElementById("cb-02InlineStylesExample")
17
+ ReactPlayground( {codeText:INLINE_STYLES_COMPONENT} ),
18
+ document.getElementById("InlineStyles")
19
);
\ No newline at end of file
docs/js/cookbook/cb-03-if-else-in-JSX tip.js
+3
-3
@@ -2,7 +2,7 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_03-IF-ELSE-IN-JSX TIP_COMPONENT = "
5
+ var IF_ELSE_IN_JSX_TIP_COMPONENT = "
6
/** @jsx React.DOM */
7
8
// this
@@ -11,6 +11,6 @@ React.renderComponent(<div id="msg">Hello World!</div>, mountNode);
11
React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode);
12
";
13
React.renderComponent(
14
- ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX TIP_COMPONENT} ),
15
- document.getElementById("cb-03IfElseIn-JSX tipExample")
14
+ ReactPlayground( {codeText:IF_ELSE_IN_JSX_TIP_COMPONENT} ),
15
+ document.getElementById("IfElseIn-JSX tip")
16
);
\ No newline at end of file
docs/js/cookbook/cb-03-if-else-in-JSX.js
+3
-3
@@ -2,7 +2,7 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_03-IF-ELSE-IN-JSX_COMPONENT = "
5
+ var IF_ELSE_IN_JSX_COMPONENT = "
6
/** @jsx React.DOM */
7
8
// this
@@ -11,6 +11,6 @@ React.renderComponent(<div id="msg">Hello World!</div>, mountNode);
11
React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode);
12
";
13
React.renderComponent(
14
- ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX_COMPONENT} ),
15
- document.getElementById("cb-03IfElseIn-JSXExample")
14
+ ReactPlayground( {codeText:IF_ELSE_IN_JSX_COMPONENT} ),
15
+ document.getElementById("IfElseIn-JSX")
16
);
\ No newline at end of file
docs/js/cookbook/cb-06-style-prop-value-px tip.js
+3
-3
@@ -2,13 +2,13 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT = "
5
+ var STYLE_PROP_VALUE_PX_TIP_COMPONENT = "
6
/** @jsx React.DOM */
7
8
var divStyle = {height: 10}; // rendered as "height:10px"
9
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
10
";
11
React.renderComponent(
12
- ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT} ),
13
- document.getElementById("cb-06StylePropValuePx tipExample")
12
+ ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_TIP_COMPONENT} ),
13
+ document.getElementById("StylePropValuePx tip")
14
);
\ No newline at end of file
docs/js/cookbook/cb-06-style-prop-value-px.js
+3
-3
@@ -2,13 +2,13 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_06-STYLE-PROP-VALUE-PX_COMPONENT = "
5
+ var STYLE_PROP_VALUE_PX_COMPONENT = "
6
/** @jsx React.DOM */
7
8
var divStyle = {height: 10}; // rendered as "height:10px"
9
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
10
";
11
React.renderComponent(
12
- ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX_COMPONENT} ),
13
- document.getElementById("cb-06StylePropValuePxExample")
12
+ ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_COMPONENT} ),
13
+ document.getElementById("StylePropValuePx")
14
);
\ No newline at end of file
docs/js/cookbook/cb-08-controlled-input-null-value tip.js
+3
-3
@@ -2,7 +2,7 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT = "
5
+ var CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT = "
6
/** @jsx React.DOM */
7
8
React.renderComponent(<input value="hi" />, mountNode);
@@ -12,6 +12,6 @@ setTimeout(function() {
12
}, 2000);
13
";
14
React.renderComponent(
15
- ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT} ),
16
- document.getElementById("cb-08ControlledInputNullValue tipExample")
15
+ ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT} ),
16
+ document.getElementById("ControlledInputNullValue tip")
17
);
\ No newline at end of file
docs/js/cookbook/cb-08-controlled-input-null-value.js
+3
-3
@@ -2,7 +2,7 @@
2
* @jsx React.DOM
3
*/
4
5
- var CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT = "
5
+ var CONTROLLED_INPUT_NULL_VALUE_COMPONENT = "
6
/** @jsx React.DOM */
7
8
React.renderComponent(<input value="hi" />, mountNode);
@@ -12,6 +12,6 @@ setTimeout(function() {
12
}, 2000);
13
";
14
React.renderComponent(
15
- ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT} ),
16
- document.getElementById("cb-08ControlledInputNullValueExample")
15
+ ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_COMPONENT} ),
16
+ document.getElementById("ControlledInputNullValue")
17
);
\ No newline at end of file