fix some leftovers
authorMichael Wallner <mike@php.net>
Thu, 27 Jan 2022 15:36:59 +0000 (16:36 +0100)
committerMichael Wallner <mike@php.net>
Thu, 27 Jan 2022 15:36:59 +0000 (16:36 +0100)
VERSION
mdref/Formatter.php
mdref/Reference.php

diff --git a/VERSION b/VERSION
index cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4..9f55b2ccb5f234fc6b87ada62389a3d73815d0d1 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0
+3.0
index 95a276f0514737574a83a2893f2d1f3bfaf36058..b103a1017d24083edccdacee9e89a61b36155149 100644 (file)
@@ -60,7 +60,7 @@ class Formatter {
         * @return string the simplified slug
         */
        public function formatSlug(string $string) : string {
-               return preg_replace("/[^\$[:alnum:]:._-]+/", ".", $string);
+               return preg_replace("/[^\$[:alnum:]:._-]+/", ".", trim($string, "/ \r\n\t"));
        }
 
        /**
index 4197de1afa015c8aa6d14beefd81af125018ec69..4ff5f90a3edcbe9022462db4634fa02f5901d717 100644 (file)
@@ -70,11 +70,11 @@ class Reference implements IteratorAggregate {
         * @param string $anchor
         * @return string
         */
-       public function formatAnchor(string $anchor, string $location = null) : string {
+       public function formatAnchor(string $anchor) : string {
                if (is_numeric($anchor)) {
                        return "L$anchor";
                }
-               return preg_replace("/[^[:alnum:]\.:_]/", ".", $anchor);
+               return $this->fmt->formatSlug($anchor);
        }
 
        /**
@@ -82,8 +82,8 @@ class Reference implements IteratorAggregate {
         * @return string
         * @throws \Exception, Exception
         */
-       public function formatString(string $string, string $location = null) : string {
-               return $this->fmt->formatString($string, $location);
+       public function formatString(string $string) : string {
+               return $this->fmt->formatString($string);
        }
 
        /**
@@ -91,7 +91,7 @@ class Reference implements IteratorAggregate {
         * @return string
         * @throws \Exception, Exception
         */
-       public function formatFile(string $file, string $location = null) : string {
-               return $this->fmt->formatFile($file, $location);
+       public function formatFile(string $file) : string {
+               return $this->fmt->formatFile($file);
        }
 }