tallforasmurf / PPQT

A post-processing tool for PGDP written in Python, PyQt4, and Qt
GNU General Public License v3.0
4 stars 2 forks source link

/F F/ confuses html convertion #125

Closed bibimbop closed 11 years ago

bibimbop commented 11 years ago

I open a document, add /F F/ at the end, move the notes there, convert the notes to html. Finally when I convert to html the whole document, I get a lot of emtpy p, h2 tags at the top of the document.

If I remove the /F F/ before converting the whole document, then this problem disappears. However this creates another issue: the page markers towards the end of the book are lost or moved where they don't belong. This also seems random. In several tries, I saw once where the last hundred pages pointed all to the same png.

tallforasmurf commented 11 years ago

I'm not reproducing this. Please attach the text file. (I'll use a folder of pngs I have around).

bibimbop commented 11 years ago

I can reproduce with:

https://dl.dropbox.com/u/94763902/sarrazins/sarrazins.zip

bibimbop commented 11 years ago

If I don't move the cursor, then the document is properly converted, and the /F F/ are gone. If I move the cursor, then it's broken.

tallforasmurf commented 11 years ago

Thank you, with the more detailed description I have duplicated it with a small test document. My jaw has dropped. Note it isn't merely "lots of p tags" -- large parts of the text have disappeared! I cannot imagine how changing the cursor position before html convert can do this. It will be very interesting to find out... stay tuned.

tallforasmurf commented 11 years ago

commit dc44a40

This was a continuation of the issue with allowing F/(end of document) instead of requiring at least one newline after it. The bug could only occur if some end-of-markup (F/, T/, Q/ etc) fell at end of document. The html convert for end-of-markup tried to position the cursor at that line plus the length of that line. That works on all but the last line. There it fails with an error message (which would have been visible on the terminal window) about QTextCursor positioned out of range.

The cursor, which was a copy of the document cursor, would not be repositioned. The next step was to "drag" from the current position to the start of the markup line. Instead of selecting the end-of-markup line, this would select from some random spot in the middle of the document to the start of the last line. The selected text would then be replaced by </div> or </table>. All sorts of unpredictable random shit would follow, but this was where the damage was done.

bibimbop commented 11 years ago

Hmm! I don't see that commit. Last one was april 5th.

tallforasmurf commented 11 years ago

My bad - did everything else incl. making binaries, forgot to push to github. ok now.