Logo Search packages:      
Sourcecode: uicilibris version File versions  Download package

def uicilibris::wikiParser::lineJoiner::joinLines (   self,
  lines 
)
join lines ending with unescaped percent signs,
unless inside codemode or nowiki mode
@param lines a list of text lines
@return the lines proporly joined

Definition at line 135 of file wikiParser.py.

                              :
        """
        join lines ending with unescaped percent signs,
        unless inside codemode or nowiki mode
        @param lines a list of text lines
        @return the lines proporly joined
        """
        nowikimode = False
        codemode = False
        r = []  # result array
        s = ''  # new line
        for _l in lines:
            if self.encoding:
                _l=_l.encode(self.encoding)
            (_,nowikimode) = get_nowikimode(_l, nowikimode)
            if not nowikimode:
                (_,codemode) = get_codemode(_l, codemode)

            if not codemode:
                l = _l.rstrip() # return chars are kept only for <code>
            else:
                l = _l

            if l=="" and r and r[-1]!="\n\n" :
                l="\n\n" # simplify and keep the return codes for LaTeX
            if not (nowikimode or codemode) and (len(l) > 1) and (l[-1] == "%") and (l[-2] != "\\"):
                s = s + l[:-1]
            elif not (nowikimode or codemode) and (l == "%"):
                s = s + l[:-1]
            else: # when l=="" or codemode, or nowikimode, or ...
                # output a line
                s = s + l
                if len(s)>0:
                    r.append(s+"\n")
                    s = ''

        return r

Generated by  Doxygen 1.6.0   Back to index