For general notes on the rendering of a birdnotes.AgeSexGroup instance, see Section 4.10, “XHTML rendering of form data”.
# - - - M o n t h C e l l . _ _ a g e S e x G r o u p
SEX_CODE_MAP = { 'u': u'', 'm': u'\u2642', 'f': u'\u2640' }
def __ageSexGroup ( self, parent, ageSexGroup ):
'''Render a birdnotes.AgeSexGroup instance into XHTML.
[ (parent is an et.Element) and
(ageSexGroup is a birdNotes.AgeSexGroup instance) ->
parent +:= XHTML rendering of sight.ageSexGroup ]
'''
For general notes on the generated output, see Section 4.10, “XHTML rendering of form data”. First we render the count of individuals, if any.
#-- 1 --
# [ if ageSexGroup.count is not None ->
# parent +:= ageSexGroup.count
# else -> I ]
if ageSexGroup.count is not None:
tccpage2.addTextMixed ( parent, ageSexGroup.count )
The age code comes next. Code 'p' is
rendered as Greek letter phi (ϕ).
#-- 2 --
# [ if ageSexGroup.age is None ->
# I
# else if ageSexGroup.age is 'p' ->
# parent +:= Greek letter phi
# else ->
# parent +:= ageSexGroup.age ]
if ageSexGroup.age is not None:
if ageSexGroup.age == 'p':
tccpage2.addTextMixed ( parent, PHI )
else:
tccpage2.addTextMixed ( parent, ageSexGroup.age )
Add the sex code, questionability status, and
fide details. Although
the Unicode entities for the male symbol
“♂” (♂)
and female symbol “♀” (♀) don't currently render correctly
in the PDF for this document, as of May 2011 all the
browsers I checked (Camino, Chrome, Firefox, Opera, and
Safari) do correctly display these symbols.
#-- 3 --
# [ if ageSexGroup.sex is not None ->
# parent +:= ageSexGroup.sex
# else -> I ]
if ageSexGroup.sex is not None:
tccpage2.addTextMixed ( parent,
self.SEX_CODE_MAP[ageSexGroup.sex] )
#-- 4 --
# [ if ageSexGroup.q is '?' ->
# parent +:= '?'
# else if ageSexGroup.q is '-' ->
# parent +:= ' [uncountable]'
# else -> I ]
if ageSexGroup.q is '?':
tccpage2.addTextMixed ( parent, '?' )
elif ageSexGroup.q is '-':
tccpage2.addTextMixed ( parent, ' [uncountable]' )
#-- 5 --
# [ if ageSexGroup.fide is not None ->
# parent +:= '['+(a span element of class=GENUS_CLASS
# containing 'fide')+' '+ageSexGroup.fide+']'
if ageSexGroup.fide is not None:
tccpage2.addTextMixed ( parent, '[' )
self.__span ( parent, GENUS_CLASS, 'fide' )
tccpage2.addTextMixed ( parent, ' %s]' % ageSexGroup.fide )
#-- 6 --
# [ parent +:= ' ' ]
tccpage2.addTextMixed ( parent, ' ' )