-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pimctl output OK via cmdline <> but NOK when integrated in html #235
Comments
Edit: changed markup syntax of issue to Markdown |
Thank you for the report. See my comments below:
|
Joachim, pfSense uses PHP, I worked around the issue this way. I did work around the problem in the following way: The ANSI controls available in the output where With as complicating factor that every modified line was terminated by the generic ESC[0m, which forced me to use a generic html termination code as well. I defined an string array like this Then the following line did the job |
Joachim, What seems minimal to me is that the formatting is symmetrical / consistent. As example
|
Sorry, but no. This is not HTML tags, it's ANSI escape sequences, and there's no standard that says one cannot use ESC[0m to disable all formatting. If you go for translating ANSI escape codes you need to handle all these cases. If you do it right, such a function would be useful for parsing output from many other system tools as well. My recommendation is still to go for an alternate output format, I suggest JSON since that's sort the industry standard at this point. Btw, I suppose you've seen the |
Oeps! I did not notice the -p option, but that surely improves the situation! Thanks for the tip ! Whatever if you want to convert e.g. the ANSI escapes to for example html layout controls, than you you need not only the start of the style change but also the end. I can convert ansi "start bold" to the equivalent html command but than I also have to insert the "stop bold" |
State machine. You can always track the latest set of HTML tags you've inserted. It's definitely possible, we did it in javascript for many other applications at my old job, so it should be in other languages as well. I'm not going to change the ANSI escape sequences. |
Joachim,
I compiled the actual code using freebsd 14-currenct in favor of the actual pfSense development release. Works OK, no problem, apart from an layout issue.
pfsense is integrating the pimctl output in its html screens like this
And pimctl reacts with an output intended for a vt100 command line using control like
However that does not fit in an html page :(
(see example below)
To solve this the pmctl headers format should be either OK for both command line and html or there should be an option to select 'the formatting format'
I also have been considering two other options:
To be honest, I am not wild on either of those two ideas
Below an example of the pimctl output as it shows up in the pfsense gui, and below that some compiler warnings I discovered. Not dramatic however hot really OK as well.
Louis
pimctl output as displayed in an html screen
How formatted headers are shown in an html page:
Compiler warnings
The text was updated successfully, but these errors were encountered: