def __init__(self, document): nodes.NodeVisitor.__init__(self, document) self.settings = document.settings if self.settings.word_template and not os.path.isabs( self.settings.word_template): self.settings.word_template = os.path.join( os.path.abspath(os.curdir), self.settings.word_template) elif not self.settings.word_template: if self.settings._destination.endswith(".docx"): template_extension = ".dotx" else: template_extension = ".dot" self.settings.word_template = get_default_template( template_extension) self.word = Word(self.settings.word_template) self.document = document self.root_path = os.path.abspath( os.path.dirname(self.document.attributes["source"])) self.destination = self.settings._destination if not os.path.isabs(self.destination): self.destination = os.path.join(os.path.abspath(os.curdir), self.destination) name, extension = self.destination.rsplit(".", 1) if extension == "pdf": self.pdf_destination = self.destination else: self.pdf_destination = None self.section_level = 0 self.cur_table_dimensions = (0, 0) self.in_table = False self.cur_row = 0 self.cur_column = 0 self.list_level = 0 self.in_doc_property = False self.doc_property_name = None self.property_separator = None self.first_property = False self.skip_text = False self.in_litteral_block = False self.in_list = False self.in_admonition = False self.bookmarks = {} self.in_link = False self.in_table_head = False self.remove_carriage_return = False self.sections = [Section()]