]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
Make work with latest pyparsing
authorjamesb <jamesb@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 24 Mar 2010 21:00:34 +0000 (21:00 +0000)
committerjamesb <jamesb@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 24 Mar 2010 21:00:34 +0000 (21:00 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2901 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/doc/latex2sphinx/go
opencv/doc/latex2sphinx/latex.py
opencv/doc/latex2sphinx/latexparser.py

index 905500d7859440ec11f6c3e921721fd7bbe6cd51..57a7863cddac64bac6e1e7ba659af20319309ab4 100644 (file)
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+mkdir -p c cpp py
 tput clear
 python latex.py ../online-opencv.tex || exit
 
index 948ccb93e06b3f9de0a556f8f10742699a1f5203..1c16cad3a586f50c31f912e800d2c1e61dde2967 100644 (file)
@@ -46,6 +46,8 @@ class SphinxWriter:
             s = ":math:`%s`" % s[1:-1].strip()
         elif self.state != 'math':
             s.replace('\\_', '_')
+        if len(s) > 0 and s[-1] == '\n':
+            s = s[:-1]
         if self.state == 'fpreamble':
             self.description += s
         else:
@@ -192,9 +194,12 @@ class SphinxWriter:
             return
         s = str(c.params[0]).replace('\\_', '_')
         s = s.replace('\\par', '')
+        s = s.replace('\n', ' ')
         s = s.replace(';', '')
         self.indent = 0
-        print >>self, ".. cfunction:: " + s + "\n"
+        for proto in s.split('\\newline'):
+            if proto.strip() != "":
+                print >>self, "\n\n.. cfunction:: " + proto.strip() + "\n"
         # print >>self, "=", repr(c.params[0].str)
         print >>self, '    ' + self.description
         self.description = ""
index 17f014f2d8f7698435420a13aaa777124a2f4766..c3423400a128762b1280bc7e349037503c8075e2 100644 (file)
@@ -44,8 +44,8 @@ ParserElement.setDefaultWhitespaceChars("\n\t")
 backslash = chr(92)
 
 texcmd = Forward()
-filler = CharsNotIn(backslash + '\n' + '$')
-filler2 = CharsNotIn(backslash + '\n' + '$' + '{}')
+filler = CharsNotIn(backslash + '$')
+filler2 = CharsNotIn(backslash + '$' + '{}')
 
 arg = '[' + CharsNotIn("]") + ']'
 arg.setParseAction(argfun)
@@ -68,8 +68,12 @@ texcmd.setParseAction(texcmdfun)
 document = ZeroOrMore(dollarmath | texcmd | filler) + StringEnd().suppress()
 
 if 0:
-    s = "\\frac{\\sum_{I, \\, \\texttt{mask}(I) \\ne 0} \\texttt{arr}(I)_c}{N}"
+    s = """Starting from OpenCV 2.0 the new modern C++ interface has been introduced.
+It is crisp (less typing is needed to code the same thing), type-safe 
+and, in general, more convenient to use. Here is a short example of what it looks like:"""
     print s
+    print filler.parseString(s)
+    sys.exit(-1)
     for t in document.parseString(s):
         if isinstance(t, TexCmd):
             print '====> cmd=[%s]' % t.cmd, t