From f0fa5e63762e80fd4ee60ff6d365fca5f886292a Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 9 Nov 2011 21:18:34 -0800 Subject: doc(AUTO, NG_MOCK): Documenting the AUTO and NG_MOCK module --- docs/src/dom.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'docs/src/dom.js') 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) { -- cgit v1.2.3