1#!/usr/bin/env python
2
3from plasTeX import Environment
4from plasTeX.Base.LaTeX.Floats import Caption
5
6class wrapfigure(Environment):
7    args = '[ lines ] place:str [ overhang ] width'
8    float = 'left'
9    def invoke(self, tex):
10        res = Environment.invoke(self, tex)
11        if self.macroMode == self.MODE_BEGIN:
12            a = self.attributes['place'].lower()
13            if a in ['r','o']:
14                self.float = 'right'
15        return res
16
17    class caption(Caption):
18        counter = 'figure'
19
20class wraptable(wrapfigure):
21    pass