Jose' Matos <[EMAIL PROTECTED]> writes:

| Hi all,
|         the list seems really quite. :-)
>
|   For sometime I had the idea of separating the handling of the preamble
| from the rest of the header. Finally in Paris I have come to the conclusion
| that it really should be in a different part of the document.
>
|   Even although we are in a deep freeze I think that this patch should go
| in. Why?
>
|   We should never mess up with the preamble unless we really want to. Until
| now the only option was to test explicitly for it. This is tedious and
| error prone. We did it for some functions and not for others. This patch
| places all the code in a single place, where it belongs. :-)
>
|   Although as a side effect I have improved the comments. The code is now
| more robust as well as more readable/understandable...
>
|   Lars?

What are the benefits of doing this now. Why cannot this wait?

|  
| -- 
| José Matos
>
| ? l2ly_test.sh
| Index: LyX.py
| ===================================================================
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/LyX.py,v
| retrieving revision 1.22
| diff -u -p -r1.22 LyX.py
| --- LyX.py    11 Aug 2005 22:31:05 -0000      1.22
| +++ LyX.py    13 Aug 2005 17:56:01 -0000
| @@ -111,6 +111,7 @@ class LyX_Base:
|          self.backend = "latex"
|          self.textclass = "article"
|          self.header = []
| +        self.preamble = []
|          self.body = []
|          self.status = 0
|  
| @@ -133,33 +134,50 @@ class LyX_Base:
|  
|      def read(self):
|          """Reads a file into the self.header and self.body parts, from 
self.input."""
| -        preamble = 0
|  
|          while 1:
|              line = self.input.readline()
|              if not line:
|                  self.error("Invalid LyX file.")
|  
| -            line = line[:-1]
| -            # remove '\r' from line's end, if present
| -            if line[-1:] == '\r':
| +            # remove end of line char(s)
| +            if line[-2:-1] == '\r':
| +                line = line[:-2]
| +            else:
|                  line = line[:-1]

rstrip('\r\n', line)


|  
|              if check_token(line, '\\begin_preamble'):
| -                preamble = 1
| +                while 1:
| +                    line = self.input.readline()
| +                    if not line:
| +                        self.error("Invalid LyX file.")
| +
| +                    # remove end of line char(s)
| +                    if line[-2:-1] == '\r':
| +                        line = line[:-2]
| +                    else:
| +                        line = line[:-1]

and here

or do the strip functions not exist in 1.5.3?

-- 
        Lgb

Reply via email to