def do_heading(self, text, sty): # create bookmarkname bn = sha1(text.encode('utf-8') + sty.name.encode('utf-8')).hexdigest() # modify paragraph text to include an anchor point with name bn h = Paragraph(text + '<a name="%s"/>' % bn, sty) # store the bookmark name on the flowable so afterFlowable can see this h._bookmarkName = bn self.story.append(h)
def doHeading(text,sty): from hashlib import sha1 #create bookmarkname bn=sha1(text+sty.name).hexdigest() #modify paragraph text to include an anchor point with name bn h=Paragraph(text+'<a name="%s"/>' % bn,sty) #store the bookmark name on the flowable so afterFlowable can see this h._bookmarkName=bn story.append(h)
def doHeading(text, sty): from hashlib import sha1 #create bookmarkname bn = sha1((text + sty.name).encode('utf-8')).hexdigest() #modify paragraph text to include an anchor point with name bn h = Paragraph(text + '<a name="%s"/>' % bn, sty) #store the bookmark name on the flowable so afterFlowable can see this h._bookmarkName = bn story.append(h)
def _do_heading(self, text, sty): if isinstance(text, list): text = "_".join(text) # create bookmarkname bn = sha1(text + sty.name).hexdigest() # modify paragraph text to include an anchor point with name bn h = Paragraph(text + '<a name="%s"/>' % bn, sty) # store the bookmark name on the flowable so afterFlowable can see this h._bookmarkName = bn self.story.append(h)