[#90865] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been reported by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90877] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been updated by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90895] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
4 messages
2019/01/05
[#90896] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707))
— Takashi Kokubun <takashikkbn@...>
2019/01/05
Thanks to explain that.
[#91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout — glass.saga@...
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
4 messages
2019/01/21
[#91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
— Eric Wong <normalperson@...>
2019/01/26
glass.saga@gmail.com wrote:
[ruby-core:91106] [Ruby trunk Feature#15538] Erb indenting / unindenting trim mode
From:
merch-redmine@...
Date:
2019-01-15 15:22:00 UTC
List:
ruby-core #91106
Issue #15538 has been updated by jeremyevans0 (Jeremy Evans).
kke (Kimmo Lehto) wrote:
> In `Erb`, would it be possible to add a new trim mode that would indent the following content to match the depth of the tag? The tag could for example be `<%|` and it would be enabled using `Erb.new(template, trim_mode: '|')`
I think if we are going to add support for `<%|` and `<%|=` tags to ERB, it would be a better idea to use them to support output of captured blocks, as Erubi offers optional support for (https://github.com/jeremyevans/erubi#capturing). This allows you to do things like:
~~~
<%|= form do %>
<input>
<%| end %>
~~~
and have it output:
~~~
<form>
<input>
</form>
~~~
assuming an appropriate definition of `form`. This is basically what Rails does for normal `<%=` tags, but without attempting to parse ruby code with regexp (https://github.com/rails/rails/blob/5-2-stable/actionview/lib/action_view/template/handlers/erb/erubi.rb#L45-L61).
I'm not opposed to the idea of using a trim mode to modify indentation, but I think it should use a character other than `|` if support is added for it.
----------------------------------------
Feature #15538: Erb indenting / unindenting trim mode
https://bugs.ruby-lang.org/issues/15538#change-76342
* Author: kke (Kimmo Lehto)
* Status: Feedback
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
In `Erb`, would it be possible to add a new trim mode that would indent the following content to match the depth of the tag? The tag could for example be `<%|` and it would be enabled using `Erb.new(template, trim_mode: '|')`
## Reason
Something like this looks nice:
``` ruby
- horse
<% ['cat', 'dog', 'goldfish'].each do |pet| %>
<% unless pet == 'goldfish' %>
- <%= pet %>
<% end %>
<% end %>
```
But unfortunately it will render with "extra" indentation:
```
- horse
- cat
- dog
```
With the `|` trim mode it could be written as:
```ruby
- horse
<%| ['cat', 'dog', 'goldfish'].each do |pet| %>
....
<% end %>
```
And it would output as desired without the "extra" indentation. Currently, to produce such output, you have write your erb template without indentation or using a jumpy mixed indentation (code and content have different indentation levels but are interleaved) and it's not a very user/editor friendly way to work.
## Using with `=`
It would also be handy if the `|` could be used with `<%=`, perhaps `<%|=`, this would be excellent for example when templating YAML's:
```yaml
<% bar_content = "- something\n- something else" %>
foo:
bar:
<%|= bar_content %>
```
Which would produce something like:
```yaml
foo:
bar:
- something
- something else
```
Instead of the invalid:
```yaml
foo:
bar:
- something
- something else
```
Currently there's no way to accomplish this without manually counting the leading spaces, as it's not possible to detect the column where `<%=` appeared.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>