You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alix Lourme (JIRA)" <ji...@apache.org> on 2018/08/08 14:41:00 UTC

[jira] [Created] (DOXIATOOLS-59) Link checker not handling anchors of fluido skin topbar very well

Alix Lourme created DOXIATOOLS-59:
-------------------------------------

             Summary: 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


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)