Re: [PATCH v9 12/13] docs: parser_yaml.py: add support for line numbers from the parser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Donald Hunter <donald.hunter@xxxxxxxxx> writes:

>>              # Parse message with RSTParser
>> -            for i, line in enumerate(msg.split('\n')):
>> -                result.append(line, document.current_source, i)
>> +            lineoffset = 0;
>> +            for line in msg.split('\n'):
>> +                match = self.re_lineno.match(line)
>> +                if match:
>> +                    lineoffset = int(match.group(1))
>> +                    continue
>> +
>> +                result.append(line, document.current_source, lineoffset)
>
> I expect this would need to be source=document.current_source, offset=lineoffset

Ignore that. I see it's not kwargs. It's just the issue below.

>>              rst_parser = RSTParser()
>>              rst_parser.parse('\n'.join(result), document)
>
> But anyway this discards any line information by just concatenating the
> lines together again.

Looks to me like there's no Parser() API that works with ViewList() so
it would be necessary to directly use the docutils RSTStateMachine() for
this approach to work.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux