aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/templates/doc_widgets.js
diff options
context:
space:
mode:
authorMisko Hevery2011-01-25 21:55:11 -0800
committerIgor Minar2011-01-26 23:31:15 -0800
commitbd33f60276a0fa37acffbad7a0cdcff92db594c8 (patch)
tree7cd957c19182ddc430a6320b77b2f03cb1bd223d /docs/src/templates/doc_widgets.js
parent8682befc7284a3c0b35cd5d85d4f42b1484ec71a (diff)
downloadangular.js-bd33f60276a0fa37acffbad7a0cdcff92db594c8.tar.bz2
Added part of guide documentation and supporting changes to doc generator
Diffstat (limited to 'docs/src/templates/doc_widgets.js')
-rw-r--r--docs/src/templates/doc_widgets.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js
index 2d1ab8c6..39b9ff48 100644
--- a/docs/src/templates/doc_widgets.js
+++ b/docs/src/templates/doc_widgets.js
@@ -58,11 +58,22 @@
function indent(text) {
var lines = text.split(/\n/);
var lineNo = [];
+ // remove any leading blank lines
while (lines[0].match(/^\s*$/)) lines.shift();
+ // remove any trailing blank lines
while (lines[lines.length - 1].match(/^\s*$/)) lines.pop();
+ var minIndent = 999;
for ( var i = 0; i < lines.length; i++) {
- lines[i] = ' ' + lines[i];
- lineNo.push(6 + i);
+ var line = lines[0];
+ var indent = line.match(/^\s*/)[0];
+ if (indent !== line && indent.length < minIndent) {
+ minIndent = indent.length;
+ }
+ }
+
+ for ( var i = 0; i < lines.length; i++) {
+ lines[i] = ' ' + lines[i].substring(minIndent);
+ lineNo.push(5 + i);
}
return {html: lines.join('\n'), hilite: lineNo.join(',') };
};