htmlembedded Ruby (application/x-erb) breaks on <%# and -%> syntax #1788

Closed
opened 2013-08-28 07:44:21 +02:00 by marijnh · 4 comments
marijnh commented 2013-08-28 07:44:21 +02:00 (Migrated from gitlab.com)
  1. Edit mode/htmlembedded/index.html to change mode: "application/x-ejs", to mode: "application/x-erb", and import <script src="../ruby/ruby.js"></script>. Open in browser.
  2. Paste in this text:
<div>
<p>Testing <% render "foo" %>.</p>
<script>
    alert("And here is some normal JS code"); // also colored
</script>
</div>
  1. Change the embedded tag to <% render "foo" -%>
  2. Change the embedded tag to <%# render "foo" %>

Result:
All the following HTML tags lose their highlighting, and the HTML comment changes to incorrect highlighting

Expected:
Since this is valid ERB syntax, the rest of the file's coloring shouldn't change.

(Note that the other syntax mentioned there, <%=, works fine).

1. Edit mode/htmlembedded/index.html to change `mode: "application/x-ejs",` to `mode: "application/x-erb",` and import `<script src="../ruby/ruby.js"></script>`. Open in browser. 2. Paste in this text: ``` erb <div> <p>Testing <% render "foo" %>.</p> <script> alert("And here is some normal JS code"); // also colored </script> </div> ``` 1. Change the embedded tag to `<% render "foo" -%>` 2. Change the embedded tag to `<%# render "foo" %>` Result: All the following HTML tags lose their highlighting, and the HTML comment changes to incorrect highlighting Expected: Since this is valid [ERB syntax](http://stackoverflow.com/questions/7996695/rails-erb-syntax), the rest of the file's coloring shouldn't change. (Note that the other syntax mentioned there, `<%=`, works fine).
marijnh commented 2013-08-28 08:14:06 +02:00 (Migrated from gitlab.com)

mentioned in merge request !12137

mentioned in merge request !12137
marijnh commented 2013-08-28 19:26:10 +02:00 (Migrated from gitlab.com)

Edit: forgot you need to add another <script> tag to make the test page work. Added to description now.

Edit: forgot you need to add another `<script>` tag to make the test page work. Added to description now.
marijnh commented 2013-08-30 10:07:49 +02:00 (Migrated from gitlab.com)

The htmlembedded mode is contributed, and, now that I look at it, not of a terribly high quality. It'd have to do the tricks that the mode multiplexer uses to be robust. Or, even better, it could just be written on top of the addon/mode/multiplex.js

The htmlembedded mode is contributed, and, now that I look at it, not of a terribly high quality. It'd have to do the tricks that the mode multiplexer uses to be robust. Or, even better, it could just be written on top of the addon/mode/multiplex.js
marijnh (Migrated from gitlab.com) closed this issue 2015-02-24 15:02:37 +01:00
marijnh commented 2021-08-30 01:12:39 +02:00 (Migrated from gitlab.com)

mentioned in issue #4587

mentioned in issue #4587
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5#1788
No description provided.