From 22dd4a6d9cb0faa27950b880e462f64e7558be56 Mon Sep 17 00:00:00 2001 From: "E. S." Date: Sun, 18 May 2025 16:36:00 +0300 Subject: [PATCH] ic/tzo: fix chapter anchors --- src/lib/ic/TZOPart.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/ic/TZOPart.php b/src/lib/ic/TZOPart.php index 57a2501..32f0594 100644 --- a/src/lib/ic/TZOPart.php +++ b/src/lib/ic/TZOPart.php @@ -106,10 +106,11 @@ class TZOPart // chapter markers $html = preg_replace_callback( - '/
(?:# )?(\(\d+\)|([\w\s?]+))<\/center>/', + '/
(?:# )?(\((\d+)\)|([\w\s?]+))<\/center>/', function ($matches) { $number = $matches[1]; - return '

'.$number.'

'; + $id = isset($matches[2]) && $matches[2] != '' ? 'chapter'.$matches[2] : ''; + return '

'.$number.'

'; }, $html );