bugfix for enumeration of the headings in listview
This commit is contained in:
parent
f28deedf38
commit
f9a9222900
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: Extended Table of Contents (with nextpage support)
|
||||
Plugin URI: http://www.happybooking.de/wordpress/plugins/extended-toc
|
||||
Description: This plugin automatically generates and inserts a table of contents (ToC) to your pages and posts, based on tags h1-h6. Whenever the plugin discovers more than a certain amount of headings (default: 3) the ToC is inserted at the top of the page. This plugin also can handle posts that are divided into pages by the nextpage-wordpress-tag. Any feedback or suggestions are welcome.
|
||||
Version: 0.9.2
|
||||
Version: 0.9.3
|
||||
Author: Daniel Boldura, HappyBooking UG
|
||||
Author URI: http://www.happybooking.de/
|
||||
|
||||
|
@ -25,7 +25,7 @@ Author URI: http://www.happybooking.de/
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
define( 'EXTENDED_TOC_VERSION', '0.9.2' );
|
||||
define( 'EXTENDED_TOC_VERSION', '0.9.3' );
|
||||
define( 'EXTENDED_TOC_ID', 'extended_toc' );
|
||||
define( 'EXTENDED_TOC_NAME', 'Extended-ToC' );
|
||||
define( 'TOC_MIN_START', 2 );
|
||||
|
@ -307,9 +307,7 @@ if( !class_exists('ExToC') ) {
|
|||
), $atts ) );
|
||||
|
||||
$headers = preg_split('/[\s*,]+/i', $headers);
|
||||
|
||||
// echo "<pre>"; print_r($headers); echo "</pre>";
|
||||
|
||||
|
||||
if($start) $this->options['start'] = $start;
|
||||
if($headers) $this->options['heading_levels'] = $headers;
|
||||
if($title) $this->options['heading_text'] = $title;
|
||||
|
@ -400,6 +398,18 @@ if( !class_exists('ExToC') ) {
|
|||
|
||||
$headers = "";
|
||||
|
||||
// Reset all settings
|
||||
$this->minLevel = null;
|
||||
|
||||
// private $path;
|
||||
// private $content = "";
|
||||
// private $fullcontent = "";
|
||||
// private $pages = array();
|
||||
// private $ID = 0;
|
||||
// private $counter = array();
|
||||
// private $totalHeadings = 0;
|
||||
// private $minLevel = null;
|
||||
|
||||
/** Extract headings from every pages */
|
||||
for( $pagenum = 1; $pagenum <= count($this->pages); $pagenum++ ) {
|
||||
$headers .= $this->exctract_headings($pagenum);
|
||||
|
@ -416,7 +426,7 @@ if( !class_exists('ExToC') ) {
|
|||
private function exctract_headings($pagenum) {
|
||||
/** find all header tags within the page **/
|
||||
preg_match_all('/(<h([1-6]{1})[^>]*>).*<\/h\2>/msuU', $this->pages[$pagenum-1], $matches, PREG_SET_ORDER);
|
||||
|
||||
|
||||
/** Check the headings that are desired */
|
||||
if( count($this->options['heading_levels']) != 6 ) {
|
||||
$new_matches = array();
|
||||
|
@ -468,7 +478,7 @@ if( !class_exists('ExToC') ) {
|
|||
|
||||
/** build html */
|
||||
$items .= '<li class="header-level-' . ($currentLevel - $this->minLevel + 1) . '">';
|
||||
// echo $currentLevel . ' - ' . $this->minLevel . ' <br>';
|
||||
|
||||
global $page;
|
||||
if( $pagenum == $page && is_single() )
|
||||
$items .= '<a href="#' . $anchor . '">';
|
||||
|
|
|
@ -40,6 +40,9 @@ You can change the default settings and more under Plugins > Extended-ToC
|
|||
If you have any questions or suggestions please contact us at any time: support@happybooking.de or http://www.happybooking.de/
|
||||
|
||||
== Changelog ==
|
||||
= 0.9.3 =
|
||||
* bugfix for headungs enumeration error
|
||||
|
||||
= 0.9.2 =
|
||||
* little bugfix within markup
|
||||
|
||||
|
|
Loading…
Reference in New Issue