discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

HTML commands in echo

RP
Ronaldo Persiano
Fri, Dec 20, 2019 8:19 PM

I guess I have found a small glitch in echo with HTML commands when the
commands are not properly closed. For instance,

text = "Test";
echo(str( "<h4><p style='background-color:lightblue;'>", text ));

instead of:

text = "Test";
echo(str( "<h4><p style='background-color:lightblue;'>", text,"</p></h4>"));

will paint the console background with blue. The new background color will
extend beyond the echo text and will be kept even in the following code
previews. To reestablish the white background, some echo like bellow might
be needed:

echo("<p style='background-color:white;'></p>");

I think that echo should force a close of all open HTML commands before
ending.

I guess I have found a small glitch in echo with HTML commands when the commands are not properly closed. For instance, text = "Test"; echo(str( "<h4><p style='background-color:lightblue;'>", text )); instead of: text = "Test"; echo(str( "<h4><p style='background-color:lightblue;'>", text,"</p></h4>")); will paint the console background with blue. The new background color will extend beyond the echo text and will be kept even in the following code previews. To reestablish the white background, some echo like bellow might be needed: echo("<p style='background-color:white;'></p>"); I think that echo should force a close of all open HTML commands before ending.
TP
Torsten Paul
Fri, Dec 20, 2019 8:33 PM

On 20.12.19 21:19, Ronaldo Persiano wrote:

I guess I have found a small glitch in echo with HTML
commands when the commands are not properly closed.

HTML will not be supported in echo(). It already is disabled
for most cases that output to console but it seems there's
still some places not fixed.

ciao,
Torsten.

On 20.12.19 21:19, Ronaldo Persiano wrote: > I guess I have found a small glitch in echo with HTML > commands when the commands are not properly closed. HTML will not be supported in echo(). It already is disabled for most cases that output to console but it seems there's still some places not fixed. ciao, Torsten.
RP
Ronaldo Persiano
Fri, Dec 20, 2019 10:23 PM

All my fancy echo's will be garbage after all the hard work to make them. ☹️

A sexta, 20/12/2019, 20:33, Torsten Paul Torsten.Paul@gmx.de escreveu:

On 20.12.19 21:19, Ronaldo Persiano wrote:

I guess I have found a small glitch in echo with HTML
commands when the commands are not properly closed.

HTML will not be supported in echo(). It already is disabled
for most cases that output to console but it seems there's
still some places not fixed.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

All my fancy echo's will be garbage after all the hard work to make them. ☹️ A sexta, 20/12/2019, 20:33, Torsten Paul <Torsten.Paul@gmx.de> escreveu: > On 20.12.19 21:19, Ronaldo Persiano wrote: > > I guess I have found a small glitch in echo with HTML > > commands when the commands are not properly closed. > > HTML will not be supported in echo(). It already is disabled > for most cases that output to console but it seems there's > still some places not fixed. > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Fri, Dec 20, 2019 11:15 PM

On 20.12.19 23:23, Ronaldo Persiano wrote:

All my fancy echo's will be garbage after all the
hard work to make them. ☹️

What are the formatting features used? The current HTML
support was an accidental feature leaking the internals
of the GUI control used as console window. That's also
the reason why it changed behavior some time ago causing
all sorts of issues and different behavior depending on
the OpenSCAD version.

The only way for providing a stable way of generating
output (with string formatting, no ECHO prefix, ...)
would be having a dedicated output window.

Collecting ideas for that would help a lot.

ciao,
Torsten.

On 20.12.19 23:23, Ronaldo Persiano wrote: > All my fancy echo's will be garbage after all the > hard work to make them. ☹️ What are the formatting features used? The current HTML support was an accidental feature leaking the internals of the GUI control used as console window. That's also the reason why it changed behavior some time ago causing all sorts of issues and different behavior depending on the OpenSCAD version. The only way for providing a stable way of generating output (with string formatting, no ECHO prefix, ...) would be having a dedicated output window. Collecting ideas for that would help a lot. ciao, Torsten.
RP
Ronaldo Persiano
Sat, Dec 21, 2019 12:11 AM

A sexta, 20/12/2019, 23:16, Torsten Paul

What are the formatting features used?

Nothing more then colouring text and it's background and add some line
breaks. But, for instance, I was unable to add an extra line break at the
end of my formatted  text. I must admit I am less than a beginner in HTML.

My intention is to visually distinguish error, warning and info messages
issued by a library.

A sexta, 20/12/2019, 23:16, Torsten Paul > What are the formatting features used? > Nothing more then colouring text and it's background and add some line breaks. But, for instance, I was unable to add an extra line break at the end of my formatted text. I must admit I am less than a beginner in HTML. My intention is to visually distinguish error, warning and info messages issued by a library. >
HL
Hans L
Sat, Dec 21, 2019 4:03 AM

We could theoretically add support back in for html-specific output as a
separate module without much effort I think,  Call it something like
"html()", "html_echo()", or "echo_html()".

The current formatting code is in mainwin.cc:consoleOutput function (
https://github.com/openscad/openscad/blob/2a943a57f9d23511c0021b228dee6b6eb9ae440d/src/mainwin.cc#L2923-L2946
) , and it works by checking if the message starts with "WARNING:", or
"ERROR:" etc to highlight those messages in different colors.  In the most
recent builds, since Dec. 11, the echo appends plain text only to the
console, and those specific formatting options can't be invoked directly by
the user(they couldn't before either) because echo() statements always
start with "ECHO:"

So another option which could be useful is if scripts were able to apply
some of those builtin formats to highlight their own warnings (and maybe
errors?) without requiring html either.  So for example echo() could take
an optional "message_type" parameter that would alter its prefix from
"ECHO:" to some other from a list of pre-defined options.  If we did
something like that we might also want to differentiate between messages
coming from the application, vs those coming from a script.  Maybe prefix
"SCRIPT-WARNING:" instead of "WARNING:" etc.

One last note which doesn't directly help but might be some consolation for
library writing:
(version_num()-20191211 >= 0)
Should return true if the build has had echo html support removed, based on
the merge date.

-Hans

On Fri, Dec 20, 2019 at 6:13 PM Ronaldo Persiano rcmpersiano@gmail.com
wrote:

A sexta, 20/12/2019, 23:16, Torsten Paul

What are the formatting features used?

Nothing more then colouring text and it's background and add some line
breaks. But, for instance, I was unable to add an extra line break at the
end of my formatted  text. I must admit I am less than a beginner in HTML.

My intention is to visually distinguish error, warning and info messages
issued by a library.


We could theoretically add support back in for html-specific output as a separate module without much effort I think, Call it something like "html()", "html_echo()", or "echo_html()". The current formatting code is in mainwin.cc:consoleOutput function ( https://github.com/openscad/openscad/blob/2a943a57f9d23511c0021b228dee6b6eb9ae440d/src/mainwin.cc#L2923-L2946 ) , and it works by checking if the message starts with "WARNING:", or "ERROR:" etc to highlight those messages in different colors. In the most recent builds, since Dec. 11, the echo appends plain text only to the console, and those specific formatting options can't be invoked directly by the user(they couldn't before either) because echo() statements always start with "ECHO:" So another option which could be useful is if scripts were able to apply some of those builtin formats to highlight their own warnings (and maybe errors?) without requiring html either. So for example echo() could take an optional "message_type" parameter that would alter its prefix from "ECHO:" to some other from a list of pre-defined options. If we did something like that we might also want to differentiate between messages coming from the application, vs those coming from a script. Maybe prefix "SCRIPT-WARNING:" instead of "WARNING:" etc. One last note which doesn't directly help but might be some consolation for library writing: (version_num()-20191211 >= 0) Should return true if the build has had echo html support removed, based on the merge date. -Hans On Fri, Dec 20, 2019 at 6:13 PM Ronaldo Persiano <rcmpersiano@gmail.com> wrote: > > > A sexta, 20/12/2019, 23:16, Torsten Paul > >> What are the formatting features used? >> > > Nothing more then colouring text and it's background and add some line > breaks. But, for instance, I was unable to add an extra line break at the > end of my formatted text. I must admit I am less than a beginner in HTML. > > My intention is to visually distinguish error, warning and info messages > issued by a library. > >> _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
R
runsun
Fri, Jan 3, 2020 4:25 PM

I have lots of code (A LOT!!!) using the HTML style to structure/color text
for complicate code. If the HTML feature is disabled, all those hard work
will be wasted. I haven't have a chance to try newer release to check how
devastating it is.

Btw happy new year, guys.


$  Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText  ( OpenSCAD lexer ); $ Tips ; $ Snippets

--
Sent from: http://forum.openscad.org/

I have lots of code (A LOT!!!) using the HTML style to structure/color text for complicate code. If the HTML feature is disabled, all those hard work will be wasted. I haven't have a chance to try newer release to check how devastating it is. Btw happy new year, guys. ----- $ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer );&nbsp;$ Tips ;&nbsp;$ Snippets -- Sent from: http://forum.openscad.org/
E
egburr
Mon, Jan 6, 2020 7:02 AM

On that note about adding the ability to issue "WARNING" and "ERROR" messages
that are highlited, how about also a "NOTICE" message that is also highlited
but for things that aren't necessarily a problem.

Alternatively, I'd probably prefer "color=" and "bgcolor=" parameters added
to echo, so we can just specify colors for our messages and lead off with
whatever capitalized text we want to (after the "ECHO:" bit, of course) if
we want any at all.

Just use the same color options as already available for the "color"
command.

Too bad this:
color("red") echo("This should be red text.");
doesn't work. :)

thehans wrote

The current formatting code is in mainwin.cc:consoleOutput function (
https://github.com/openscad/openscad/blob/2a943a57f9d23511c0021b228dee6b6eb9ae440d/src/mainwin.cc#L2923-L2946
) , and it works by checking if the message starts with "WARNING:", or
"ERROR:" etc to highlight those messages in different colors.  In the most
recent builds, since Dec. 11, the echo appends plain text only to the
console, and those specific formatting options can't be invoked directly
by
the user(they couldn't before either) because echo() statements always
start with "ECHO:"

So another option which could be useful is if scripts were able to apply
some of those builtin formats to highlight their own warnings (and maybe
errors?) without requiring html either.  So for example echo() could take
an optional "message_type" parameter that would alter its prefix from
"ECHO:" to some other from a list of pre-defined options.  If we did
something like that we might also want to differentiate between messages
coming from the application, vs those coming from a script.  Maybe prefix
"SCRIPT-WARNING:" instead of "WARNING:" etc.

On that note about adding the ability to issue "WARNING" and "ERROR" messages that are highlited, how about also a "NOTICE" message that is also highlited but for things that aren't necessarily a problem. Alternatively, I'd probably prefer "color=" and "bgcolor=" parameters added to echo, so we can just specify colors for our messages and lead off with whatever capitalized text we want to (after the "ECHO:" bit, of course) if we want any at all. Just use the same color options as already available for the "color" command. Too bad this: *color("red") echo("This should be red text.");* doesn't work. :) thehans wrote > The current formatting code is in mainwin.cc:consoleOutput function ( > https://github.com/openscad/openscad/blob/2a943a57f9d23511c0021b228dee6b6eb9ae440d/src/mainwin.cc#L2923-L2946 > ) , and it works by checking if the message starts with "WARNING:", or > "ERROR:" etc to highlight those messages in different colors. In the most > recent builds, since Dec. 11, the echo appends plain text only to the > console, and those specific formatting options can't be invoked directly > by > the user(they couldn't before either) because echo() statements always > start with "ECHO:" > > So another option which could be useful is if scripts were able to apply > some of those builtin formats to highlight their own warnings (and maybe > errors?) without requiring html either. So for example echo() could take > an optional "message_type" parameter that would alter its prefix from > "ECHO:" to some other from a list of pre-defined options. If we did > something like that we might also want to differentiate between messages > coming from the application, vs those coming from a script. Maybe prefix > "SCRIPT-WARNING:" instead of "WARNING:" etc. -- Sent from: http://forum.openscad.org/
JB
Jordan Brown
Mon, Jan 6, 2020 6:26 PM

On 1/5/2020 11:02 PM, egburr wrote:

Too bad this:
color("red") echo("This should be red text.");
doesn't work. :)

Or

scale(1.1) echo("Big text");

On 1/5/2020 11:02 PM, egburr wrote: > Too bad this: > *color("red") echo("This should be red text.");* > doesn't work. :) Or scale(1.1) echo("Big text");
NH
nop head
Mon, Jan 6, 2020 6:30 PM

What would these do when run from the command line?

On Mon, 6 Jan 2020 at 18:27, Jordan Brown openscad@jordan.maileater.net
wrote:

On 1/5/2020 11:02 PM, egburr wrote:

Too bad this:
color("red") echo("This should be red text.");
doesn't work. :)

Or

scale(1.1) echo("Big text");


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

What would these do when run from the command line? On Mon, 6 Jan 2020 at 18:27, Jordan Brown <openscad@jordan.maileater.net> wrote: > On 1/5/2020 11:02 PM, egburr wrote: > > Too bad this: > *color("red") echo("This should be red text.");* > doesn't work. :) > > > Or > > scale(1.1) echo("Big text"); > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >