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

Improve the HTML only file format #28

Merged
merged 1 commit into from
Apr 14, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.nio.charset.Charset;
import java.util.Set;

import org.spdx.html.InvalidLicenseTemplateException;
import org.spdx.licenseTemplate.SpdxLicenseTemplateHelper;
import org.spdx.rdfparser.license.LicenseException;
import org.spdx.rdfparser.license.SpdxListedLicense;
Expand Down Expand Up @@ -82,7 +83,11 @@ public void writeLicense(SpdxListedLicense license, boolean deprecated, String d
String licBaseHtmlFileName = formLicenseHTMLFileName(license.getLicenseId());
String licHtmlFileName = licBaseHtmlFileName + ".html";
File htmlTextFile = new File(htmlFolder.getPath() + File.separator + licHtmlFileName);
Files.write(SpdxLicenseTemplateHelper.formatEscapeHTML(license.getLicenseText()), htmlTextFile, utf8);
try {
Files.write(license.getLicenseTextHtml(), htmlTextFile, utf8);
} catch (InvalidLicenseTemplateException e) {
Files.write(SpdxLicenseTemplateHelper.formatEscapeHTML(license.getLicenseText()), htmlTextFile, utf8);
}
}

/**
Expand Down Expand Up @@ -118,7 +123,11 @@ public void writeException(LicenseException exception, boolean deprecated, Strin
throws IOException {
String exceptionHtmlFileName = formLicenseHTMLFileName(exception.getLicenseExceptionId());
File htmlTextFile = new File(htmlFolder.getPath() + File.separator + exceptionHtmlFileName + ".html");
Files.write(SpdxLicenseTemplateHelper.formatEscapeHTML(exception.getLicenseExceptionText()), htmlTextFile, utf8);
try {
Files.write(exception.getExceptionTextHtml(), htmlTextFile, utf8);
} catch (InvalidLicenseTemplateException e) {
Files.write(SpdxLicenseTemplateHelper.formatEscapeHTML(exception.getLicenseExceptionText()), htmlTextFile, utf8);
}
}

}