From 2fadbaef43af96c5b632d24d9d6797b054fc50e4 Mon Sep 17 00:00:00 2001
From: JiveDig <jivetheuniversal@gmail.com>
Date: Wed, 28 Jun 2023 15:36:15 -0400
Subject: [PATCH] fix block/shortcode not respecting min headings

---
 CHANGES.md                          |  4 ++++
 classes/class-table-of-contents.php |  4 ++--
 composer.lock                       | 14 +++++++-------
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 1b16b04..d227a84 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## 1.5.2 (6/28/23)
+* Changed: Update the updater.
+* Fixed: TOC block and shortcode not respecting the minimum headings count.
+
 ## 1.5.1 (5/5/23)
 * Fixed: Missing content on some post types when a TOC is not present.
 
diff --git a/classes/class-table-of-contents.php b/classes/class-table-of-contents.php
index 2a51f1e..2891c76 100644
--- a/classes/class-table-of-contents.php
+++ b/classes/class-table-of-contents.php
@@ -323,8 +323,8 @@ function get_data() {
 			}
 		}
 
-		// If we have at least 3 h2 headings.
-		if ( count( $data['matches'] ) > 2 ) {
+		// If we have the minimum h2 headings.
+		if ( count( $data['matches'] ) >= $this->args['headings'] ) {
 			// Store TOC in new content.
 			$data['content'] = $dom->saveHTML();
 		}
diff --git a/composer.lock b/composer.lock
index aa556e4..08d5783 100644
--- a/composer.lock
+++ b/composer.lock
@@ -8,16 +8,16 @@
     "packages": [
         {
             "name": "yahnis-elsts/plugin-update-checker",
-            "version": "v5.0",
+            "version": "v5.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/YahnisElsts/plugin-update-checker.git",
-                "reference": "81be284da76f12c8751b477b2a0fa44364d26f84"
+                "reference": "48b03e93c9c2587f9276dce00ce2b6d94c1190d2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/YahnisElsts/plugin-update-checker/zipball/81be284da76f12c8751b477b2a0fa44364d26f84",
-                "reference": "81be284da76f12c8751b477b2a0fa44364d26f84",
+                "url": "https://api.github.com/repos/YahnisElsts/plugin-update-checker/zipball/48b03e93c9c2587f9276dce00ce2b6d94c1190d2",
+                "reference": "48b03e93c9c2587f9276dce00ce2b6d94c1190d2",
                 "shasum": ""
             },
             "require": {
@@ -27,7 +27,7 @@
             "type": "library",
             "autoload": {
                 "files": [
-                    "load-v5p0.php"
+                    "load-v5p1.php"
                 ]
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -52,9 +52,9 @@
             ],
             "support": {
                 "issues": "https://github.com/YahnisElsts/plugin-update-checker/issues",
-                "source": "https://github.com/YahnisElsts/plugin-update-checker/tree/v5.0"
+                "source": "https://github.com/YahnisElsts/plugin-update-checker/tree/v5.1"
             },
-            "time": "2022-10-28T17:46:32+00:00"
+            "time": "2023-05-20T11:55:43+00:00"
         }
     ],
     "packages-dev": [],