6
6
* Original author of this script: [email protected]
7
7
*/
8
8
9
-
10
9
var fs = require ( "fs" ) ;
11
- // var doclistPath = '/Users/sperberx/dev/essential-javascript-links/misc/';
12
- // var doclistName = 'README-short1';
13
- // var doclistAddon = '-new';
14
- // var doclistExtension = '.md';
15
-
16
- /*
17
- files I'm testing with
18
- /Users/sperberx/dev/essential-javascript-links/misc/some-wrong-apos.md
19
- /Users/sperberx/dev/essential-javascript-links/README.md
20
- /Users/sperberx/dev/essential-javascript-links/misc/README-ee.md
21
- /Users/sperberx/dev/essential-javascript-links/misc/README-short1.md
22
- */
23
-
24
10
25
11
// identify each type of change, particularly for the apostrophe, since global change (e.g., /.'./g or /(\w|\d)'(\w|\d)/g) is just too risky
26
12
// By making only known changes, stray apostrophes and quotes can be located easily
@@ -41,11 +27,7 @@ var replacements = [
41
27
{ searchFor : / \b " / g, replaceWith : '”' } , // close quote (eg, is preceded by a 'word boundary') needs to be set to follow punctuation as well
42
28
{ searchFor : / - / g, replaceWith : " — " } // em dash
43
29
] ;
44
-
45
- /* store components of path */
46
- // var pathAndFile = doclistPath + doclistName + doclistExtension; // /Users/sperberx/dev/essential-javascript-links/README.md
47
- // var pathAndFileNew = doclistPath + doclistName+ doclistAddon + doclistExtension; // /Users/sperberx/dev/essential-javascript-links/README-new.md
48
-
30
+ // using package.json script: cleanup to read README.md via cat
49
31
var aFile = fs . readFile ( '/dev/stdin' , 'utf8' , function ( err , data ) {
50
32
if ( err ) {
51
33
return console . log ( err ) ;
@@ -59,14 +41,7 @@ var aFile = fs.readFile('/dev/stdin', 'utf8', function (err,data) {
59
41
return someFile ;
60
42
}
61
43
var result = cleanUp ( data ) ;
62
-
44
+ // now pipe the result to be stored in build/README.md
63
45
console . log ( result ) ;
64
- // console.log('got result back');
65
-
66
- // fs.writeFile(pathAndFileNew, result, function (err) {
67
- // if (err) throw err;
68
- // console.log('It\'s saved!');
69
- // });
70
46
71
47
} ) ;
72
-
0 commit comments