diff options
| author | Misko Hevery | 2011-11-09 21:18:34 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:16 -0800 |
| commit | f0fa5e63762e80fd4ee60ff6d365fca5f886292a (patch) | |
| tree | 7c294714922118c49ec5f37bcd8b2733f13d1e7d /docs/src/dom.js | |
| parent | c283bf6035566aa8ff3178676a133de6878b5d1b (diff) | |
| download | angular.js-f0fa5e63762e80fd4ee60ff6d365fca5f886292a.tar.bz2 | |
doc(AUTO, NG_MOCK): Documenting the AUTO and NG_MOCK module
Diffstat (limited to 'docs/src/dom.js')
| -rw-r--r-- | docs/src/dom.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/docs/src/dom.js b/docs/src/dom.js index ccfee7ac..11330a02 100644 --- a/docs/src/dom.js +++ b/docs/src/dom.js @@ -77,10 +77,18 @@ DOM.prototype = { h: function(heading, content, fn){ if (content==undefined || (content instanceof Array && content.length == 0)) return; this.headingDepth++; - this.tag('h' + this.headingDepth, heading); - var className = typeof heading == 'string' - ? {'class': heading.toLowerCase().replace(/[^\d\w_]/mg, '-').replace(/-+/gm, '-')} - : null; + var className = null, + anchor = null; + if (typeof heading == 'string') { + var id = heading. + replace(/\(.*\)/mg, ''). + replace(/[^\d\w]/mg, '.'). + replace(/-+/gm, '-'). + replace(/-*$/gm, ''); + anchor = {'id': id}; + className = {'class': id.toLowerCase().replace(/[._]/mg, '-')}; + } + this.tag('h' + this.headingDepth, anchor, heading); if (content instanceof Array) { this.ul(content, className, fn); } else if (fn) { |
