Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -69,13 +69,13 @@ |
70 | 70 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), |
71 | 71 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ), |
72 | 72 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 5 ), |
73 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 20 ), |
| 73 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 21 ), |
74 | 74 | ), |
75 | 75 | 'combined' => array( |
76 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 45 ), |
| 76 | + array( 'src' => 'js/plugins.combined.js', 'version' => 46 ), |
77 | 77 | ), |
78 | 78 | 'minified' => array( |
79 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 45 ), |
| 79 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 46 ), |
80 | 80 | ), |
81 | 81 | ), |
82 | 82 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | // Build outline from wikitext |
175 | 175 | var outline = []; |
176 | 176 | var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
177 | | - var headings = wikitext.match( /^={1,6}.+={1,6}\s*$/gm ); |
| 177 | + var headings = wikitext.match( /^={1,6}[^=\n][^\n]*={1,6}\s*$/gm ); |
178 | 178 | var offset = 0; |
179 | 179 | headings = $.makeArray( headings ); |
180 | 180 | for ( var h = 0; h < headings.length; h++ ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -2362,7 +2362,7 @@ |
2363 | 2363 | // Build outline from wikitext |
2364 | 2364 | var outline = []; |
2365 | 2365 | var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
2366 | | - var headings = wikitext.match( /^={1,6}.+={1,6}\s*$/gm ); |
| 2366 | + var headings = wikitext.match( /^={1,6}[^=\n][^\n]*={1,6}\s*$/gm ); |
2367 | 2367 | var offset = 0; |
2368 | 2368 | headings = $.makeArray( headings ); |
2369 | 2369 | for ( var h = 0; h < headings.length; h++ ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | $.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
154 | 154 | list.append(item);} |
155 | 155 | return list;} |
156 | | -var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}.+={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+text.length;}else if(position==-1){continue;} |
| 156 | +var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}[^=\n][^\n]*={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+text.length;}else if(position==-1){continue;} |
157 | 157 | var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}} |
158 | 158 | var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}} |
159 | 159 | var level=Math.min(startLevel,endLevel);text=$.trim(text.substr(level,text.length-(level*2)));outline[h]={'text':text,'position':position,'level':level,'index':h+1};} |