@@ -30,20 +30,20 @@ SummaryArticle.prototype.getArticles = function() {
3030} ;
3131
3232/**
33- Return how deep the article is.
34- The README has a depth of 1
35-
36- @return {Number }
37- */
33+ * Return how deep the article is.
34+ * The README has a depth of 1
35+ *
36+ * @return {Number }
37+ */
3838SummaryArticle . prototype . getDepth = function ( ) {
3939 return ( this . getLevel ( ) . split ( '.' ) . length - 1 ) ;
4040} ;
4141
4242/**
43- Get path (without anchor) to the pointing file
44-
45- @return {String }
46- */
43+ * Get path (without anchor) to the pointing file
44+ *
45+ * @return {String }
46+ */
4747SummaryArticle . prototype . getPath = function ( ) {
4848 if ( this . isExternal ( ) ) {
4949 return undefined ;
@@ -63,19 +63,19 @@ SummaryArticle.prototype.getPath = function() {
6363} ;
6464
6565/**
66- Return url if article is external
67-
68- @return {String }
69- */
66+ * Return url if article is external
67+ *
68+ * @return {String }
69+ */
7070SummaryArticle . prototype . getUrl = function ( ) {
7171 return this . isExternal ( ) ? this . getRef ( ) : undefined ;
7272} ;
7373
7474/**
75- Get anchor for this article (or undefined)
76-
77- @return {String }
78- */
75+ * Get anchor for this article (or undefined)
76+ *
77+ * @return {String }
78+ */
7979SummaryArticle . prototype . getAnchor = function ( ) {
8080 var ref = this . getRef ( ) ;
8181 var parts = ref . split ( '#' ) ;
@@ -85,29 +85,42 @@ SummaryArticle.prototype.getAnchor = function() {
8585} ;
8686
8787/**
88- Is article pointing to a page of an absolute url
88+ * Create a new level for a new child article
89+ *
90+ * @return {String }
91+ */
92+ SummaryArticle . prototype . createChildLevel = function ( ) {
93+ var level = this . getLevel ( ) ;
94+ var subArticles = this . getArticles ( ) ;
95+ var childLevel = level + '.' + ( subArticles . size + 1 ) ;
96+
97+ return childLevel ;
98+ } ;
8999
90- @return {Boolean }
91- */
100+ /**
101+ * Is article pointing to a page of an absolute url
102+ *
103+ * @return {Boolean }
104+ */
92105SummaryArticle . prototype . isPage = function ( ) {
93106 return ! this . isExternal ( ) && this . getRef ( ) ;
94107} ;
95108
96109/**
97- Is article pointing to aan absolute url
98-
99- @return {Boolean }
100- */
110+ * Is article pointing to aan absolute url
111+ *
112+ * @return {Boolean }
113+ */
101114SummaryArticle . prototype . isExternal = function ( ) {
102115 return location . isExternal ( this . getRef ( ) ) ;
103116} ;
104117
105118/**
106- Create a SummaryArticle
107-
108- @param {Object } def
109- @return {SummaryArticle }
110- */
119+ * Create a SummaryArticle
120+ *
121+ * @param {Object } def
122+ * @return {SummaryArticle }
123+ */
111124SummaryArticle . create = function ( def , level ) {
112125 var articles = ( def . articles || [ ] ) . map ( function ( article , i ) {
113126 if ( article instanceof SummaryArticle ) {
@@ -124,14 +137,13 @@ SummaryArticle.create = function(def, level) {
124137 } ) ;
125138} ;
126139
127-
128140/**
129- Find an article from a base one
130-
131- @param {Article|Part } base
132- @param {Function(article) } iter
133- @return {Article }
134- */
141+ * Find an article from a base one
142+ *
143+ * @param {Article|Part } base
144+ * @param {Function(article) } iter
145+ * @return {Article }
146+ */
135147SummaryArticle . findArticle = function ( base , iter ) {
136148 var articles = base . getArticles ( ) ;
137149
0 commit comments