diff options
| author | Matias Niemelä | 2013-08-07 13:40:13 -0400 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-08-07 22:11:45 +0100 |
| commit | 1c3a46adda358df21e6383113e0ddc499f2cac0c (patch) | |
| tree | 5f06a00641ff7b18bb8f46af908c9e34ba9847e2 /docs/src/ngdoc.js | |
| parent | 4407e81c618d42c70e8cfca4f52dfc4a669b5c68 (diff) | |
| download | angular.js-1c3a46adda358df21e6383113e0ddc499f2cac0c.tar.bz2 | |
chore(ngdoc): wrap all pages inside of a container tag for easy styling
Diffstat (limited to 'docs/src/ngdoc.js')
| -rw-r--r-- | docs/src/ngdoc.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 84a165f2..3a8445c9 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -173,8 +173,27 @@ Doc.prototype = { '</a>'; }); }); + text = parts.join(''); - text = new Showdown.converter({ extensions : ['table'] }).makeHtml(text); + + function prepareClassName(text) { + return text.toLowerCase().replace(/[_\W]+/g, '-'); + }; + + var pageClassName, suffix = '-page'; + if(this.name) { + var split = this.name.match(/^\s*(.+?)\s*:\s*(.+)/); + if(split && split.length > 1) { + var before = prepareClassName(split[1]); + var after = prepareClassName(split[2]); + pageClassName = before + suffix + ' ' + before + '-' + after + suffix; + } + } + pageClassName = pageClassName || prepareClassName(this.name || 'docs') + suffix; + + text = '<div class="' + pageClassName + '">' + + (new Showdown.converter({ extensions : ['table'] }).makeHtml(text)) + + '</div>'; text = text.replace(/(?:<p>)?(REPLACEME\d+)(?:<\/p>)?/g, function(_, id) { return placeholderMap[id]; }); |
