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"}}]
     )
Exemple #2
0
 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'}}])
Exemple #3
0
 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'}}])
Exemple #4
0
 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)))
Exemple #5
0
 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)))
Exemple #6
0
 def _load_annotations(self, template_id):
     t = self._load_template(template_id)
     tm = TemplateMaker(t)
     return [x[0] for x in tm.annotations()]
Exemple #7
0
 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()]