diff options
| author | Matias Niemelä | 2013-07-09 18:08:23 -0400 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-07-12 22:43:24 +0100 |
| commit | 77c715d7caedf9dd56b07b451dc47480cac5aaff (patch) | |
| tree | b4109eca61df9d193b18a017f756c06447d4366a /docs/src/ngdoc.js | |
| parent | 5a294c8646452d6e49339d145faeae4f31dcd0fc (diff) | |
| download | angular.js-77c715d7caedf9dd56b07b451dc47480cac5aaff.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 | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index dc75d5cb..f5f22ee8 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -240,7 +240,25 @@ Doc.prototype = { }); }); text = parts.join(''); - text = markdown.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 + '">' + + markdown.makeHtml(text) + + '</div>'; text = text.replace(/(?:<p>)?(REPLACEME\d+)(?:<\/p>)?/g, function(_, id) { return placeholderMap[id]; }); |
