From 089c844892ce52bb46101589ab5f7f9d71a68047 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Jan 2011 21:47:43 +0000 Subject: [PATCH] MINOR Making anchors more readable and predictable by using lowercase only --- code/DocumentationParser.php | 1 + tests/DocumentationParserTest.php | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/DocumentationParser.php b/code/DocumentationParser.php index d4988a6..d30756e 100644 --- a/code/DocumentationParser.php +++ b/code/DocumentationParser.php @@ -235,6 +235,7 @@ class DocumentationParser { $t = ereg_replace('[^A-Za-z0-9]+','-',$t); $t = ereg_replace('-+','-',$t); $t = trim($t, '-'); + $t = strtolower($t); return $t; } diff --git a/tests/DocumentationParserTest.php b/tests/DocumentationParserTest.php index 0d47ed0..b0a81c8 100644 --- a/tests/DocumentationParserTest.php +++ b/tests/DocumentationParserTest.php @@ -104,14 +104,14 @@ HTML; */ - $this->assertContains('# Heading one {#Heading-one}', $result); + $this->assertContains('# Heading one {#heading-one}', $result); $this->assertContains('# Heading with custom anchor {#custom-anchor}', $result); - $this->assertNotContains('# Heading with custom anchor {#custom-anchor} {#Heading', $result); - $this->assertContains('# Heading two {#Heading-two}', $result); - $this->assertContains('# Heading three {#Heading-three}', $result); - $this->assertContains('## Heading duplicate {#Heading-duplicate}', $result); - $this->assertContains('## Heading duplicate {#Heading-duplicate-2}', $result); - $this->assertContains('## Heading duplicate {#Heading-duplicate-3}', $result); + $this->assertNotContains('# Heading with custom anchor {#custom-anchor} {#heading', $result); + $this->assertContains('# Heading two {#heading-two}', $result); + $this->assertContains('# Heading three {#heading-three}', $result); + $this->assertContains('## Heading duplicate {#heading-duplicate}', $result); + $this->assertContains('## Heading duplicate {#heading-duplicate-2}', $result); + $this->assertContains('## Heading duplicate {#heading-duplicate-3}', $result); }