'Return a serial number, e.g. for index entry targets.
The number is guaranteed to be unique in the current document.'

def new_serialno(self, category=''):

    key = (category + 'serialno')
    cur = self.temp_data.get(key, 0)
    self.temp_data[key] = (cur + 1)
    return cur
