def lookupref(self, ref, target): if ref in self.references.keys(): return self.references[ref] if self.refpar is not None: self.refpar.addprevious(docx.paragraph(target, style='EUReference')) self.references[ref] = len(self.references) + 1 return self.references[ref]
def ulistitem(self, line): # print line result = rx_line["ulist"].match(line) if result is not None: indent = len(result.group(1)) level = indent / 2 lineparts = self.processwikitext(result.group(2)) return docx.paragraph(lineparts, style='EUListBullet1') else: return None
def pre(self, lines): return docx.paragraph(lines, style='EUCode')
def paragraph(self, lines): parparts = [] for l in lines: parparts += self.processwikitext(l) return docx.paragraph(parparts, style='EUNormal')
def docx_add_figure(self,imagefilename,description): self.docx['relationships'], picpara = docx.picture(self.docx['relationships'], imagefilename, description) self.docx['body'].append(docx.pagebreak(type='page', orient='portrait')) self.docx['body'].append(picpara) self.docx['body'].append(docx.paragraph(description))
def docx_add_paragraph(self,paragraphtext): self.docx['body'].append(docx.paragraph(paragraphtext))