File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 24
24
}
25
25
}
26
26
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.
28
36
set_clause_num : function ( clause_num ) {
29
37
// If the author explicitly specified the clause number, don't
30
38
// use a different number.
31
39
if ( this . number )
32
- clause_num = this . number
40
+ clause_num = Number ( this . number )
33
41
this . update_sec_nums ( clause_num ) ;
34
- return clause_num ;
42
+ return clause_num + 1 ;
35
43
} ,
36
44
37
45
domReady : updateTocClauses ,
Original file line number Diff line number Diff line change @@ -30,7 +30,12 @@ limitations under the License.
30
30
// Assume there aren't any elements between cxx-section levels.
31
31
for ( var child = this . firstChild ; child ; child = child . nextSibling ) {
32
32
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 ++ ;
34
39
}
35
40
}
36
41
} ,
Original file line number Diff line number Diff line change @@ -36,9 +36,11 @@ limitations under the License.
36
36
} ,
37
37
38
38
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 ) ) ;
42
44
}
43
45
44
46
// this.sections = this.clauses.array().map(function(clause, index) {
You can’t perform that action at this time.
0 commit comments