Permalink
Browse files

move html_to_text from thunder to utils

  • Loading branch information...
1 parent 3c27a25 commit 55b7884979049f40249d0c7ed1a240ab6b87e96e @ben-lin ben-lin committed Jul 6, 2013
Showing with 12 additions and 17 deletions.
  1. +0 −4 Readme.md
  2. +0 −7 lib/thunder.js
  3. +12 −6 lib/utils.js
View
4 Readme.md
@@ -171,10 +171,6 @@ For advance usages please checkout the API block.
## API
-### thunder.html_to_text( input );
-
-Compile the HTML templates to JavaScript strings. It is only used for client-side templates.
-
#### Arguments
> input
View
7 lib/thunder.js
@@ -32,13 +32,6 @@
version : '0.1.6',
- // for client-side
- html_to_text : function ( input ){
- return input.
- replace( /\"/g, '\\\"' ).
- replace( /\n/g, '\\n\\\n' );
- },
-
compiled_text : function ( input, options ){
var arr = ( options && options.compress === true ?
// compress
View
18 lib/utils.js
@@ -7,11 +7,10 @@
* Utility functions for builing ommand line tools.
*/
-var fs = require( 'fs' );
-var mkdirp = require( 'mkdirp' );
-var rmdir = require( 'rmdir' );
-var color = require( 'cli-color' );
-var thunder = require( 'thunder' );
+var fs = require( 'fs' );
+var mkdirp = require( 'mkdirp' );
+var rmdir = require( 'rmdir' );
+var color = require( 'cli-color' );
module.exports = {
@@ -45,6 +44,13 @@ module.exports = {
return str;
},
+ // for client-side
+ html_to_text : function ( input ){
+ return input.
+ replace( /\"/g, '\\\"' ).
+ replace( /\n/g, '\\n\\\n' );
+ },
+
write : function ( layout, input_path, output_path, use_requirejs ){
var output_dir = output_path.replace( this.regex.file_name, '$1' );
var is_dir = output_dir === output_path;
@@ -62,7 +68,7 @@ module.exports = {
}
var src = fs.readFileSync( input_path, 'utf8' );
- var tmp = thunder.html_to_text( src );
+ var tmp = this.html_to_text( src );
var tpl = layout.replace( '__content__', tmp );
if( use_requirejs == 'false' ){

0 comments on commit 55b7884

Please sign in to comment.