Skip to content

Commit

Permalink
Merge pull request #28 from spdx/htmlfix
Browse files Browse the repository at this point in the history
Improve the HTML only file format
  • Loading branch information
goneall authored Apr 14, 2018
2 parents 7b196ef + 7f0b4f9 commit f56759c
Showing 1 changed file with 11 additions and 2 deletions.
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);
}
}

}

0 comments on commit f56759c

Please # to comment.