#69 Syntax Highlighting Enhancement for HEREDOCs

open
nobody
None
5
2004-08-20
2004-08-20
Wally Crooze
No

Just found this little gem on php.net:

=================
A note on the heredoc stuff.

If you're editing with VI/VIM and possible other syntax
highlighting
editors, then using certain words is the way forward.
if you use <<<HTML
for example, then the text will be hightlighted for HTML!!

I just found this out and used sed to alter all EOF to
HTML.

JAVASCRIPT also works, and possibly others. The only
thing about
<<<JAVASCRIPT is that you can't add the <script>
tags.., so use HTML
instead, which will correctly highlight all JavaScript
too.. There might
be one for Text/css too?
=================

Discussion

  • Joerg Fischer
    Joerg Fischer
    2004-08-21

    Logged In: YES
    user_id=918104

    If a document contains different parts like
    HTML and PHP, you might also want the appropriate
    macros available in addition to the highlighting when
    editing HTML versus editing PHP.

    This means that you have to switch the language mode!

    This idea is not new confirm
    http://yersinia.org/homes/paolino/emacs/
    (multi-mode.el and the link to mmm-mode)

    This should be done using NEdit's macro language. A first
    attempt is at
    http://www.nedit.org/ftp/contrib/highlighting/experimental/

    So it is up to you to make your feature request happen ;-)