Ejemplo n.º 1
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"}}]
     )
Ejemplo n.º 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'}}])
Ejemplo n.º 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'}}])
Ejemplo n.º 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)))
Ejemplo n.º 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)))
Ejemplo n.º 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()]
Ejemplo n.º 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()]