Exemplo n.º 1
0
 def invoke(self, tex):
     Command.invoke(self, tex)
     name = self.attributes['name']
     type = self.attributes['type']
     c = self.ownerDocument.context
     obj = c[type]()
     obj.parentNode = self.parentNode
     obj.ownerDocument = self.ownerDocument
     result = obj.invoke(tex)
     c.addGlobal(name, type(name, (self.DefinedURL,), {'result':result}))
Exemplo n.º 2
0
 def invoke(self, tex):
     Command.invoke(self, tex)
     name = str(self.attributes['name'])
     type = str(self.attributes['type'])
     c = self.ownerDocument.context
     obj = c[type]()
     obj.parentNode = self.parentNode
     obj.ownerDocument = self.ownerDocument
     result = obj.invoke(tex)
     c.addGlobal(name, new.classobj(name, (self.DefinedURL,), {'result':result}))
Exemplo n.º 3
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     dir = os.path.dirname(tex.filename)
     file = os.path.join(dir, self.attributes['file'])
     try:
         status.info(' ( sampletableinteractive %s ' % file)
         self.attributes['messages'] = self.read_sample_interaction(file)
         status.info(') ')
     except (OSError, IOError):
         log.warning('\nProblem opening file "%s"', file)
Exemplo n.º 4
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     dir = os.path.dirname(tex.filename)
     file1 = os.path.join(dir, self.attributes['file1'])
     file2 = os.path.join(dir, self.attributes['file2'])
     try:
         status.info(' ( verbatim %s ' % file1)
         self.attributes['data1'] = self.read_sample_file(file1)
         status.info(') ( verbatim %s ' % file2)
         self.attributes['data2'] = self.read_sample_file(file2)
         status.info(') ')
     except (OSError, IOError):
         log.warning('\nProblem opening files "%s" and "%s"', file1, file2)
Exemplo n.º 5
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     dir = os.path.dirname(tex.filename)
     file1 = os.path.join(dir, self.attributes['file1'])
     file2 = os.path.join(dir, self.attributes['file2'])
     try:
         status.info(' ( verbatim %s ' % file1)
         self.attributes['data1'] = self.read_sample_file(file1)
         status.info(') ( verbatim %s ' % file2)
         self.attributes['data2'] = self.read_sample_file(file2)
         status.info(') ')
     except (OSError, IOError):
         log.warning('\nProblem opening files "%s" and "%s"', file1, file2)
Exemplo n.º 6
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     basetex = self.ownerDocument.userdata['base_tex_instance']
     f = self.attributes['file']
     # Maybe more paths to look in?
     paths = [os.path.dirname(basetex.filename)]
     # Locate file
     for p in paths:
         fname = os.path.join(p, f)
         if os.path.isfile(fname):
             self.attributes['data'] = self.read_file(fname)
             break
     if 'data' not in self.attributes:
         log.warning('Problem opening file "%s"', f)
Exemplo n.º 7
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     basetex = self.ownerDocument.userdata['base_tex_instance']
     f = self.attributes['file']
     # Maybe more paths to look in?
     paths = [os.path.dirname(basetex.filename)]
     # Locate file
     for p in paths:
         fname = os.path.join(p, f)
         if os.path.isfile(fname):
             self.attributes['data'] = self.read_file(fname)
             break
     if 'data' not in self.attributes:
         log.warning('Problem opening file "%s"', f)
Exemplo n.º 8
0
    def invoke(self, tex):
        res = Command.invoke(self, tex)

        # Overcome plasTeX bug by looking for love in the right place
        basetex = self.ownerDocument.userdata['base_tex_instance']
        f = self.attributes['file']
        ext = self.ownerDocument.userdata.getPath(
            'packages/graphicx/extensions',
            ['.png', '.jpg', '.jpeg', '.gif', '.pdf'])
        paths = self.ownerDocument.userdata.getPath(
            'packages/graphicx/paths', [os.path.dirname(basetex.filename)])
        img = None
        # Check for file using graphicspath
        for p in paths:
            for e in [''] + ext:
                fname = os.path.join(p, f + e)
                if os.path.isfile(fname):
                    img = os.path.abspath(fname)
                    break
            if img is not None:
                break

        # Check for file using kpsewhich
        if img is None:
            for e in [''] + ext:
                try:
                    img = os.path.abspath(basetex.kpsewhich(f + e))
                    break
                except (OSError, IOError):
                    pass

        if not os.path.isfile(img):
            log.warning('Could not identify image "%s"' % f)

        self.imageoverride = img
        return res
Exemplo n.º 9
0
    def invoke(self, tex):
        res = Command.invoke(self, tex)

        # Overcome plasTeX bug by looking for love in the right place
        basetex = self.ownerDocument.userdata['base_tex_instance']
        f = self.attributes['file']
        ext = self.ownerDocument.userdata.getPath(
                      'packages/graphicx/extensions',
                      ['.png', '.jpg', '.jpeg', '.gif', '.pdf'])
        paths = self.ownerDocument.userdata.getPath(
                        'packages/graphicx/paths', [os.path.dirname(basetex.filename)])
        img = None
        # Check for file using graphicspath
        for p in paths:
            for e in ['']+ext:
                fname = os.path.join(p, f+e)
                if os.path.isfile(fname):
                    img = os.path.abspath(fname)
                    break
            if img is not None:
                break

        # Check for file using kpsewhich
        if img is None:
            for e in ['']+ext:
                try:
                    img = os.path.abspath(basetex.kpsewhich(f+e))
                    break
                except (OSError, IOError):
                    pass

        if not os.path.isfile(img):
            log.warning('Could not identify image "%s"' % f)

        self.imageoverride = img
        return res
Exemplo n.º 10
0
 def invoke(self, tex):
     Command.invoke(self, tex)
     if not self.ownerDocument.userdata.has_key('tags'):
         self.ownerDocument.userdata['tags'] = self
Exemplo n.º 11
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     timelimfile = os.path.join(os.path.dirname(tex.filename),
                                '..', '.timelimit')
     if os.path.isfile(timelimfile):
         self.attributes['timelim'] = open(timelimfile, 'r').read()
Exemplo n.º 12
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     id = self.attributes['id']
     timelimfile = os.path.join(id, '.timelimit')
     if os.path.isfile(timelimfile):
         self.attributes['timelim'] = open(timelimfile, 'r').read()
Exemplo n.º 13
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     id = self.attributes['id']
     timelimfile = os.path.join(id, '.timelimit')
     if os.path.isfile(timelimfile):
         self.attributes['timelim'] = open(timelimfile, 'r').read()
Exemplo n.º 14
0
 def invoke(self, tex):
     Command.invoke(self, tex)
     name = str(self.attributes['name'])
     c = self.ownerDocument.context
     c.addGlobal(name, new.classobj(name, (url,), {}))
Exemplo n.º 15
0
 def invoke(self, tex):
     res = Command.invoke(self, tex)
     timelimfile = os.path.join(os.path.dirname(tex.filename), '..',
                                '.timelimit')
     if os.path.isfile(timelimfile):
         self.attributes['timelim'] = open(timelimfile, 'r').read()
Exemplo n.º 16
0
 def invoke(self, tex):
     Command.invoke(self, tex)
     name = str(self.attributes['name'])
     c = self.ownerDocument.context
     c.addGlobal(name, type(name, (url,), {}))
Exemplo n.º 17
0
 def invoke(self, tex):
     Command.invoke(self, tex)
     if not self.ownerDocument.userdata.has_key('category'):
         self.ownerDocument.userdata['category'] = self