From 3acabdf74eeddb930698cf7931ded7be7633bdc6 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 10 Aug 2020 22:26:29 +0200 Subject: [PATCH] Better title page --- nw/core/project.py | 9 +++++++-- sample/nwProject.nwx | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/nw/core/project.py b/nw/core/project.py index 3943f50c..63050a34 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -255,6 +255,11 @@ class NWProject(): self.setBookTitle(projTitle) self.setBookAuthors(projAuthors) + titlePage = "# %s\n\n" % (self.bookTitle if self.bookTitle else self.projName) + if self.bookAuthors: + titlePage = "%sBy %s\n" % (titlePage, ", ".join(self.bookAuthors)) + + # Document object for writing files aDoc = NWDoc(self, self.theParent) if popMinimal: @@ -273,7 +278,7 @@ class NWProject(): self.projTree.setFileItemLayout(cHandle, nwItemLayout.CHAPTER) aDoc.openDocument(tHandle, showStatus=False) - aDoc.saveDocument("# %s\n\n" % projName) + aDoc.saveDocument(titlePage) aDoc.clearDocument() aDoc.openDocument(cHandle, showStatus=False) @@ -300,7 +305,7 @@ class NWProject(): self.projTree.setFileItemLayout(tHandle, nwItemLayout.TITLE) aDoc.openDocument(tHandle, showStatus=False) - aDoc.saveDocument("# %s\n\n" % projName) + aDoc.saveDocument(titlePage) aDoc.clearDocument() # Create chapters and scenes diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 5be0eab5..d52d4f27 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 675 + 676 122 - 32866 + 32870 False