Author Topic: JavaScript question: no output of "<" by 'console.writeln  (Read 2578 times)

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Is there a reason that the 'less' character ("<") will not be outputted by "console.writeln"? This contrasts to the behavior of "console.log" in the JavaScript environment of Firefox.

What are further differences between "console.writeln" and "console.log"?

Bernd

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: JavaScript question: no output of "<" by 'console.writeln
« Reply #1 on: 2017 March 23 11:12:33 »
Hi Bernd,

The PJSR Console object represents the text output component of the platform's Process Console window. It has nothing to do with console logging tools provided by most web browsers.

The Console object in JavaScript has exactly the same text output functionality as the pcl::Console C++ class:

http://pixinsight.com/developer/pcl/doc/html/classpcl_1_1Console.html

Console supports a variety of special tags to perform text formatting and cursor control operations. For example, try this command from PixInsight's command line:

j console.writeln( "This is <b>bold</b> and this is <i>italics</i>." );

So the '<' and '>' characters have a special meaning when you include them in text written with console.writeln() or console.write(). If you want to write arbitrary text that may include these characters (as well as other control characters), use the <raw></raw> tags. For example:

j console.writeln( "This is <raw>some <text> that may contain '<' and '>' characters</raw>, but this is <i>not</i>." );


Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Re: JavaScript question: no output of "<" by 'console.writeln
« Reply #2 on: 2017 March 24 03:14:02 »
Hi Juan,

your explanation and the link were very helpful, thank you very much.

Bernd