def test_annotations(self): tm = TemplateMaker(self.PAGE) tm.annotate("field1", best_match("text to annotate"), best_match=False) annotations = [x[0] for x in tm.annotations()] self.assertEqual( annotations, [{u"annotations": {u"content": u"field1"}}, {u"annotations": {u"content": u"field1"}}] )
def test_annotations(self): tm = TemplateMaker(self.PAGE) tm.annotate('field1', best_match('text to annotate'), best_match=False) annotations = [x[0] for x in tm.annotations()] self.assertEqual(annotations, [{u'annotations': {u'content': u'field1'}}, {u'annotations': {u'content': u'field1'}}])
def test_annotations(self): tm = TemplateMaker(self.PAGE) tm.annotate('field1', best_match('text to annotate'), best_match=False) annotations = [x[0] for x in tm.annotations()] self.assertEqual(annotations, [{u'annotations': {u'content': u'field1'}}, {u'annotations': {u'content': u'field1'}}])
def do_al(self, template_id): """al <template> - list annotations""" if assert_or_print(template_id, "missing template id"): return t = self._load_template(template_id) tm = TemplateMaker(t) for n, (a, i) in enumerate(tm.annotations()): print "[%s-%d] (%s) %r" % (template_id, n, a['annotations']['content'], remove_annotation(tm.selected_data(i)))
def do_al(self, template_id): """al <template> - list annotations""" if assert_or_print(template_id, "missing template id"): return t = self._load_template(template_id) tm = TemplateMaker(t) for n, (a, i) in enumerate(tm.annotations()): print "[%s-%d] (%s) %r" % (template_id, n, a['annotations']['content'], remove_annotation(tm.selected_data(i)))
def _load_annotations(self, template_id): t = self._load_template(template_id) tm = TemplateMaker(t) return [x[0] for x in tm.annotations()]
def _load_annotations(self, template_id): t = self._load_template(template_id) if not t: return tm = TemplateMaker(t) return [x[0] for x in tm.annotations()]