Skip to content
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

Feature Idea - Embedded JavaScript Mode #520

Closed
kruncher opened this issue Nov 20, 2011 · 4 comments
Closed

Feature Idea - Embedded JavaScript Mode #520

kruncher opened this issue Nov 20, 2011 · 4 comments

Comments

@kruncher
Copy link

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
Copy link
Contributor

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
Copy link

rotorz commented Nov 21, 2011

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
Copy link
Contributor

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

@nightwing
Copy link
Member

ejs mode was added in #1445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants