6.14.6.2.1. Reference processor

Start python section to interscript/weavers/web.py[2 /8 ] Next Prev First Last
   214: #line 301 "web_weaver.ipk"
   215:   def set_original_filename(self, filename):
   216:     self.original_filename = filename
   217: 
   218:   def set_anchor(self, label):
   219:     # the rubbish below yields the current filename plus #label
   220:     # the filename should be calculated exactly once on instantiation:
   221:     # this mechanism will fail if the formula for finding the filename
   222:     # changes or a special filename is used for some reason
   223:     href = self.pattern%('%04d'%(self.childcount))+'#'+label
   224:     self._write('<A NAME="'+label+'"></A>')
   225:     self.register_anchor(label, href)
   226: 
   227:   def register_anchor(self, label, anchor):
   228:     if not self.persistent_frame.has_key('anchors'):
   229:       self.persistent_frame['anchors']  = {}
   230:     self.persistent_frame['anchors'][label]=anchor
   231: 
   232:   def get_anchor(self, label):
   233:     href = None
   234:     if self.persistent_frame.has_key('anchors'):
   235:       if self.persistent_frame['anchors'].has_key(label):
   236:         href =self.persistent_frame['anchors'][label]
   237:     return href
   238: 
   239:   def ref_anchor(self, label):
   240:     href = self.get_anchor(label)
   241:     if href:
   242:       self._write('<A HREF="'+href+'">'+label+'</A>')
   243:     else:
   244:       self._write('<EM>Unknown Label:'+label+'</EM>')
   245: 
End python section to interscript/weavers/web.py[2]