X Tutup
Skip to content

Commit 525e444

Browse files
committed
temporary hack to strip all the extra chars from google docs
1 parent fd11287 commit 525e444

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/src/reader.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
X Tutup