File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424 }
2525 }
2626 Polymer ( 'cxx-clause' , {
27- // Convenience function at the clause level, which gets called from <cxx-toc>.
27+
28+ // Convenience function at the clause level, which gets called
29+ // from <cxx-toc>. If the clause is explicitly numbered, then
30+ // this sets the clause_num to that value. Otherwise, the clause
31+ // number is set to the argument clause_num. This returns
32+ // 1 + the value set.
33+ //
34+ // Note that this will recursively set the section numbers for
35+ // this clause.
2836 set_clause_num : function ( clause_num ) {
2937 // If the author explicitly specified the clause number, don't
3038 // use a different number.
3139 if ( this . number )
32- clause_num = this . number
40+ clause_num = Number ( this . number )
3341 this . update_sec_nums ( clause_num ) ;
34- return clause_num ;
42+ return clause_num + 1 ;
3543 } ,
3644
3745 domReady : updateTocClauses ,
Original file line number Diff line number Diff line change @@ -30,7 +30,12 @@ limitations under the License.
3030 // Assume there aren't any elements between cxx-section levels.
3131 for ( var child = this . firstChild ; child ; child = child . nextSibling ) {
3232 if ( child instanceof CxxSectionElement ) {
33- child . update_sec_nums ( this . sec_num + '.' + ( child_index ++ ) ) ;
33+ if ( child . number ) {
34+ child_index = Number ( child . number ) ;
35+ console . log ( child . number )
36+ }
37+ child . update_sec_nums ( this . sec_num + '.' + child_index ) ;
38+ child_index ++ ;
3439 }
3540 }
3641 } ,
Original file line number Diff line number Diff line change @@ -36,9 +36,11 @@ limitations under the License.
3636 } ,
3737
3838 clausesChanged : function ( ) {
39- var n = 1
40- while ( n < this . clauses . length ) {
41- n = this . clause [ n ] . set_clause_num ( n )
39+ var clause_num = 1 ;
40+ for ( var i = 0 ; i < this . clauses . length ; ++ i ) {
41+ var clause = this . clauses [ i ] ;
42+ clause_num = clause . set_clause_num ( clause_num ) ;
43+ this . sections . push ( this . collectSections ( clause ) ) ;
4244 }
4345
4446 // this.sections = this.clauses.array().map(function(clause, index) {
You can’t perform that action at this time.
0 commit comments