Commit 8f40d453 authored by expectocode's avatar expectocode

Use composition instead of inheritance for markdown in PDFResultPage

parent 37b39baf
Pipeline #113540 passed with stages
in 4 minutes and 31 seconds
......@@ -8,13 +8,15 @@ import java.nio.file.Files;
import javax.servlet.http.HttpServletResponse;
public class PDFResultPage extends MarkdownResultPage {
public class PDFResultPage {
private static final String TEMP_MD_PATH = "/tmp/result.md";
private static final String TEMP_PDF_PATH = "/tmp/result.pdf";
private final MarkdownResultPage mdResultPage;
public PDFResultPage(String query, String answer) {
super(query, answer);
mdResultPage = new MarkdownResultPage(query, answer);
}
public void writeTo(HttpServletResponse resp) throws IOException {
......@@ -23,7 +25,7 @@ public class PDFResultPage extends MarkdownResultPage {
File md = new File(TEMP_MD_PATH);
FileWriter fileWriter = new FileWriter(md);
fileWriter.write(createMarkdownText());
fileWriter.write(mdResultPage.createMarkdownText());
fileWriter.close();
File pdf = convertToPDF(md);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment