Next / Previous / Contents / Shipman's homepage

7.9. indexer: outRow()

indexer
# - - -   o u t R o w

def outRow(tbody, uniEntity):
    '''Format one row of the report.

      [ (tbody is an et.Element) and
        (uniEntity is a unidata.UniEntity instance) ->
          tbody  +:=  a row displaying the code point, entity name,
              character, and full name for uniEnt ]
    '''

Formats one row of any of the index table. For the generated row format, see Section 7.8, “indexer: blockReport.

indexer
    #-- 1
    # [ tbody  +:=  a new row et.Element
    #   row  :=  that et.Element
    #   uniChar  :=  uniEntity.uniChar ]
    row = subElement(tbody, E.row())
    uniChar = uniEntity.uniChar

    #-- 2
    # [ row  +:=  a new entry et.Element containing the code point
    #       name for uniEntity ]
    row.append(
        E.entry(
            E.code("&#x{char.cp:04X};".format(
            char=uniChar))))

    #-- 3
    # [ row  +:=  a new entry et.Element containing the entity ID
    #             from uniEntity ]
    row.append(
        E.entry(
            E.code("&{e.id};".format(e=uniEntity))))

    #-- 4
    # [ row  +:=  a new entry et.Element containing uniChar ]
    row.append(
        E.entry(unichr(uniChar.cp)))

    #-- 5
    # [ row  +:=  a new entry et.Element containing uniChar.fullName ]
    row.append(
        E.entry(uniChar.fullName))