Exemplo n.º 1
0
 def comment_entry(self, tuple4, buffer):
     """Process the given production and it's children"""
     (tag, start, stop, subtags) = tuple4
     the_type = getString(subtags[0], buffer)
     lineno = spdp.lines(0, start, buffer) + 1
     if the_type.upper() != 'COMMENT':
         bibfile_logger.warning("""Entry at line %d has comment syntax
         but entry_type is %s:
         Details: %s""" % (lineno, the_type, getString(subtags[1], buffer)))
     else:
         bibfile_logger.info("Comment entry on line %d:" % lineno + " " +
                             getString(subtags[1], buffer))
Exemplo n.º 2
0
 def preamble(self, tuple4, buffer):
     """Process the given production and it's children"""
     (tag, start, stop, subtags) = tuple4
     the_type = getString(subtags[0], buffer)
     lineno = lines(0, start, buffer) + 1
     if the_type.upper() != 'PREAMBLE':
         bibfile_logger.warning(
             "Entry at line %d has preamble syntax but entry_type is %s" %
             (lineno, the_type))
     else:
         bibfile_logger.warning("Preamble entry on line %d:" % lineno +
                                "\n" + buffer[start:stop])
Exemplo n.º 3
0
					k,v = dispatch(self, field, buffer)
					#:note: entry will force k to lowercase
					entry[k] = v
				self.entries.append(entry)
				bibfile_logger.warning("Dummy key added to entry at line %d" % lineno)
		else :  # otherwise it is really a macro entry
			for field in subtags[1][3]:
				name, str = dispatch(self, field, buffer)
				self._macroMap[name] = str  
		"""
        self._macroMap[name] = str

    def preamble(self, (tag, start, stop, subtags), buffer):
        """Process the given production and it's children"""
        the_type = getString(subtags[0], buffer)
        lineno = lines(0, start, buffer) + 1
        if the_type.upper() != 'PREAMBLE':
            bibfile_logger.warning(
                "Entry at line %d has preamble syntax but entry_type is %s" %
                (lineno, the_type))
        else:
            bibfile_logger.warning("Preamble entry on line %d:" % lineno +
                                   "\n" + buffer[start:stop])

    def comment_entry(self, (tag, start, stop, subtags), buffer):
        """Process the given production and it's children"""
        the_type = getString(subtags[0], buffer)
        if isinstance(buffer, unicode):
            # function below can't tollerate unicode
            buffer_unicode = buffer
            import codecs
Exemplo n.º 4
0
 def __init__(self, start, end, buf, message):
     line = lines(start, end, buf)
     Exception.__init__(self, ("[line %s] " % line) + message)
Exemplo n.º 5
0
		entry.entry_type = dispatch(self, subtags[0], buffer)
		entry.citekey  = dispatch(self, subtags[1], buffer)
		for field in subtags[2][3] :
			#bibfile_logger.debug("entry: ready to add field: "+str(dispatch(self, field, buffer)))
			k,v = dispatch(self, field, buffer)
			#:note: entry will force k to lowercase
			entry[k] = v
		self.entries.append(entry)
	

	def macro( self, (tag,start,stop,subtags), buffer ):
		"""Process a macro entry and add macros to macro map"""
		the_type = getString(subtags[0], buffer)
		if  the_type.upper() != 'STRING' :
			# it looks like  a macro, but is not: could be a regular entry with no key
			lineno = lines(0, start, buffer)+1
			bibfile_logger.warning("Entry at line %d has macro syntax, but entry_type is %s" % (lineno ,  the_type))
			if not __strict__: # we can add a dummy key and treat this entry as a regular entry
				entry = BibEntry()
				entry.entry_type = dispatch(self, subtags[0], buffer)
				entry.citekey  = 'KEY'  # dummy key -- or should we be strict?
				for field in subtags[1][3] :
					k,v = dispatch(self, field, buffer)
					#:note: entry will force k to lowercase
					entry[k] = v
				self.entries.append(entry)
				bibfile_logger.warning("Dummy key added to entry at line %d" % lineno)
		else :  # otherwise it is really a macro entry
			for field in subtags[1][3]:
				name, str = dispatch(self, field, buffer)
				self._macroMap[name] = str