aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/dom.js16
-rw-r--r--docs/src/ngdoc.js26
-rw-r--r--docs/src/templates/docs.css14
3 files changed, 40 insertions, 16 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) {
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js
index 562144b5..7f97b906 100644
--- a/docs/src/ngdoc.js
+++ b/docs/src/ngdoc.js
@@ -89,6 +89,7 @@ Doc.prototype = {
var self = this,
IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:|\.|\/)/,
IS_ANGULAR = /^(api\/)?angular\./,
+ IS_HASH = /^#/,
parts = trim(text).split(/(<pre>[\s\S]*?<\/pre>|<doc:(\S*).*?>[\s\S]*?<\/doc:\2>)/);
parts.forEach(function(text, i) {
@@ -134,13 +135,16 @@ Doc.prototype = {
function(_all, url, title){
var isFullUrl = url.match(IS_URL),
isAngular = url.match(IS_ANGULAR),
- absUrl = isFullUrl ? url : self.convertUrlToAbsolute(url);
+ isHash = url.match(IS_HASH),
+ absUrl = isHash
+ ? url
+ : (isFullUrl ? url : self.convertUrlToAbsolute(url));
if (!isFullUrl) self.links.push(absUrl);
return '<a href="' + absUrl + '">' +
(isAngular ? '<code>' : '') +
- (title || url).replace(/\n/g, ' ') +
+ (title || url.replace(/^#/g, '')).replace(/\n/g, ' ') +
(isAngular ? '</code>' : '') +
'</a>';
});
@@ -171,7 +175,8 @@ Doc.prototype = {
}
});
flush();
- this.shortName = (this.name || '').split(/[\.#]/).pop();
+ this.name = this.name || '';
+ this.shortName = this.name.split(this.name.match(/#/) ? /#/ : /\./ ).pop();
this.id = this.id || // if we have an id just use it
(((this.file||'').match(/.*\/([^\/]*)\.ngdoc/)||{})[1]) || // try to extract it from file name
this.name; // default to name
@@ -319,7 +324,7 @@ Doc.prototype = {
var self = this;
dom.h('Usage', function() {
dom.code(function() {
- dom.text(self.name.split('service.').pop());
+ dom.text(self.name.split(/\./).pop());
dom.text('(');
self.parameters(dom, ', ');
dom.text(');');
@@ -329,6 +334,7 @@ Doc.prototype = {
self.html_usage_this(dom);
self.html_usage_returns(dom);
});
+ this.method_properties_events(dom);
},
html_usage_property: function(dom){
@@ -450,7 +456,7 @@ Doc.prototype = {
dom.html(this.description);
},
- html_usage_service: function(dom){
+ html_usage_object: function(dom){
var self = this;
if (this.param.length) {
@@ -467,7 +473,15 @@ Doc.prototype = {
self.html_usage_returns(dom);
});
}
+ this.method_properties_events(dom);
+ },
+
+ html_usage_service: function(dom) {
+ this.html_usage_object(dom)
+ },
+ method_properties_events: function(dom) {
+ var self = this;
dom.h('Methods', this.methods, function(method){
var signature = (method.param || []).map(property('name'));
dom.h(method.shortName + '(' + signature.join(', ') + ')', method, function() {
@@ -480,7 +494,7 @@ Doc.prototype = {
});
});
dom.h('Properties', this.properties, function(property){
- dom.h(property.name, function() {
+ dom.h(property.shortName, function() {
dom.html(property.description);
dom.h('Example', property.example, dom.html);
});
diff --git a/docs/src/templates/docs.css b/docs/src/templates/docs.css
index 5c7a064a..fd77970c 100644
--- a/docs/src/templates/docs.css
+++ b/docs/src/templates/docs.css
@@ -240,23 +240,25 @@ li {
}
#content-list .level-1 {
- font-size: 1.1em;
- font-weight: bold;
+ margin-left: 0em;
}
-#content-list .level-2,
-#content-list .level-3 {
+#content-list .level-2 {
margin-left: 1em;
}
-#content-list .level-4 {
+#content-list .level-3 {
margin-left: 2em;
}
-#content-list .level-5 {
+#content-list .level-4 {
margin-left: 3em;
}
+#content-list .level-5 {
+ margin-left: 4em;
+}
+
#content-list a.current {
font-weight: bold;