Skip to content

Commit 2486ba7

Browse files
committed
Fix for issue 957: leftshift and rightshift links
Main change was a modification to BaseWriter::getAnchorFromName That function is generally better-commented now and should be easier to reason about. Now *all* names that come in the form (some structure) will turn into somestructure.html. Note that this form only appears within the xml docs.
1 parent 541d3a5 commit 2486ba7

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed
5 Bytes
Binary file not shown.
Binary file not shown.

java_generate/ReferenceGenerator/src/writers/BaseWriter.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,27 +150,29 @@ protected static String getName(Doc doc) { // handle
150150
}
151151

152152
protected static String getAnchorFromName(String name){
153-
if( name.endsWith("()") ){
154-
//functions look like functionName_.html
155-
name = name.replace("()", "_");
156-
} else if( name.contains("(") && name.contains(")") ){
157-
//get the name in parentheses
153+
// change functionName() to functionName_
154+
if( name.contains("()") ){
155+
name = name.replaceAll("()", "_");
156+
}
157+
// change "(some thing)" to something
158+
if( name.contains("(") && name.contains(")") ){
158159
int start = name.indexOf("(") + 1;
159160
int end = name.indexOf(")");
160161
name = name.substring(start, end);
161-
} else if( name.endsWith("[]")){
162-
//strip off the array indicators for the name
162+
name = name.replace(" ", "");
163+
}
164+
// change thing[] to thing
165+
if( name.contains("[]")){
163166
name = name.replaceAll("\\[\\]", "");
164167
}
168+
// change "some thing" to "some_thing.html"
165169
return name.replace(" ", "_").concat(".html");
166170
}
167-
168-
//
169171

170172
static protected String getBasicDescriptionFromSource(ProgramElementDoc doc) {
171173
return getBasicDescriptionFromSource(longestText(doc));
172174
}
173-
175+
174176
static protected String getBriefDescriptionFromSource(ProgramElementDoc doc) {
175177
Tag[] sta = doc.tags("brief");
176178
if(sta.length > 0){

java_generate/ReferenceGenerator/src/writers/XMLReferenceWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ protected static String getRelated(Document doc) throws IOException{
239239
String name = related[i];
240240
if(!name.equals("")){
241241
map.put("name", name);
242-
map.put("anchor", getAnchorFromName(name));
242+
map.put("anchor", getAnchorFromName(name) );
243243
vars.add(map);
244244
}
245245
}

0 commit comments

Comments
 (0)