+ @property
+ def numbering(self):
+ numbering = self.NUMBERING
+ if numbering is None or self.in_context_of('DISABLE_NUMBERING'):
+ return None
+ numbering = self.get_context_map('SUPPRESS_NUMBERING', numbering, numbering)
+ return numbering
+
+ @property
+ def id_prefix(self):
+ prefix = self.numbering
+ if prefix == 'main':
+ # TODO: self.context.main_numbering_prefix
+ prefix = 'f' # default numbering prefix
+ return prefix
+
+ def assign_id(self, document):
+ numbering = self.numbering
+ if numbering:
+ number = str(document.counters[numbering])
+ self.attrib['_id'] = self.id_prefix + number
+ document.counters[numbering] += 1
+
+ if numbering == 'main':
+ self.attrib['_visible_numbering'] = str(document.counters['_visible'])
+ document.counters['_visible'] += 1
+
+ if numbering == 'fn':
+ self.attrib['_visible_numbering'] = number
+