[doc] Fix dead links checker

This commit is contained in:
Andreas Dangel 2023-11-18 11:21:17 +01:00
parent 0aa781c3ab
commit bdc08e44fd
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3
2 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,9 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<classpathScope>test</classpathScope>
</configuration>
<executions>
<execution>
<id>generate-rule-docs</id>
@ -97,6 +100,11 @@
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>

View File

@ -276,6 +276,7 @@ public class DeadLinksChecker {
while (captionMatcher.find()) {
final String anchor = captionMatcher.group(1)
.toLowerCase(Locale.ROOT)
.replaceAll("'", "") // remove all apostrophes
.replaceAll("[^a-z0-9_]+", "-") // replace all non-alphanumeric characters with dashes
.replaceAll("^-+|-+$", ""); // trim leading or trailing dashes