Browse Source

removed cookbook prefix from filenames

main
Connor McSheffrey 11 years ago
parent
commit
b18b0c9c9a
  1. 10
      Gruntfile.js
  2. 6
      js/cookbook/cb-02-inline-styles tip.js
  3. 6
      js/cookbook/cb-02-inline-styles.js
  4. 6
      js/cookbook/cb-03-if-else-in-JSX tip.js
  5. 6
      js/cookbook/cb-03-if-else-in-JSX.js
  6. 6
      js/cookbook/cb-06-style-prop-value-px tip.js
  7. 6
      js/cookbook/cb-06-style-prop-value-px.js
  8. 6
      js/cookbook/cb-08-controlled-input-null-value tip.js
  9. 6
      js/cookbook/cb-08-controlled-input-null-value.js

10
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() {

6
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(<div style={divStyle}>Hello World!</div>, 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")
);

6
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(<div style={divStyle}>Hello World!</div>, mountNode);
";
React.renderComponent(
ReactPlayground( {codeText:CB_02-INLINE-STYLES_COMPONENT} ),
document.getElementById("cb-02InlineStylesExample")
ReactPlayground( {codeText:INLINE_STYLES_COMPONENT} ),
document.getElementById("InlineStyles")
);

6
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(<div id="msg">Hello World!</div>, 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")
);

6
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(<div id="msg">Hello World!</div>, 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")
);

6
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(<div style={divStyle}>Hello World!</div>, 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")
);

6
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(<div style={divStyle}>Hello World!</div>, 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")
);

6
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(<input value="hi" />, 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")
);

6
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(<input value="hi" />, 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")
);
Loading…
Cancel
Save