* @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"));
}
/**
* @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);
}
/**
* @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);
}
/**
* @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);
}
}