aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2011-05-02 10:18:04 -0700
committerIgor Minar2011-06-06 22:28:38 -0700
commit525e444a0faf41ae58499c5d3ab0ae32a05895b5 (patch)
treee98d22a695ef2354d0e46124d63fe6f20eb6187b
parentfd112877f8814405d005761097c2d2fcb2ca6310 (diff)
downloadangular.js-525e444a0faf41ae58499c5d3ab0ae32a05895b5.tar.bz2
temporary hack to strip all the extra chars from google docs
-rw-r--r--docs/src/reader.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/src/reader.js b/docs/src/reader.js
index f20bc06e..e1a4c586 100644
--- a/docs/src/reader.js
+++ b/docs/src/reader.js
@@ -47,7 +47,26 @@ function findNgDocInDir(directory, docNotify) {
fs.readFile(directory + '/' + file, docNotify.waitFor(function(err, content){
if (err) return this.error(err);
var section = '@section ' + directory.split('/').pop() + '\n';
- docNotify(section + content.toString(), directory + '/' +file, 1);
+
+ //TEMPORARY FIX to strip stuff from the docs until gdocs api is fixed
+ var text = content.toString();
+
+ text = text.replace('\ufeff', '');
+ text = text.replace(/\r\n/mg, '\n');
+ text = text.replace(/^ /mg, ' '); //for some reason gdocs drop first space for indented lines
+
+ // strip out all text annotation comments
+ text = text.replace(/^\[a\][\S\s]*/m, '');
+
+ // strip out all text annotations
+ text = text.replace(/\[\w{1,3}\]/mg, '');
+
+ // fix smart-quotes
+ text = text.replace(/[“”]/g, '"');
+ text = text.replace(/[‘’]/g, "'");
+ //TEMPORARY FIX END
+
+ docNotify(section + text, directory + '/' +file, 1);
}));
} else if(stats.isDirectory()) {
findNgDocInDir(directory + '/' + file, docNotify.waitFor(docNotify));