Submitted by : simon at: 2003-10-26T21:32:43+00:00 (14 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

see TestPageWWML. 0.23rc3

fixes? --DanMcmullen, Sat, 04 Oct 2003 15:40:19 -0700 reply

took a look at WWML.py. seems like the regex for detecting 'code':

codePrefix    = r'^([ \t]+)(?=[^*=|0] )'

is matching a literal space following an initial char which is not one of '*=|0'.

seems it should be something like:

codePrefix    = r'^([ \t]+)(?[*=|0] )'

which improves things on my system. NOTE: structured text is removing a "!" that precedes the 2nd "[". see the source of this comment.

there was still a problem after that fix however: the logic to convert initial spaces into tabs was removing the significant indentation in 'code' sections. here's a modified translate() that moves the space to tab logic so that it is not applied to 'code':

def translate( self, lines ) :
    """
    """
    for line in lines :
        # PM: Turn leading spaces into tabs ... someone smarter than
        # me can figure out how to do this with a single regexp ...
        #splitted = self.leadingSpaces.split(line) ### move these 3 lines
        #if len(splitted) == 3:
        #    line = self.spaceChunks.sub("\t", splitted[1]) + splitted[2]
        if self.codeLine.match( line ) :
            self.appendCodeLine( line )
        else :
            splitted = self.leadingSpaces.split(line)
            if len(splitted) == 3:
                line = self.spaceChunks.sub("\t", splitted[1]) + splitted[2]
            self.parseLine( line )
    return self.translatedLines

haven't tested these tweeks thoroughly yet.

property change --Sun, 30 Jan 2005 08:53:29 -0800 reply

Category: user-pagetypes => user-editing-wwml