remove TOC temporary debug error_log calls

This commit is contained in:
Pontoporeia
2026-07-10 15:23:52 +02:00
parent c67262673f
commit 1293b1be6c
6 changed files with 2 additions and 28 deletions
+1
View File
@@ -3,3 +3,4 @@
- [x] Fix CSP: add `frame-src` to allow iframes from `videos.erg.be` and `depnum.happyngreen.fr` - [x] Fix CSP: add `frame-src` to allow iframes from `videos.erg.be` and `depnum.happyngreen.fr`
- [x] Website iframe overlay: remove blur, move button to bottom-right, replace text with SVG icon + tooltip - [x] Website iframe overlay: remove blur, move button to bottom-right, replace text with SVG icon + tooltip
- [x] Fix "Copier" button in logs section scrolling out of view on horizontal scroll - [x] Fix "Copier" button in logs section scrolling out of view on horizontal scroll
- [x] Remove TOC temporary debug error_log calls
+1 -1
View File
@@ -109,7 +109,7 @@
} }
.tfe-file-item embed, .tfe-file-item embed,
.tfe-file-iframe { .tfe-file-item iframe {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
height: 100%; height: 100%;
-4
View File
@@ -23,10 +23,8 @@ class AboutController
$db = Database::getInstance(); $db = Database::getInstance();
$aboutPage = $db->getPage('about'); $aboutPage = $db->getPage('about');
$rawContent = $aboutPage ? $aboutPage['content'] : ''; $rawContent = $aboutPage ? $aboutPage['content'] : '';
error_log('[TOC-DEBUG] Apropos: dbPage found=' . ($aboutPage ? 'yes' : 'NO') . ' content_len=' . strlen($rawContent));
if (empty(trim($rawContent)) || trim($rawContent) === 'Contenu à venir') { if (empty(trim($rawContent)) || trim($rawContent) === 'Contenu à venir') {
$rawContent = $this->defaultContent; $rawContent = $this->defaultContent;
error_log('[TOC-DEBUG] Apropos: using defaultContent instead');
} }
$contacts = $db->getAproposContent('contacts'); $contacts = $db->getAproposContent('contacts');
$contacts = is_array($contacts) && !empty($contacts) ? $contacts : null; $contacts = is_array($contacts) && !empty($contacts) ? $contacts : null;
@@ -48,7 +46,6 @@ class AboutController
$rawContent = $this->defaultContent; $rawContent = $this->defaultContent;
$contacts = null; $contacts = null;
$sidebarLinks = []; $sidebarLinks = [];
error_log('[TOC-DEBUG] Apropos: EXCEPTION ' . $e->getMessage());
} }
$converter = new CommonMarkConverter([ $converter = new CommonMarkConverter([
@@ -64,7 +61,6 @@ class AboutController
$html = EmailObfuscator::obfuscateHtml($converter->convert($rawContent)->getContent()); $html = EmailObfuscator::obfuscateHtml($converter->convert($rawContent)->getContent());
$tocItems = MarkdownHelper::extractToc($rawContent); $tocItems = MarkdownHelper::extractToc($rawContent);
error_log('[TOC-DEBUG] Apropos: extractToc returned ' . count($tocItems) . ' items');
return [ return [
'currentNav' => 'apropos', 'currentNav' => 'apropos',
-4
View File
@@ -22,12 +22,10 @@ class CharteController
$dbPage = $db->getPage('charte'); $dbPage = $db->getPage('charte');
$content = $dbPage ? $dbPage['content'] : ''; $content = $dbPage ? $dbPage['content'] : '';
$pageTitle = $dbPage ? $dbPage['title'] : 'Charte'; $pageTitle = $dbPage ? $dbPage['title'] : 'Charte';
error_log('[TOC-DEBUG] Charte: dbPage found=' . ($dbPage ? 'yes' : 'NO') . ' content_len=' . strlen($content));
} catch (Exception $e) { } catch (Exception $e) {
ErrorHandler::log('charte_page', $e); ErrorHandler::log('charte_page', $e);
$content = ''; $content = '';
$pageTitle = 'Charte'; $pageTitle = 'Charte';
error_log('[TOC-DEBUG] Charte: EXCEPTION ' . $e->getMessage());
} }
$converter = new CommonMarkConverter([ $converter = new CommonMarkConverter([
@@ -42,9 +40,7 @@ class CharteController
$converter->getEnvironment()->addExtension(new HeadingPermalinkExtension()); $converter->getEnvironment()->addExtension(new HeadingPermalinkExtension());
$html = EmailObfuscator::obfuscateHtml($converter->convert($content)->getContent()); $html = EmailObfuscator::obfuscateHtml($converter->convert($content)->getContent());
error_log('[TOC-DEBUG] Charte: calling extractToc with content_len=' . strlen($content));
$tocItems = MarkdownHelper::extractToc($content); $tocItems = MarkdownHelper::extractToc($content);
error_log('[TOC-DEBUG] Charte: extractToc returned ' . count($tocItems) . ' items');
return [ return [
'content' => $content, 'content' => $content,
@@ -22,12 +22,10 @@ class LicenceController
$dbPage = $db->getPage('licenses'); $dbPage = $db->getPage('licenses');
$content = $dbPage ? $dbPage['content'] : ''; $content = $dbPage ? $dbPage['content'] : '';
$pageTitle = $dbPage ? $dbPage['title'] : 'Licences'; $pageTitle = $dbPage ? $dbPage['title'] : 'Licences';
error_log('[TOC-DEBUG] Licence: dbPage found=' . ($dbPage ? 'yes' : 'NO') . ' content_len=' . strlen($content));
} catch (Exception $e) { } catch (Exception $e) {
ErrorHandler::log('licence_page', $e); ErrorHandler::log('licence_page', $e);
$content = ''; $content = '';
$pageTitle = 'Licences'; $pageTitle = 'Licences';
error_log('[TOC-DEBUG] Licence: EXCEPTION ' . $e->getMessage());
} }
$converter = new CommonMarkConverter([ $converter = new CommonMarkConverter([
@@ -42,9 +40,7 @@ class LicenceController
$converter->getEnvironment()->addExtension(new HeadingPermalinkExtension()); $converter->getEnvironment()->addExtension(new HeadingPermalinkExtension());
$html = EmailObfuscator::obfuscateHtml($converter->convert($content)->getContent()); $html = EmailObfuscator::obfuscateHtml($converter->convert($content)->getContent());
error_log('[TOC-DEBUG] Licence: calling extractToc with content_len=' . strlen($content));
$tocItems = MarkdownHelper::extractToc($content); $tocItems = MarkdownHelper::extractToc($content);
error_log('[TOC-DEBUG] Licence: extractToc returned ' . count($tocItems) . ' items');
return [ return [
'content' => $content, 'content' => $content,
-15
View File
@@ -18,19 +18,6 @@ class MarkdownHelper
$items = []; $items = [];
$lines = explode("\n", $content); $lines = explode("\n", $content);
// ── DEBUG: temporary TOC diagnostics ──────────────────────────
error_log('[TOC-DEBUG] content length: ' . strlen($content));
error_log('[TOC-DEBUG] line count: ' . count($lines));
foreach (array_slice($lines, 0, 8) as $i => $line) {
if ($line === '') {
error_log('[TOC-DEBUG] line[' . $i . '] (empty)');
} else {
$hex = bin2hex($line);
$preview = mb_substr($line, 0, 60);
error_log('[TOC-DEBUG] line[' . $i . '] hex=' . $hex . ' raw=' . $preview);
}
}
// ── END DEBUG ─────────────────────────────────────────────────
// Use CommonMark's own SlugNormalizer so TOC links match the rendered heading IDs exactly. // Use CommonMark's own SlugNormalizer so TOC links match the rendered heading IDs exactly.
$normalizer = new \League\CommonMark\Normalizer\SlugNormalizer(); $normalizer = new \League\CommonMark\Normalizer\SlugNormalizer();
@@ -41,10 +28,8 @@ class MarkdownHelper
$label = trim($m[2]); $label = trim($m[2]);
$id = $normalizer->normalize($label); $id = $normalizer->normalize($label);
$items[] = ['label' => $label, 'href' => '#' . $id, 'level' => $level]; $items[] = ['label' => $label, 'href' => '#' . $id, 'level' => $level];
error_log('[TOC-DEBUG] MATCH: h' . $level . ' "' . $label . '" -> #' . $id);
} }
} }
error_log('[TOC-DEBUG] total items found: ' . count($items));
return $items; return $items;
} }
} }