diff options
| author | Misko Hevery | 2011-01-19 12:16:21 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-01-24 14:23:51 -0800 |
| commit | 70c74a9c4e3f1c3fdeb285e765a03bc878d14422 (patch) | |
| tree | 17bd4fbdc3f19bbaa26699cd2b709a6ca96419e0 /docs/src/dom.js | |
| parent | 22c5b7059b3239bb7fe36454d66ea4356a3c6666 (diff) | |
| download | angular.js-70c74a9c4e3f1c3fdeb285e765a03bc878d14422.tar.bz2 | |
add @this and @exampleDescription tags
(also removed markdownNoP, now done through CSS)
Diffstat (limited to 'docs/src/dom.js')
| -rw-r--r-- | docs/src/dom.js | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/docs/src/dom.js b/docs/src/dom.js index e6dd09e6..d7c2a157 100644 --- a/docs/src/dom.js +++ b/docs/src/dom.js @@ -16,11 +16,11 @@ var INLINE_TAGS = { b: true }; -DOM.prototype = { +DOM.prototype = { toString: function() { return this.out.join(''); }, - + text: function(content) { if (typeof content == "string") { this.out.push(content.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')); @@ -51,19 +51,21 @@ DOM.prototype = { this.out.push('>'); this.text(text); this.out.push('</' + name + '>'); - if (!INLINE_TAGS[name]) + if (!INLINE_TAGS[name]) this.out.push('\n'); }, - + code: function(text) { this.tag('div', {'ng:non-bindable':''}, function(){ this.tag('pre', {'class':"brush: js; html-script: true;"}, text); }); }, - - example: function(source, scenario) { - if (source || scenario) { + + example: function(description, source, scenario) { + if (description || source || scenario) { this.h('Example', function(){ + if (description) + this.html(description); if (scenario === false) { this.code(source); } else { @@ -75,37 +77,38 @@ DOM.prototype = { }); } }, - + h: function(heading, content, fn){ if (content==undefined || content && content.legth == 0) return; this.tag('h' + this.headingDepth, heading); this.headingDepth++; + var className = {'class': heading.toLowerCase()}; if (content instanceof Array) { - this.ul(content, {'class': heading.toLowerCase()}, fn); + this.ul(content, className, fn); } else if (fn) { - fn.call(this, content); + this.tag('div', className, fn); } else { - this.text(content); - } + this.tag('div', className, content); + } this.headingDepth--; }, - + h1: function(attr, text) { this.tag('h1', attr, text); }, - + h2: function(attr, text) { this.tag('h2', attr, text); }, - + h3: function(attr, text) { this.tag('h3', attr, text); }, - + p: function(attr, text) { this.tag('p', attr, text); }, - + ul: function(list, attr, fn) { if (typeof attr == 'function') { fn = attr; @@ -119,5 +122,5 @@ DOM.prototype = { }); }); } - -};
\ No newline at end of file + +}; |
