Login  Register

Preserving file name and line number in Preprocessor

Posted by Daniel K on May 18, 2020; 9:05am
URL: https://discuss.asciidoctor.org/Preserving-file-name-and-line-number-in-Preprocessor-tp8022.html

Hi,

how can I use a preprocessor and preserving the file name and line number information? I tried different things:

- read all lines to a string list with readLines() and then add them again with restoreLines() --> file name and line number gets lost
- while(reader.hasMoreLines()) { reader.peekLine() } --> endless loop
- while(reader.hasMoreLines()) { reader.peekLine(); read.advance() } --> empty document since advance() seems to drop the line

The problem is that warnings and errors in the source files are not shown correctly anymore as soon as the preprocessor is registered.

Is there any chance to do that? I am using asciidoctorj 1.6.1.



Thanks!