myopencv.py 4.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
from plasTeX import Base
from plasTeX.Base.LaTeX.Verbatim import verbatim
from plasTeX.Base.LaTeX import Sectioning
import sys

class includegraphics(Base.Command):
  args = '[size] file'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvclass(Sectioning.subsection):
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cvfunc(Sectioning.subsection):
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cvCPyFunc(Sectioning.subsection):
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cvCppFunc(Sectioning.subsection):
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cvFunc(Sectioning.subsection):
  args = 'title alt'
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cvstruct(Sectioning.subsection):
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cvmacro(Sectioning.subsection):
  def invoke(self, tex):
    Sectioning.subsection.invoke(self, tex)

class cross(Base.Command):
  args = 'name'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class label(Base.Command):
  args = 'name'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class url(Base.Command):
  args = 'loc'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvarg(Base.Command):
  args = 'item def'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvCross(Base.Command):
  args = 'name altname'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvCPyCross(Base.Command):
  args = 'name'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)
    
class cvCppCross(Base.Command):
  args = 'name'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvdefC(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvcode(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvdefPy(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvdefCpp(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvC(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)
    
class cvCpp(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvCPy(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class cvPy(Base.Command):
  args = 'a'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class xxindex(Base.Command):
  args = 'entry'
  def invoke(self, tex):
    Base.Command.invoke(self, tex)

class lstlisting(verbatim):
  def parse(self, tex):
    verbatim.parse(self, tex)
    return self.attributes

def section_filename(title):
    """Image Processing ==> image_processing.rst"""
    lower_list = [word.lower() for word in title.split()]
    return "_".join(lower_list) + ".rst"

class chapter(Sectioning.chapter):
    @property
    def filenameoverride(self):
        if self.attributes['title'] is not None:
            filename = section_filename(str(self.attributes['title']))
            #assert filename in ['cxcore.rst', 'cvreference.rst']
            return filename
        raise AttributeError, 'This chapter does not generate a new file'
        

class section(Sectioning.section):
    @property
    def filenameoverride(self):
        if self.attributes['title'] is not None:
            filename = section_filename(str(self.attributes['title']))
            print 'section:', filename
            return filename
        raise AttributeError, 'This section does not generate a new file'

class xifthenelse(Base.Command):
    args = 'test then else' 

    class _not(Base.Command):
        macroName = 'not'

    class _and(Base.Command):
        macroName = 'and'

    class _or(Base.Command):
        macroName = 'or'

    class NOT(Base.Command):
        pass

    class AND(Base.Command):
        pass

    class OR(Base.Command):
        pass

    class openParen(Base.Command):
        macroName = '('

    class closeParen(Base.Command):
        macroName = ')'

    class isodd(Base.Command):
        args = 'number:int'

    class isundefined(Base.Command):
        args = 'command:str'

    class equal(Base.Command):
        args = 'first second'

    class lengthtest(Base.Command):
        args = 'test'

    class boolean(Base.Command):
        args = 'name:str'