lib/jquery.planize.js
function() {
	  var level       = 0;
	  var levels      = [0,0,0,0,0,0,0];
	  var hLevelText  = '';
	  var prependText = '';
	  var prevLevel   = 0;
	  var n           = 0;
	  self.children('*:header:visible').each(function(index, heading) {
		log('Processing heading %o', heading);
		level = parseInt(heading.tagName.substring(1));
		if (config.min_level <= level && level <= config.max_level) {
		  n++;
		  levels[level]++;
		  for (var l = 1; l <= level; l++) {
			hLevelText += levels[l] > 0 ? levels[l] + config.number_separator : '';
		  }
		  levels[level + 1] = 0;
		  hLevelText = hLevelText.substring(0, hLevelText.length - 1);
		  prependText = hLevelText;
		  if (config.generate_toc || config.add_anchors) {
			if (config.generate_toc) {
			  var link = '<a href="#h' + hLevelText + '">' +jQuery('<span/>').text(jQuery(this).text()).html() + '</a>';
			  var elem = "\n"+'<li>' + hLevelText + (config.number_suffix ? config.number_suffix : '') + ' ' + link;
			  if (level < prevLevel) {
				log(hLevelText + ', unnesting because:' + level + '<' + prevLevel);
				var unnest = '';
				while (level < prevLevel) {
				  unnest += '</ul>';
				  prevLevel--;
				}
				toc += unnest + elem + '</li>';
			  } else if (level > prevLevel) {
				log(hLevelText + ', nesting because:' + level + '>' + prevLevel);
				toc += '<ul>' + elem;
			  } else {
				log(hLevelText + ', same level (' + level + ')');
				toc += elem;
			  }
			}
			prependText = '<span id="h' + hLevelText + '"></span>' + hLevelText;
		  }
		  if (config.number_suffix) {
			prependText += config.number_suffix;
		  }
		  jQuery(this).prepend(prependText + ' ');
		  prependText = hLevelText = '';
		  prevLevel = level;
		}
	  });

	  if (config.generate_toc) {
		if (config.toc_title) {
		  toc = '<h4>' + config.toc_title + '</h4>' + toc;
		}
		if (n == 0) {
		  toc += config.toc_none ? '<p>' + config.toc_none + '</p>' : '';
		}
		jQuery(config.toc_elem ? config.toc_elem : 'body').append(toc);
	  }

	  processed = true;
	}
function() {
	  var level       = 0;
	  var levels      = [0,0,0,0,0,0,0];
	  var hLevelText  = '';
	  var prependText = '';
	  var prevLevel   = 0;
	  var n           = 0;
	  self.children('*:header:visible').each(function(index, heading) {
		log('Processing heading %o', heading);
		level = parseInt(heading.tagName.substring(1));
		if (config.min_level <= level && level <= config.max_level) {
		  n++;
		  levels[level]++;
		  for (var l = 1; l <= level; l++) {
			hLevelText += levels[l] > 0 ? levels[l] + config.number_separator : '';
		  }
		  levels[level + 1] = 0;
		  hLevelText = hLevelText.substring(0, hLevelText.length - 1);
		  prependText = hLevelText;
		  if (config.generate_toc || config.add_anchors) {
			if (config.generate_toc) {
			  var link = '<a href="#h' + hLevelText + '">' +jQuery('<span/>').text(jQuery(this).text()).html() + '</a>';
			  var elem = "\n"+'<li>' + hLevelText + (config.number_suffix ? config.number_suffix : '') + ' ' + link;
			  if (level < prevLevel) {
				log(hLevelText + ', unnesting because:' + level + '<' + prevLevel);
				var unnest = '';
				while (level < prevLevel) {
				  unnest += '</ul>';
				  prevLevel--;
				}
				toc += unnest + elem + '</li>';
			  } else if (level > prevLevel) {
				log(hLevelText + ', nesting because:' + level + '>' + prevLevel);
				toc += '<ul>' + elem;
			  } else {
				log(hLevelText + ', same level (' + level + ')');
				toc += elem;
			  }
			}
			prependText = '<span id="h' + hLevelText + '"></span>' + hLevelText;
		  }
		  if (config.number_suffix) {
			prependText += config.number_suffix;
		  }
		  jQuery(this).prepend(prependText + ' ');
		  prependText = hLevelText = '';
		  prevLevel = level;
		}
	  });

	  if (config.generate_toc) {
		if (config.toc_title) {
		  toc = '<h4>' + config.toc_title + '</h4>' + toc;
		}
		if (n == 0) {
		  toc += config.toc_none ? '<p>' + config.toc_none + '</p>' : '';
		}
		jQuery(config.toc_elem ? config.toc_elem : 'body').append(toc);
	  }

	  processed = true;
	}
function ( ) { var level = 0 ; var levels = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ; var hLevelText = '' ; var prependText = '' ; var prevLevel = 0 ; var n = 0 ; self . children ( '*:header:visible' ) . each ( function ( index , heading ) { log ( 'Processing heading %o' , heading ) ; level = parseInt ( heading . tagName . substring ( 1 ) ) ; if ( config . min_level <= level && level <= config . max_level ) { n ++ ; levels [ level ] ++ ; for ( var l = 1 ; l <= level ; l ++ ) { hLevelText += levels [ l ] > 0 ? levels [ l ] + config . number_separator : '' ; } levels [ level + 1 ] = 0 ; hLevelText = hLevelText . substring ( 0 , hLevelText . length - 1 ) ; prependText = hLevelText ; if ( config . generate_toc || config . add_anchors ) { if ( config . generate_toc ) { var link = '<a href="#h' + hLevelText + '">' + jQuery ( '<span/>' ) . text ( jQuery ( this ) . text ( ) ) . html ( ) + '</a>' ; var elem = "\n" + '<li>' + hLevelText + ( config . number_suffix ? config . number_suffix : '' ) + ' ' + link ; if ( level < prevLevel ) { log ( hLevelText + ', unnesting because:' + level + '<' + prevLevel ) ; var unnest = '' ; while ( level < prevLevel ) { unnest += '</ul>' ; prevLevel -- ; } toc += unnest + elem + '</li>' ; } else if ( level > prevLevel ) { log ( hLevelText + ', nesting because:' + level + '>' + prevLevel ) ; toc += '<ul>' + elem ; } else { log ( hLevelText + ', same level (' + level + ')' ) ; toc += elem ; } } prependText = '<span id="h' + hLevelText + '"></span>' + hLevelText ; } if ( config . number_suffix ) { prependText += config . number_suffix ; } jQuery ( this ) . prepend ( prependText + ' ' ) ; prependText = hLevelText = '' ; prevLevel = level ; } } ) ; if ( config . generate_toc ) { if ( config . toc_title ) { toc = '<h4>' + config . toc_title + '</h4>' + toc ; } if ( n == 0 ) { toc += config . toc_none ? '<p>' + config . toc_none + '</p>' : '' ; } jQuery ( config . toc_elem ? config . toc_elem : 'body' ) . append ( toc ) ; } processed = true ; }
Prepends all headers text with the current tree number reference

@return void
Prepends all headers text with the current tree number reference