aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/ngdoc.js
diff options
context:
space:
mode:
authorMatias Niemelä2013-08-07 13:40:13 -0400
committerPete Bacon Darwin2013-08-07 22:11:45 +0100
commit1c3a46adda358df21e6383113e0ddc499f2cac0c (patch)
tree5f06a00641ff7b18bb8f46af908c9e34ba9847e2 /docs/src/ngdoc.js
parent4407e81c618d42c70e8cfca4f52dfc4a669b5c68 (diff)
downloadangular.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.js21
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];
});