ERB syntax



  • Hello,

    I like Notepad++ so much and I wouldn’t like to switch to other alternatives (ex. SublimeText)…

    However, the problem is that I work a lot with ERB files (rails) both in the old _rhtml version and in the new .html.erb format. I’ve searched for a solution to correctly display their syntax on the internet but I haven’t find an appropriate way… how come such a great editor lacks ERB support?! I could think of implementing one, but I must admit the syntax highlighting system is not very well documented and I have made until now only some unsuccesful attempts.

    Does anyone have a good working solution to highlight syntax for ERB files?

    S.



  • I reply to myself… took some effort (and lots of improvisation) but I managed to set up a decent syntax file for ERB. Please feedback if you have comments.

    <NotepadPlus>
    <UserLang name=“ERB” ext=".rhtml" udlVersion=“2.1”>
    <Settings>
    <Global caseIgnored=“no” allowFoldOfComments=“no” foldCompact=“no” forcePureLC=“2” decimalSeparator=“0” />
    <Prefix Keywords1=“no” Keywords2=“no” Keywords3=“no” Keywords4=“no” Keywords5=“no” Keywords6=“no” Keywords7=“no” Keywords8=“no” />
    </Settings>
    <KeywordLists>
    <Keywords name=“Comments”>00# 01 02 03<!-- 04–></Keywords>
    <Keywords name=“Numbers, prefix1”></Keywords>
    <Keywords name=“Numbers, prefix2”></Keywords>
    <Keywords name=“Numbers, extras1”></Keywords>
    <Keywords name=“Numbers, extras2”></Keywords>
    <Keywords name=“Numbers, suffix1”></Keywords>
    <Keywords name=“Numbers, suffix2”></Keywords>
    <Keywords name=“Numbers, range”></Keywords>
    <Keywords name=“Operators1”>{}||</Keywords>
    <Keywords name=“Operators2”>+ - = *</Keywords>
    <Keywords name=“Folders in code1, open”><table <tr <td <th <div</Keywords>
    <Keywords name=“Folders in code1, middle”></Keywords>
    <Keywords name=“Folders in code1, close”></table> </tr> </td> </th> </div></Keywords>
    <Keywords name=“Folders in code2, open”></Keywords>
    <Keywords name=“Folders in code2, middle”></Keywords>
    <Keywords name=“Folders in code2, close”></Keywords>
    <Keywords name=“Folders in comment, open”>#</Keywords>
    <Keywords name=“Folders in comment, middle”></Keywords>
    <Keywords name=“Folders in comment, close”></Keywords>
    <Keywords name=“Keywords1”>render</Keywords>
    <Keywords name=“Keywords2”>ARGF ARGV BEGIN END ENV FALSE DATA NIL RUBY_PATCHLEVEL RUBY_PLATFORM RUBY_RELEASE_DATE RUBY_VERSION PLATFORM RELEASE_DATE STDERR STDIN STDOUT TOPLEVEL_BINDING TRUE ENCODING END FILE LINE alias and begin break case class def defined? do else elsif end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield</Keywords>
    <Keywords name=“Keywords3”>!doctype a abbr accept accept-charset accesskey acronym action address align alink alt applet archive area article aside audio axis b background base basefont bdo bgcolor big blockquote body border br button canvas caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan command compact content contenteditable contextmenu coords data datafld dataformatas datalist datapagesize datasrc datetime dd declare defer del details dfn dir disabled div dl draggable dropzone dt em embed enctype event face fieldset figcaption figure file font footer for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head header height hgroup hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd keygen label lang language leftmargin legend li link longdesc main map marginheight marginwidth mark marquee maxlength media menu meta meter method multiple name nav noframes nohref noresize noscript noshade nowrap object ol onabort onafterprint onbeforeonload onbeforeprint onblur oncanplay oncanplaythrough onchange onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange ondurationchange onemptied onended onerror onfocus onformchange onforminput onhaschange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpause onplay onplaying onpopstate onprogress onratechange onreadystatechange onredo onreset onresize onscroll onseeked onseeking onselect onselect onstalled onstorage onsubmit onsubmit onsuspend ontimeupdate onundo onunload onunload onvolumechange onwaiting optgroup option output p param password placeholder pre profile progress prompt public q radio readonly rel reset rev rows rowspan rp rt ruby rules s samp scheme scope script section select selected shape size small source span spellcheck src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead time title topmargin tr tt type u ul usemap valign value valuetype var version video vlink vspace wbr width xml xmlns</Keywords>
    <Keywords name=“Keywords4”></Keywords>
    <Keywords name=“Keywords5”></Keywords>
    <Keywords name=“Keywords6”></Keywords>
    <Keywords name=“Keywords7”></Keywords>
    <Keywords name=“Keywords8”></Keywords>
    <Keywords name=“Delimiters”>00<% 01 02%> 03<script> 04 05</script> 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
    </KeywordLists>
    <Styles>
    <WordsStyle name=“DEFAULT” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“COMMENTS” fgColor=“008000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“LINE COMMENTS” fgColor=“008000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“NUMBERS” fgColor=“800080” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“KEYWORDS1” fgColor=“0000FF” bgColor=“FFFFFF” fontName="" fontStyle=“1” nesting=“0” />
    <WordsStyle name=“KEYWORDS2” fgColor=“0000FF” bgColor=“80FFFF” fontName="" fontStyle=“1” nesting=“0” />
    <WordsStyle name=“KEYWORDS3” fgColor=“004000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“KEYWORDS4” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“KEYWORDS5” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“KEYWORDS6” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“KEYWORDS7” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“KEYWORDS8” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“OPERATORS” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“FOLDER IN CODE1” fgColor=“0000FF” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“FOLDER IN CODE2” fgColor=“0000FF” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“FOLDER IN COMMENT” fgColor=“008000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“DELIMITERS1” fgColor=“000000” bgColor=“D5FFFF” fontName="" fontStyle=“0” nesting=“117702591” />
    <WordsStyle name=“DELIMITERS2” fgColor=“FF80FF” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“117702655” />
    <WordsStyle name=“DELIMITERS3” fgColor=“0000FF” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“DELIMITERS4” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“DELIMITERS5” fgColor=“000000” bgColor=“80FF80” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“DELIMITERS6” fgColor=“000000” bgColor=“FF8000” fontName="" fontStyle=“0” nesting=“0” />
    <WordsStyle name=“DELIMITERS7” fgColor=“008000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“4” />
    <WordsStyle name=“DELIMITERS8” fgColor=“000000” bgColor=“FFFFFF” fontName="" fontStyle=“0” nesting=“0” />
    </Styles>
    </UserLang>
    </NotepadPlus>


Log in to reply