def __init__(self, part, title, doc=None): self.part = part self.title = title self.slug = slugify(title) self.doc = doc self.sections = [] self.sections_by_slug = {} part.chapters_by_slug[self.slug] = self
def __init__(self, doc, title, is_reference=False): self.doc = doc self.title = title self.slug = slugify(title) self.chapters = [] self.chapters_by_slug = {} self.is_reference = is_reference self.is_appendix = False doc.parts_by_slug[self.slug] = self
def __init__(self, chapter, title, text, operator=None): self.chapter = chapter self.title = title self.slug = slugify(title) if text.count("<dl>") != text.count("</dl>"): raise ValueError("Missing opening or closing <dl> tag in " "{} documentation".format(title)) self.doc = Doc(text) self.operator = operator chapter.sections_by_slug[self.slug] = self