WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Developer Formatter] Bash lang not working quite right (13 posts)

  1. fourlightson
    Member
    Posted 5 years ago #

    Hi

    Many thanks for great plugin to start.

    I'm using Ver: 2009.0.1.20 of Developer Formatter.

    The problem i have is with the below Bash code, which uses the various brackets and numerical codes to indicate color values for the linux Bash prompt.

    <code lang="bash">
    export PS1="\n\[33[1;31m\]\u\[33[1;30m\] \[33[1;30m\]date\n\[\e[30m\]\h:\w#\[\e[m\] "

    Rather then it come out in wordpress exactly, the below is printed

    export PS1="\n\[3[1;31m\]\u\[3[1;30m\] \[3[1;30m\]date\n\[\e[30m\]\h:\w#\[\e[m\] "

    Not sure why, but in both instances of [33 it gets cut down to just [3.

    I've tried this in Geshis demo site and it comes out ok so i'm guessing it's not Geshi and some regexp or parsing in the Developer Formatter plugin. Any ideas ?

    Many thanks once again,
    fLo

  2. GSaraiva
    Member
    Posted 5 years ago #

    Hello,

    I've tested on a clean wp install and get no problens.
    Try check other plugins.

    I'll keep my eyes here to see your feedback.
    Thanks.

  3. vwal
    Member
    Posted 5 years ago #

    I also see similar problems with bash script (or technically Bourne shell script..) on WP 2.8.2 with nothing but Developer Formatter and Akismet plugins active. I'm currently using Fusion theme, but changing to the WP default theme makes no difference.

    A good example is here. A reader pointed out there was a problem with the script I had posted with Developer Formatter. It turns out Developer Formatter was not displaying a backslash in front of a dollar sign; it was apparently being treated as an escape character instead. Adding a second backslash in the code (to escape the backslash) produced one backslash in the display. You can download a tarball of the script I posted on my blog from the page I linked above if you want to test locally how Developer Formatter displays it.

  4. GSaraiva
    Member
    Posted 5 years ago #

    I hope version 2009.0.1.23 solve this problem with html editor switching to visual editor.
    Wait for the auto-update notification on your wordpress.
    Thanks for the feedback about this problem, is little hard to get the bug working, but I think the solution is in the new version.

  5. vwal
    Member
    Posted 5 years ago #

    Hi,

    I just updated to 2009.0.1.23... and the problem appears to persist. I have to enter..

    eval "local fspath=\\$${fsname}path"

    in the HTML view for it to display:

    eval "local fspath=\$${fsname}path"

    ..in the blog. I also tried to edit it in the visual editor, but entering "\$$" produces just two dollar signs (and no preceding backslash) when saved. With "\\$$" a backslash followed by dollar signs is displayed, but the first dollar sign looks different (escaped?), so for consistent look I put "\\\$\$" which then shows up as "\$$" with both dollar signs looking alike.

    Language type is bash.

  6. GSaraiva
    Member
    Posted 5 years ago #

    Thanks mate, the bug point is preg_replace second param, double backslash works as regexp command. I've fixed it, and tested with some others codes thats can make this problem appear, and get no more bug. I'll commit the new version soon as possible(work time now).

    thanks again

  7. vwal
    Member
    Posted 5 years ago #

    All right! I just upgraded to 2009.0.1.24 and now all characters are being displayed without having to escape them! Many thanks for fixing this!

    Cosmetically, the first "$" after the backslash still looks different than the "$" that follows (take a look at the problematic line on my example page; it's as if the first "$" is in boldface while the next one is regular). But this is not significant; the main thing is that all the characters are displayed and that's working well now! :)

  8. vwal
    Member
    Posted 5 years ago #

    Ah, I spoke too soon. While the problem with backslashes has been fixed in 2009.0.1.24, when active, the plugin now removes newlines/linefeeds from all posts on the blog whether the posts have code segments in them or not! When viewed in the editor, the paragraphs in the posts show up correctly, but on the display side all text runs together without any line/paragraph breaks, whether or not the specific page contains code tags or not.

    Going back to 2009.0.1.23 fixed that problem, but obviously the backslash issue then remains.

  9. GSaraiva
    Member
    Posted 5 years ago #

    Double-insane update :) 2009.0.1.25 and 2009.0.1.26 in a hour.
    I've fixed a lot of bugs.
    The formatter will keep the code better and begins to use WP's formatter internally.
    Sorry for the bad result at 0.1.24 version.

  10. vwal
    Member
    Posted 5 years ago #

    It's getting better! :)

    With 2009.0.1.26 the newlines in the post bodies are left intact, and the backslashes in the code are preserved.

    The only problem that I see now is that all the empty lines in the code are removed and placed in the end of the code segment (so that spacing in code is gone and there are the corresponding number of empty lines in the end of the code block).

    I reverted my blog back to 2009.0.1.23 once more, but you can use my original code block to test. :)

  11. GSaraiva
    Member
    Posted 5 years ago #

    str_replace again. 2009.0.1.27 born :).

  12. vwal
    Member
    Posted 5 years ago #

    NOW it's working as far as I can tell! :) Backslashes and empty lines are now correctly preserved. Well done!

    The "$" preceded by a "\" still look different, but that's no biggie; the main thing is that all the characters are displayed.

    Thanks for fixing this!

  13. GSaraiva
    Member
    Posted 5 years ago #

    You're welcome. :)
    I did some improvements on the code, new features and others.
    It's getting better.

Topic Closed

This topic has been closed to new replies.

About this Topic