Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Feature Idea - Embedded JavaScript Mode #520

Closed
kruncher opened this Issue · 4 comments

4 participants

@kruncher

Hello guys,

I have created a new mode for my project called "HTML + EJS" which I believe could be of benefit to others. It is literally an altered version of the HTML mode that utilises the existing JavaScript mode.

Is it possible to add configuration options to a mode? For example, EJS supports custom open and close tags. Is it possible to add a custom open / close tag option for this mode?

If there is interest for this mode I will create a pull request.

Cheers
@gissues:{"order":30.434782608695958,"status":"backlog"}

@zefhemel
Collaborator

I'm trying to understand what you did. Looking at the HTML highlight rules (https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/html_highlight_rules.js) it appears to embed the JavaScript mode already. How is what you are doing different?

@rotorz

The additional rules allow for the following EJS:

<h1><%= document.title %></h1>
<% if (something === true) { %>
   <div>Something is true!</div>
<% } %>

I am using the EJS feature of custom open / close tags which allows me to use the following instead:

<h1><?= document.title ?></h1>
<? if (something === true) { ?>
   <div>Something is true!</div>
<? } ?>

So there would need to be a way to specify custom open / close tags within a mode instance. What would be the best way to add custom options to a specific mode?

EJS offers a similar type of syntax to that of PHP, I am not referring to the usual <script></script> elements:

https://github.com/visionmedia/ejs

@zefhemel
Collaborator

Ah sorry, I read EJS, simply as embedded JavaScript (like with script tags), but you meant the specific "templating" language, if you will.

@nightwing
Owner

ejs mode was added in #1445

@nightwing nightwing closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.