Skip to content

Commit

Permalink
8231122: @Index tag with newline causes tag search to fail
Browse files Browse the repository at this point in the history
Reviewed-by: jjg
  • Loading branch information
hns committed Sep 24, 2019
1 parent a63b541 commit 8743f0b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
Expand Up @@ -110,7 +110,8 @@ protected Content indexTagOutput(Element element, DocTree tag) {

String tagText = ch.getText(itt.getSearchTerm());
if (tagText.charAt(0) == '"' && tagText.charAt(tagText.length() - 1) == '"') {
tagText = tagText.substring(1, tagText.length() - 1);
tagText = tagText.substring(1, tagText.length() - 1)
.replaceAll("\\s+", " ");
}
String desc = ch.getText(itt.getDescription());

Expand Down
Expand Up @@ -312,7 +312,7 @@ public Content createLink(DocLink link, Content label, boolean isExternal) {
* @return a valid HTML name
*/
public String getName(String name) {
return name.replaceAll(" +", "");
return name.replaceAll("\\s+", "");
}

}
Expand Up @@ -149,11 +149,12 @@ public void testModuleSearch() throws ScriptException, IOException, NoSuchMethod
checkSearch(inv, "operty", List.of());

// search tag
checkSearch(inv, "search tag", List.of("search tag"));
checkSearch(inv, "search tag", List.of("search tag"));
checkSearch(inv, "search ", List.of("search tag"));
checkSearch(inv, "tag", List.of("search tag"));
checkSearch(inv, "sea", List.of("search tag"));
checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
checkSearch(inv, "search ", List.of("multiline search tag", "search tag"));
checkSearch(inv, "tag", List.of("multiline search tag", "search tag"));
checkSearch(inv, "sea", List.of("multiline search tag", "search tag"));
checkSearch(inv, "multi", List.of("multiline search tag"));
checkSearch(inv, "ear", List.of());
}

Expand Down Expand Up @@ -244,7 +245,7 @@ public void testPackageSource() throws ScriptException, IOException, NoSuchMetho
List.of("listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)"));
checkSearch(inv, "l . o (e,e,e,",
List.of("listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)"));
checkSearch(inv, "search \tt", List.of("search tag"));
checkSearch(inv, "search \tt", List.of("other search tag"));
checkSearch(inv, "sear ch", List.of());
checkSearch(inv, "( e ..", List.of("listpkg.List.of(E...)"));
checkSearch(inv, "( i [ ]", List.of("listpkg.Nolist.withArrayArg(int[])"));
Expand Down
Expand Up @@ -27,9 +27,8 @@
import java.util.Map;

/**
* Example class containing "list" but not matching at any word boundary.
*
* {@index "search tag"}.
* Example class containing "list" but not matching at any word boundary. {@index "other
* search tag"}.
*/
public class Nolist {

Expand Down
Expand Up @@ -25,6 +25,13 @@

import java.util.Iterator;

/**
* Map interface.
*
* {@index "multiline
* search
* tag"}
*/
public interface Map {
public void put(Object key, Object value);
public boolean contains(Object key);
Expand Down

0 comments on commit 8743f0b

Please sign in to comment.