import kutil import klammer_base import phases class Document(klammer_base.Klammer_base): def __init__(self, K): super().__init__(K) if self.files: raise Exception("The :files option is not defined for the 'txt' target") def html(self): raise Exception("Implemented by document.cpp") def tex(self): raise Exception("Implemented by document.cpp") def txt(self): # The document marker: section numbering under txt is a document # service, and the numbering phase numbers only when it finds this # at the head of the text (a fragment, as kdesc renders, has none). result = phases.txt_document_marker() + "\n" if self.title: result += f"@b {self.title} @ @nl@\n" if self.subtitle: result += f"@b {self.subtitle} @ @nl@\n" result += "\n" if self.author: result += f"@i {self.author} @ @nl@\n" if self.date: result += f"@i {self.date} @ @nl@\n" result += "\n" result += self.text return result