*) nicer anchors (TOC)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1852 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 19 years ago
parent 6000a38a05
commit 1c3b415c35

@ -515,7 +515,7 @@ public class wikiCode {
//counting double headlines
doubles = 0;
for(int j=0;j<i;j++){
if(dirElements.get(j).toString().substring(1).equals(element.substring(1))){
if(dirElements.get(j).toString().substring(1).replaceAll(" ","_").replaceAll("[^a-zA-Z0-1_]","").equals(element.substring(1).replaceAll(" ","_").replaceAll("[^a-zA-Z0-1_]",""))){
doubles++;
}
}
@ -532,7 +532,7 @@ public class wikiCode {
level3++;
String temp = element.substring(1);
element=level1+"."+level2+"."+level3+" "+temp;
directory = directory + "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#"+replaceHTML(temp.replaceAll(" ","_"))+anchorext+"\" class=\"WikiTOC\">"+element+"</a><br>\n";
directory = directory + "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#"+temp.replaceAll(" ","_").replaceAll("[^a-zA-Z0-1_]","")+anchorext+"\" class=\"WikiTOC\">"+element+"</a><br>\n";
}
else if (element.startsWith("2")){
if(level==1){
@ -545,7 +545,7 @@ public class wikiCode {
level2++;
String temp = element.substring(1);
element=level1+"."+level2+" "+temp;
directory = directory + "&nbsp;&nbsp;<a href=\"#"+replaceHTML(temp.replaceAll(" ","_"))+anchorext+"\" class=\"WikiTOC\">"+element+"</a><br>\n";
directory = directory + "&nbsp;&nbsp;<a href=\"#"+temp.replaceAll(" ","_").replaceAll("[^a-zA-Z0-1_]","")+anchorext+"\" class=\"WikiTOC\">"+element+"</a><br>\n";
}
else if (element.startsWith("1")) {
if (level>1) {
@ -556,7 +556,7 @@ public class wikiCode {
level1++;
String temp = element.substring(1);
element=level1+". "+temp;
directory = directory + "<a href=\"#"+replaceHTML(temp.replaceAll(" ","_"))+anchorext+"\" class=\"WikiTOC\">"+element+"</a><br>\n";
directory = directory + "<a href=\"#"+temp.replaceAll(" ","_").replaceAll("[^a-zA-Z0-1_]","")+anchorext+"\" class=\"WikiTOC\">"+element+"</a><br>\n";
}
anchorext="";
}
@ -594,7 +594,7 @@ public class wikiCode {
doubles++;
}
}
String anchor = replaceHTML(direlem.replaceAll(" ","_")); //replace blanks with underscores
String anchor = direlem.replaceAll(" ","_").replaceAll("[^a-zA-Z0-1_]",""); //replace blanks with underscores and delete everything thats not a regular character, a number or _
//if there are doubles, add underscore and number of doubles plus one
if(doubles>0){
anchor = anchor + "_" + (doubles+1);

Loading…
Cancel
Save