diff --git a/Gruntfile.js b/Gruntfile.js
index 164138c3..59c910bf 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -52,17 +52,19 @@ module.exports = function(grunt) {
componentNameCamelCase = componentName;
- componentNameUpperCase = componentName.toUpperCase().replace(/[\. ,:-]+/g, "_");
+ componentNameUpperCase = componentName.toUpperCase().replace(/[\. ,:-]+/g, "_").slice(6);
- componentNameCamelCase = componentNameCamelCase.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });
+
+
+ componentNameCamelCase = componentNameCamelCase.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() }).slice(5);
// Add code sample to live edit
- 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 );'
+ 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 );'
console.log(componentName);
writeToLiveSampleJS(liveEditJS, componentName);
- writeToHTML(markdown, componentName);
+ // writeToHTML(markdown, componentName);
}
grunt.registerTask('makeLiveSamples', 'Create live edit JS file for code samples in React Cookbook entries', function() {
diff --git a/js/cookbook/cb-02-inline-styles tip.js b/js/cookbook/cb-02-inline-styles tip.js
index d66547de..11150581 100644
--- a/js/cookbook/cb-02-inline-styles tip.js
+++ b/js/cookbook/cb-02-inline-styles tip.js
@@ -2,7 +2,7 @@
* @jsx React.DOM
*/
- var CB_02-INLINE-STYLES TIP_COMPONENT = "
+ var INLINE_STYLES_TIP_COMPONENT = "
/** @jsx React.DOM */
var divStyle = {
@@ -14,6 +14,6 @@ var divStyle = {
React.renderComponent(
Hello World!
, mountNode);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_02-INLINE-STYLES TIP_COMPONENT} ),
- document.getElementById("cb-02InlineStyles tipExample")
+ ReactPlayground( {codeText:INLINE_STYLES_TIP_COMPONENT} ),
+ document.getElementById("InlineStyles tip")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-02-inline-styles.js b/js/cookbook/cb-02-inline-styles.js
index 8d38ca13..b01b79ed 100644
--- a/js/cookbook/cb-02-inline-styles.js
+++ b/js/cookbook/cb-02-inline-styles.js
@@ -2,7 +2,7 @@
* @jsx React.DOM
*/
- var CB_02-INLINE-STYLES_COMPONENT = "
+ var INLINE_STYLES_COMPONENT = "
/** @jsx React.DOM */
var divStyle = {
@@ -14,6 +14,6 @@ var divStyle = {
React.renderComponent(Hello World!
, mountNode);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_02-INLINE-STYLES_COMPONENT} ),
- document.getElementById("cb-02InlineStylesExample")
+ ReactPlayground( {codeText:INLINE_STYLES_COMPONENT} ),
+ document.getElementById("InlineStyles")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-03-if-else-in-JSX tip.js b/js/cookbook/cb-03-if-else-in-JSX tip.js
index 4726ee18..2542f833 100644
--- a/js/cookbook/cb-03-if-else-in-JSX tip.js
+++ b/js/cookbook/cb-03-if-else-in-JSX tip.js
@@ -2,7 +2,7 @@
* @jsx React.DOM
*/
- var CB_03-IF-ELSE-IN-JSX TIP_COMPONENT = "
+ var IF_ELSE_IN_JSX_TIP_COMPONENT = "
/** @jsx React.DOM */
// this
@@ -11,6 +11,6 @@ React.renderComponent(Hello World!
, mountNode);
React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX TIP_COMPONENT} ),
- document.getElementById("cb-03IfElseIn-JSX tipExample")
+ ReactPlayground( {codeText:IF_ELSE_IN_JSX_TIP_COMPONENT} ),
+ document.getElementById("IfElseIn-JSX tip")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-03-if-else-in-JSX.js b/js/cookbook/cb-03-if-else-in-JSX.js
index f229ce33..c5ad0e52 100644
--- a/js/cookbook/cb-03-if-else-in-JSX.js
+++ b/js/cookbook/cb-03-if-else-in-JSX.js
@@ -2,7 +2,7 @@
* @jsx React.DOM
*/
- var CB_03-IF-ELSE-IN-JSX_COMPONENT = "
+ var IF_ELSE_IN_JSX_COMPONENT = "
/** @jsx React.DOM */
// this
@@ -11,6 +11,6 @@ React.renderComponent(Hello World!
, mountNode);
React.renderComponent(React.DOM.div({id:"msg"}, "Hello World!"), mountNode);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_03-IF-ELSE-IN-JSX_COMPONENT} ),
- document.getElementById("cb-03IfElseIn-JSXExample")
+ ReactPlayground( {codeText:IF_ELSE_IN_JSX_COMPONENT} ),
+ document.getElementById("IfElseIn-JSX")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-06-style-prop-value-px tip.js b/js/cookbook/cb-06-style-prop-value-px tip.js
index 6bfcda2c..38e951ab 100644
--- a/js/cookbook/cb-06-style-prop-value-px tip.js
+++ b/js/cookbook/cb-06-style-prop-value-px tip.js
@@ -2,13 +2,13 @@
* @jsx React.DOM
*/
- var CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT = "
+ var STYLE_PROP_VALUE_PX_TIP_COMPONENT = "
/** @jsx React.DOM */
var divStyle = {height: 10}; // rendered as "height:10px"
React.renderComponent(Hello World!
, mountNode);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX TIP_COMPONENT} ),
- document.getElementById("cb-06StylePropValuePx tipExample")
+ ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_TIP_COMPONENT} ),
+ document.getElementById("StylePropValuePx tip")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-06-style-prop-value-px.js b/js/cookbook/cb-06-style-prop-value-px.js
index d80cfd40..90b91d66 100644
--- a/js/cookbook/cb-06-style-prop-value-px.js
+++ b/js/cookbook/cb-06-style-prop-value-px.js
@@ -2,13 +2,13 @@
* @jsx React.DOM
*/
- var CB_06-STYLE-PROP-VALUE-PX_COMPONENT = "
+ var STYLE_PROP_VALUE_PX_COMPONENT = "
/** @jsx React.DOM */
var divStyle = {height: 10}; // rendered as "height:10px"
React.renderComponent(Hello World!
, mountNode);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_06-STYLE-PROP-VALUE-PX_COMPONENT} ),
- document.getElementById("cb-06StylePropValuePxExample")
+ ReactPlayground( {codeText:STYLE_PROP_VALUE_PX_COMPONENT} ),
+ document.getElementById("StylePropValuePx")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-08-controlled-input-null-value tip.js b/js/cookbook/cb-08-controlled-input-null-value tip.js
index 2351da9a..41a42fb6 100644
--- a/js/cookbook/cb-08-controlled-input-null-value tip.js
+++ b/js/cookbook/cb-08-controlled-input-null-value tip.js
@@ -2,7 +2,7 @@
* @jsx React.DOM
*/
- var CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT = "
+ var CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT = "
/** @jsx React.DOM */
React.renderComponent(, mountNode);
@@ -12,6 +12,6 @@ setTimeout(function() {
}, 2000);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE TIP_COMPONENT} ),
- document.getElementById("cb-08ControlledInputNullValue tipExample")
+ ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_TIP_COMPONENT} ),
+ document.getElementById("ControlledInputNullValue tip")
);
\ No newline at end of file
diff --git a/js/cookbook/cb-08-controlled-input-null-value.js b/js/cookbook/cb-08-controlled-input-null-value.js
index 18e37c59..cfd03189 100644
--- a/js/cookbook/cb-08-controlled-input-null-value.js
+++ b/js/cookbook/cb-08-controlled-input-null-value.js
@@ -2,7 +2,7 @@
* @jsx React.DOM
*/
- var CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT = "
+ var CONTROLLED_INPUT_NULL_VALUE_COMPONENT = "
/** @jsx React.DOM */
React.renderComponent(, mountNode);
@@ -12,6 +12,6 @@ setTimeout(function() {
}, 2000);
";
React.renderComponent(
- ReactPlayground( {codeText:CB_08-CONTROLLED-INPUT-NULL-VALUE_COMPONENT} ),
- document.getElementById("cb-08ControlledInputNullValueExample")
+ ReactPlayground( {codeText:CONTROLLED_INPUT_NULL_VALUE_COMPONENT} ),
+ document.getElementById("ControlledInputNullValue")
);
\ No newline at end of file