Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4039 closed defect (fixed)

Document Browser does not honour linebreaks in info layer for text type

Reported by: Dietmar Winkler Owned by: Adeel Asghar
Priority: high Milestone: 1.11.0
Component: OMEdit Version: v1.11.0
Keywords: Cc:

Description

In case somebody decides to not use html for the Documentation.info annotation then the Document Browser will simply not honour linebreaks.

See Modelica.Math.Matrices.LAPACK.dgeev as an example.

Change History (13)

comment:1 by Adeel Asghar, 8 years ago

Milestone: Future1.11.0
Resolution: fixed
Status: newclosed

Fixed in 7ed1ea5/OMEdit.

comment:2 by Dietmar Winkler, 8 years ago

Thanks!

comment:3 by Dietmar Winkler, 8 years ago

Confirmed to be working. Only one thing. When somebody uses text type documentation it is most likely that person as monospaced text in mind and hence arranges it as such. LAPACK for example has a lot of multiline matrix documentation that is all wrong with variable width fonts.

I suggest for the text only content mono-spaced font should be used.

Last edited 8 years ago by Dietmar Winkler (previous) (diff)

comment:4 by Adeel Asghar, 8 years ago

It's a bit hard to detect if text is HTML or plain-text. Qt::mightBeRichText doesn't guarantee anything.

Perhaps we should use monospaced font as default.

comment:5 by Dietmar Winkler, 8 years ago

monospaced as default is fine for me. As for detection, doesn't all HTML in Modelica have to be enclosed in <html> ... </html>? So that should be easy to detect.

comment:6 by Adeel Asghar, 8 years ago

Detection is easy and pretty fast but not true always. For example you can have something like this,

annotation(Documentation(info="This is plain text \n
<p>We also have html here</p>"));

​Qt::mightBeRichText will return false for above code.

I will make monospaced as default.

Last edited 8 years ago by Adeel Asghar (previous) (diff)

comment:7 by Dietmar Winkler, 8 years ago

Your example would not be HTML ;-) The correct way to mix text and HTML would be to tell were HTML starts. So your example should look like:

annotation(Documentation(info="This is plain text \n
<html><p>We also have html here</p></html>"));

to be legal. This is btw what I use in some of my models.

comment:8 by Adeel Asghar, 8 years ago

So how do you want the above text to be displayed as HTML or as plaintext?

comment:9 by Dietmar Winkler, 8 years ago

All that is not HTML should be displayed as mono-spaced text and only what's inside <html> ... </html> should be rendered as HTML. Was that your question?

comment:10 by Adeel Asghar, 8 years ago

Eeeehhh so you want a mix of fonts in one view.

comment:11 by Dietmar Winkler, 8 years ago

Yes of course. Fonts are also mixed within HTML. I.e., pre would also be monospaced within HTML and HTML can also contain different font types.

comment:12 by Adeel Asghar, 8 years ago

Done in fe7fc5f/OMEdit.

comment:13 by Dietmar Winkler, 8 years ago

Thanks!

Note: See TracTickets for help on using tickets.