The Show
and Hide
commands allow areas of text to be marked as data, and therefore ignored by the PTP engine. These areas can contain PTPScript code, Placeholder symbols, etc. without being processed as PTPScript code. For instance, one use would be to mark an area of CSS or JavaScript in a webpage, so that the PTP engine would not try to evaluate it.
There are two commands in the Show
family - Show
and Hide
. Each consists of the command followed by a set of characters that will be used to signal the end of the data sequence. These characters can be any characters except curly braces - { }
- as these are used to denote PTP placeholders. Show
will show the data as-is, and Hide
will hide the data - effectively a very flexible multi-line comment.
For example:
{ show !!!END_OF_DATA!!! } // Handy JavaScript function to pad numbers function pad(number, places) { if (number.toString().length > places) { return number.toPrecision(places); } else { var str = number.toString(); while (str.length < places) { str = '0' + str; } return str; } } !!!END_OF_DATA!!!
// Handy JavaScript function to pad numbers function pad(number, places) { if (number.toString().length > places) { return number.toPrecision(places); } else { var str = number.toString(); while (str.length < places) { str = '0' + str; } return str; } }
In the example above, a section of JavaScript code is marked as a data sequence, and is correspondingly left as-is by the PTP engine, and added to the output.
{ hide !!!END_OF_DATA!!! } // Handy JavaScript function to pad numbers function pad(number, places) { if (number.toString().length > places) { return number.toPrecision(places); } else { var str = number.toString(); while (str.length < places) { str = '0' + str; } return str; } } !!!END_OF_DATA!!!
In this contrasting example, the same data sequence is totally removed - it is not processed, and is also not shown.
Show
and Hide
commands can appear within other command structures, but cannot be nested within other Show
and Hide
sequences.