+ wfDeprecated( __METHOD__, '1.34' );
+ return $this->finalizeHeadings( $text, $origText, $isMain );
+ }
+
+ /**
+ * This function accomplishes several tasks:
+ * 1) Auto-number headings if that option is enabled
+ * 2) Add an [edit] link to sections for users who have enabled the option and can edit the page
+ * 3) Add a Table of contents on the top for users who have enabled the option
+ * 4) Auto-anchor headings
+ *
+ * It loops through all headlines, collects the necessary data, then splits up the
+ * string and re-inserts the newly formatted headlines.
+ *
+ * @param string $text
+ * @param string $origText Original, untouched wikitext
+ * @param bool $isMain
+ * @return mixed|string
+ */
+ private function finalizeHeadings( $text, $origText, $isMain = true ) {