def add_tagged_report_number(reading_line, len_reportnum, reportnum,
    startpos, true_replacement_index, extras):
    """In rebuilding the line, add an identified institutional REPORT-NUMBER
       (standardised and tagged) into the line.
       @param reading_line: (string) The reference line before capitalization
        was performed, and before REPORT-NUMBERs and TITLEs were stipped out.
       @param len_reportnum: (integer) the length of the matched REPORT-NUMBER.
       @param reportnum: (string) the replacement text for the matched
        REPORT-NUMBER.
       @param startpos: (integer) the pointer to the next position in the
        reading-line from which to start rebuilding.
       @param true_replacement_index: (integer) the replacement index of the
        matched REPORT-NUMBER in the reading-line, with stripped punctuation
        and whitespace accounted for.
       @param extras: (integer) extras to be added into the replacement index.
       @return: (tuple) containing a string (the rebuilt line segment) and an
        integer (the next 'startpos' in the reading-line).
    """
    rebuilt_line = u''
    if true_replacement_index - startpos - 1 >= 0:
        rebuilt_line += reading_line[startpos:true_replacement_index - 1]
    else:
        rebuilt_line += reading_line[startpos:true_replacement_index]
    rebuilt_line += u'<cds.REPORTNUMBER>%(reportnum)s</cds.REPORTNUMBER>' % {
        'reportnum': reportnum}
    startpos = true_replacement_index + len_reportnum + extras
    try:
        if reading_line[startpos] in (u']', u')'):
            startpos += 1
    except IndexError:
        pass
    return rebuilt_line, startpos
