The opf obtained by bk.get_opf() is built on the fly to reflect whatever changes have been done in and by the plugin so far. The same is true inside Sigil as well. The opf is always kept in machine parseable format. Things like comments and whitespace are not kept as they will be rebuilt as files are added and removed. You should only use line offsets to report errors in the opf as whitespace is meaningless.
A validator should not be modifying anything and in that case doing as DiapDealer said in his post above will give you the original opf that was present when the plugin was started. As soon as a plugin modifies something that impacts the opf, even this function will return the built on the fly version of the opf.
Last edited by KevinH; 01-21-2018 at 04:45 PM.
|