Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sort the exceptions-index.html and index.html pages #45

Merged
merged 2 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/org/spdx/htmltemplates/ExceptionHtmlToc.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -244,6 +245,14 @@ public void writeToFile(File exceptionTocFile, String version) throws MustacheEx

Map<String, Object> mustacheMap = Maps.newHashMap();
mustacheMap.put("version", StringEscapeUtils.escapeHtml4(version));
exceptions.sort(new Comparator<ExceptionRow>() {

@Override
public int compare(ExceptionRow arg0, ExceptionRow arg1) {
return arg0.getLicenseExceptionId().compareTo(arg1.getLicenseExceptionId());
}

});
mustacheMap.put("listedExceptions", exceptions);
mustacheMap.put("deprecatedExceptions", deprecatedExceptions);
FileOutputStream stream = null;
Expand Down
11 changes: 9 additions & 2 deletions src/org/spdx/htmltemplates/LicenseTOCHTMLFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -304,6 +305,14 @@ public void writeToFile(File htmlFile) throws IOException, MustacheException {
private Map<String, Object> buildMustachMap() {
Map<String, Object> retval = Maps.newHashMap();
retval.put("version", generateVersionString(version, releaseDate));
this.listedLicenses.sort(new Comparator<ListedSpdxLicense>() {

@Override
public int compare(ListedSpdxLicense arg0, ListedSpdxLicense arg1) {
return arg0.getLicenseId().compareToIgnoreCase(arg1.getLicenseId());
}

});
retval.put("listedLicenses", this.listedLicenses);
retval.put("deprecatedLicenses", this.deprecatedLicenses);
return retval;
Expand All @@ -320,6 +329,4 @@ public void addDeprecatedLicense(SpdxListedLicense deprecatedLicense,
deprecatedLicense.getDeprecatedVersion()));
currentRefNumber++;
}


}