@@ -47,7 +47,26 @@ function findNgDocInDir(directory, docNotify) {
4747 fs . readFile ( directory + '/' + file , docNotify . waitFor ( function ( err , content ) {
4848 if ( err ) return this . error ( err ) ;
4949 var section = '@section ' + directory . split ( '/' ) . pop ( ) + '\n' ;
50- docNotify ( section + content . toString ( ) , directory + '/' + file , 1 ) ;
50+
51+ //TEMPORARY FIX to strip stuff from the docs until gdocs api is fixed
52+ var text = content . toString ( ) ;
53+
54+ text = text . replace ( '\ufeff' , '' ) ;
55+ text = text . replace ( / \r \n / mg, '\n' ) ;
56+ text = text . replace ( / ^ / mg, ' ' ) ; //for some reason gdocs drop first space for indented lines
57+
58+ // strip out all text annotation comments
59+ text = text . replace ( / ^ \[ a \] [ \S \s ] * / m, '' ) ;
60+
61+ // strip out all text annotations
62+ text = text . replace ( / \[ \w { 1 , 3 } \] / mg, '' ) ;
63+
64+ // fix smart-quotes
65+ text = text . replace ( / [ “ ” ] / g, '"' ) ;
66+ text = text . replace ( / [ ‘ ’ ] / g, "'" ) ;
67+ //TEMPORARY FIX END
68+
69+ docNotify ( section + text , directory + '/' + file , 1 ) ;
5170 } ) ) ;
5271 } else if ( stats . isDirectory ( ) ) {
5372 findNgDocInDir ( directory + '/' + file , docNotify . waitFor ( docNotify ) ) ;
0 commit comments