[
https://issues.apache.org/jira/browse/DOXIATOOLS-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16865430#comment-16865430
]
Alix Lourme commented on DOXIATOOLS-59:
---------------------------------------
Hello [~chrisneve],
{quote}
Run mvn linkcheck:linkcheck, which succeeds instead of failing as I understood
it would.
{quote}
_linkcheck_ does not fail by itself if some bad links are found. Another _task_
like this snipet should be used:
{code}
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>post-site</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Check if website contains some local broken
link(s)..." />
<fail message="Broken link(s) found in website (see
'target/site/linkcheck.html' for details)">
<condition>
<resourcecontains
resource="${project.build.directory}/linkcheck/linkcheck.xml"
substring=">error" />
</condition>
</fail>
</target>
</configuration>
</execution>
</executions>
</plugin>
{code}
----
{quote}
Did I reproduce the error wrong? Or does this issue no longer seem to exist?
{quote}
Issue always exists. In generated file {{bugfix/target/site/index.html}} the
*Overview* title is with a single anchor on _href_:
{code}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b
class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="http://www.apache.org" title="Apache">Apache</a></li>
<li><a href="https://maven.apache.org" title="Maven">Maven</a></li>
</ul>
</li>
{code}
In Linkcheck XML file ({{target/linkcheck/linkcheck.xml}}) this link is in
error:
{code}
<file>
<absolutePath>[somewhere]\bugfix\target\linkcheck\tmpsite\index.html</absolutePath>
<relativePath>index.html</relativePath>
<successful>5</successful>
<unsuccessful>4</unsuccessful>
<results>
<result>
<target>#</target>
<status>error</status>
<errorMessage>doesn't exist.</errorMessage>
</result>
{code}
Best regards
> Link checker not handling anchors of fluido skin topbar very well
> -----------------------------------------------------------------
>
> Key: DOXIATOOLS-59
> URL: https://issues.apache.org/jira/browse/DOXIATOOLS-59
> Project: Maven Doxia Tools
> Issue Type: Improvement
> Components: Doxia Linkcheck
> Affects Versions: doxia-linkcheck-1.2
> Reporter: Alix Lourme
> Priority: Minor
> Labels: up-for-grabs
> Attachments: bugfix.zip
>
>
> When you are using
> [maven-fluido-skin|https://maven.apache.org/skins/maven-fluido-skin/] with
> [topbar|https://maven.apache.org/skins/maven-fluido-skin/topbar/index.html],
> category menus are produced with a *single anchor* (*#*) like that:
> {code}
> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b
> class="caret"></b></a>
> {code}
> In this case, _maven-linkcheck-plugin_ fails. You can simply reproduce the
> problem with this _site.xml_:
> {code}
> <project>
> <skin>
> <groupId>org.apache.maven.skins</groupId>
> <artifactId>maven-fluido-skin</artifactId>
> <version>1.7</version>
> </skin>
> <custom>
> <fluidoSkin>
> <topBarEnabled>true</topBarEnabled>
> <sideBarEnabled>false</sideBarEnabled>
> </fluidoSkin>
> </custom>
> <body>
> <menu name="Overview">
> <item name="Apache" href="http://www.apache.org" />
> <item name="Maven" href="https://maven.apache.org" />
> </menu>
> </body>
> </project>
> {code}
> ----
> You can use *excludedLink* property, but the pattern to use in
> [LinkValidatorManager.matchPattern|https://github.com/apache/maven-doxia-linkcheck/blob/1afc9f52cecea900b0c21926973afc5460c7a12e/src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java#L337]
> is a little tricky to found :
> * # : All links page are excluded
> * ^#$ : Not found ... Java pattern seems not really used
> * *# : Do the trick finally
> Snippet for proof:
> {code}
> String pattern = "#";
> System.out.println(matchPattern("#", pattern)); // --> true
> System.out.println(matchPattern("#localLink", pattern)); // --> true
> System.out.println(matchPattern("http://fake.url.org/index.html#",
> pattern)); // --> true
>
> System.out.println(matchPattern("http://fake.url.org/index.html#link",
> pattern)); // --> true
> pattern = "^#$";
> System.out.println(matchPattern("#", pattern)); // --> false
> System.out.println(matchPattern("#localLink", pattern)); // --> false
> System.out.println(matchPattern("http://fake.url.org/index.html#",
> pattern)); // --> false
>
> System.out.println(matchPattern("http://fake.url.org/index.html#link",
> pattern)); // --> false
> pattern = "*#";
> System.out.println(matchPattern("#", pattern)); // --> true
> System.out.println(matchPattern("#localLink", pattern)); // --> false
> System.out.println(matchPattern("http://fake.url.org/index.html#",
> pattern)); // --> false ... corner case ?
>
> System.out.println(matchPattern("http://fake.url.org/index.html#link",
> pattern)); // --> false
> {code}
> ----
> Perhaps consider a single anchor (#) as valid link by default could be useful
> and avoiding some headlock.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)