|
|
@ -100,8 +100,18 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var text = '';
|
|
|
|
var text = '';
|
|
|
|
lines.some(function (line) {
|
|
|
|
lines.some(function (line) {
|
|
|
|
|
|
|
|
// lines including a c-style comment are also valuable
|
|
|
|
|
|
|
|
var clike = /^\s*(\/\*|\/\/)(.*)?(\*\/)*$/;
|
|
|
|
|
|
|
|
if (clike.test(line)) {
|
|
|
|
|
|
|
|
line.replace(clike, function (a, one, two) {
|
|
|
|
|
|
|
|
if (!(two && two.replace)) { return; }
|
|
|
|
|
|
|
|
text = two.replace(/\*\/\s*$/, '').trim();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// lisps?
|
|
|
|
// lisps?
|
|
|
|
var lispy = /^\s*(;|#\|)(.*?)$/;
|
|
|
|
var lispy = /^\s*(;|#\|)+(.*?)$/;
|
|
|
|
if (lispy.test(line)) {
|
|
|
|
if (lispy.test(line)) {
|
|
|
|
line.replace(lispy, function (a, one, two) {
|
|
|
|
line.replace(lispy, function (a, one, two) {
|
|
|
|
text = two;
|
|
|
|
text = two;
|
|
|
@ -111,7 +121,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// lines beginning with a hash are potentially valuable
|
|
|
|
// lines beginning with a hash are potentially valuable
|
|
|
|
// works for markdown, python, bash, etc.
|
|
|
|
// works for markdown, python, bash, etc.
|
|
|
|
var hash = /^#(.*?)$/;
|
|
|
|
var hash = /^#+(.*?)$/;
|
|
|
|
if (hash.test(line)) {
|
|
|
|
if (hash.test(line)) {
|
|
|
|
line.replace(hash, function (a, one) {
|
|
|
|
line.replace(hash, function (a, one) {
|
|
|
|
text = one;
|
|
|
|
text = one;
|
|
|
@ -119,16 +129,6 @@ define([
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// lines including a c-style comment are also valuable
|
|
|
|
|
|
|
|
var clike = /^\s*(\/\*|\/\/)(.*)?(\*\/)*$/;
|
|
|
|
|
|
|
|
if (clike.test(line)) {
|
|
|
|
|
|
|
|
line.replace(clike, function (a, one, two) {
|
|
|
|
|
|
|
|
if (!(two && two.replace)) { return; }
|
|
|
|
|
|
|
|
text = two.replace(/\*\/\s*$/, '').trim();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO make one more pass for multiline comments
|
|
|
|
// TODO make one more pass for multiline comments
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|