"one dive" printout - not correct HTML interpretion for dive from planner

K. "pestophagous" Heller pestophagous at gmail.com
Sun Nov 15 21:49:59 PST 2015


On Sun, Nov 15, 2015 at 12:43 PM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> On 15 November 2015 at 10:24, Stefan Fuchs <sfuchs at gmx.de> wrote:
>> Hello Rick, hi All,
>>
>> Am 14.11.2015 um 22:39 schrieb Rick Walsh:
>>
>> On 15 November 2015 at 04:23, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>>>
>>> On 14 November 2015 at 14:34, Stefan Fuchs <sfuchs at gmx.de> wrote:
>>> > Hi All,
>>> >
>>> > again a item where I would like to ask you for improvement:
>>> > When adding a dive with the planner, the planner puts the runtime and
>>> > additional info into the notes with some nice HTML formating.
>>> >
>>> > When I try to export or print this, the HTML is not interpreted any more
>>> > and
>>> > the notes are impossible to read. Example attached.
>>> >
>>> > Subsurface 4.5.2
>>> > Windows 10 Home, Version 1511 ;-)
>>> > German language
>>> >
>>> >
>>
>> Thanks for testing and sharing your feedback.
>>>
>>>
>>> actually the image you provided shows that the HTML tags are not
>>> converted to plain text, which is a bug.
>>> but i cannot reproduce it with English or German languages (see
>>> attachment).
>>>
>>> that's odd...
>>>
>> The commit that strips the HTML tags from the text on printing was
>> 97e53649fd140afa5bb721d87063b7808d8da44f
>> (http://git.subsurface-divelog.org/index.cgi?p=subsurface.git;a=commitdiff;h=97e53649fd140afa5bb721d87063b7808d8da44f),
>> and doesn't look like it made it into the latest stable (4.5.2) release,
>> which Stefan is using.
>>
>> Using the latest daily, I tried to recreate your planned dive (VPMB +3,
>> altitude 400m, salinity 1.03 kg/l, 9m/min descent, ascent rates of 9m/min,
>> 3m/min, 3m/min and 1m/min, min 5min gas change), and attached the output.
>> You can see that the HTML formatting codes have been removed.
>> Unfortunately, so have the table line breaks, so the output is far from
>> ideal.
>>
>> Thanks for having a look at this.
>> I agree that the HTML formating is not that important for the moment but the
>> missing line breaks make the runtime on the printout almost useless.
>> Do you think it would be possible to keep the line breaks while removing the
>> HTML?
>
> i found a way to print the planned dive's HTML in the notes, but it
> looks bad because it's styled for the screen and does not work well
> with the printing templates!
> the line breaks can work with a simple hack, but you will have to
> update your templates manually because we don't have a method to
> update them in your user folder - i.e. we don't "diff" them for user
> changes.
>
> lubomir

Lubomir mentioned (see [1]) that currently the notes HTML looks bad
when inserted into the Grantlee template.  I have an idea about that.

I noticed a problem with the html tags that get strung together in
add_plan_to_notes.

When "verbatim dive plan" is on (checkbox checked), there will be a
close-table "</table>" tag without a matching open-table tag.  The
problem code is marked with a comment here:
https://github.com/pestophagous/subsurface/commit/f19d22ee3d712a7a598c1ec73e3f8162dbc1df65

That orphaned </table> tag does not seem to cause any trouble in the
Notes panel in the GUI, but I can imagine that it might wreak havoc
when that </table> is nested into the middle of the *outer* table of
the printer html template.

Somewhat off-topic:  I discovered the "</table>" issue while playing
around with potential patches for Trac ticket 944 [2], which involves
copying and pasting formatted tabular HTML Notes. (Subclassing
QTextEdit seems necessary for controlling what that widget will place
onto the clipboard.)  If I get something working for 944, then I may
need the same kind of transformation function "some hack to force
linebreaks" similar to Lubomir's current patch.  So I will keep an eye
on this, and be sure to harness and reuse this code rather than
duplicate any of it.

best,
K Heller

[1] http://lists.subsurface-divelog.org/pipermail/subsurface/2015-November/023312.html
[2] http://trac.subsurface-divelog.org/ticket/944


More information about the subsurface mailing list