示例#1
0
 def handle_entityref(self, ref):
     if ref == 'nbsp':
         self.result += ' '
     else:
         self.result += '&%(ref)s' % locals()
         if entitydefs.has_key(ref):
             self.result += ';'
示例#2
0
	def handle_entityref(self, name):
		""" Called whenever a entity is encountered.
		If entity is recognized, convert it to related value,
		otherwise, just record the stream value. """
		if entitydefs.has_key(name):
			self.handle_data(entitydefs[name])
		else:
			self.handle_data('&%s;'%name)
示例#3
0
 def handle_entityref(self,name): 
     if self.courseGet :
         if name == 'nbsp':
                 self.names += ' '
         elif entitydefs.has_key(name):
             self.names += entitydefs[name]
         else:
             self.names += ' '
示例#4
0
 def handle_entityref(self,name): 
     if self.noteGet :
         if(self.inNote):
             if name == 'nbsp':
                 f**k = self.names.pop() + ' '
             elif entitydefs.has_key(name):
                 f**k = self.names.pop() + entitydefs[name]
             else:
                 f**k = self.names.pop() + ' '
             self.names.append(f**k)
示例#5
0
    def handle_entityref(self, ref):
        r"""
        INPUT:

        - ``ref`` - string

        EXAMPLES::

            sage: from sagenb.notebook.docHTMLProcessor import docutilsHTMLProcessor
            sage: p = docutilsHTMLProcessor()
            sage: p.all_pieces = 'a lot of stuff done '
            sage: p.temp_pieces = ['bunch ', 'of ', 'tmp ', 'strings']
            sage: p.keep_data = True
            sage: p.handle_entityref('160')
            sage: p.all_pieces
            'a lot of stuff done '
            sage: p.temp_pieces
            ['bunch ', 'of ', 'tmp ', 'strings', u'&160']
        """
        if self.keep_data:
            self.temp_pieces.append("&%(ref)s" % locals())
            if entitydefs.has_key(ref):
                self.temp_pieces.append(';')
示例#6
0
 def handle_entityref(self , name):
     if entitydefs.has_key(name):
         self.handle_data(name)
     else :
         self.handle_data("&"+name )
示例#7
0
 def handle_entityref(self,name):
     if entitydefs.has_key(name):
         self.handle_data(entitydefs[name])
示例#8
0
def handle_entitydef(matchobj):
    key = matchobj.group(1)
    if entitydefs.has_key(key):
        return entitydefs[key]
    else:
        return matchobj.group(0)
示例#9
0
 def handle_entityref(self, name):
     if entitydefs.has_key(name):
         self.handle_data(entitydefs[name])
     else:
         self.handle_data('&' + name + ';')
示例#10
0
 def handle_entityref(self, name):
     if entitydefs.has_key(name):
         self.handle_data(entitydefs[name])
     else:
         self.handle_data("&" + name + ":")
示例#11
0
 def handle_entityref(self, ref):
     if self.bodyQ:
         self.temp_pieces.append("&%(ref)s" % locals())
         if entitydefs.has_key(ref):
             self.temp_pieces.append(';')
示例#12
0
	def handle_entityref(self, name):
		if entitydefs.has_key(name):
			print('ref.......', entitydefs[name])
示例#13
0
 def handle_entityref(self, name):
     """ """
     x= ';' * entitydefs.has_key(name)
     self.result.append("&%s%s" % (name, x))
示例#14
0
 def handle_entityref(self, name):
     """Process entity references using Python's entitydefs mapping."""
     if entitydefs.has_key(name):
         self.handle_data(entitydefs[name])
     else:
         self.handle_data('&' + name + ';')
示例#15
0
文件: utitle.py 项目: wwwlwscom/Rk
	def handle_entityref(self, name):
		if entitydefs.has_key(name):
			self.handle_data(entitydefs[name])
		else:
			self.handle_data('&' + name + ';')
示例#16
0
 def handle_entityref(self, ref):
     if self.bodyQ:
         self.temp_pieces.append("&%(ref)s" % locals())
         if entitydefs.has_key(ref):
             self.temp_pieces.append(';')
示例#17
0
 def handle_entityref(self, name):
     """Process entity references using Python's entitydefs mapping."""
     if entitydefs.has_key(name):
         self.handle_data(entitydefs[name])
     else:
         self.handle_data('&' + name + ';')