浏览代码

Latex contents header

Andrew Grant 3 周之前
父节点
当前提交
333f60ce14

+ 9 - 1
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/PersonSectionContentsWriterImpl.java

@@ -8,10 +8,12 @@ package scot.carricksoftware.grantswriter.writer.latex.parts.people.subsections;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.springframework.stereotype.Component;
+import scot.carricksoftware.grantswriter.constants.LatexLevels;
 import scot.carricksoftware.grantswriter.domains.people.Person;
 import scot.carricksoftware.grantswriter.domains.text.PersonText;
 import scot.carricksoftware.grantswriter.services.text.PersonTextService;
 import scot.carricksoftware.grantswriter.writer.FileWriter;
+import scot.carricksoftware.grantswriter.writer.latex.LatexDivisionHeader;
 
 import java.util.List;
 
@@ -24,9 +26,12 @@ public class PersonSectionContentsWriterImpl implements PersonSectionContentsWri
 
     private final FileWriter fileWriter;
 
-    public PersonSectionContentsWriterImpl(PersonTextService personTextService, FileWriter fileWriter) {
+    private final LatexDivisionHeader latexDivisionHeader;
+
+    public PersonSectionContentsWriterImpl(PersonTextService personTextService, FileWriter fileWriter, LatexDivisionHeader latexDivisionHeader) {
         this.personTextService = personTextService;
         this.fileWriter = fileWriter;
+        this.latexDivisionHeader = latexDivisionHeader;
     }
 
 
@@ -36,6 +41,9 @@ public class PersonSectionContentsWriterImpl implements PersonSectionContentsWri
         List<PersonText> contents = personTextService.findAllByPerson(person);
         if (!contents.isEmpty()) {
             for (PersonText personText : contents) {
+                if (personText.getHeading() != null) {
+                    latexDivisionHeader.write(LatexLevels.LATEX_SECTION, personText.getHeading());
+                }
                 writeContent (personText);
             }
         }