MF2 delimiters/sigils and YAML/Ruby on Rails #520
Labels
blocker-candidate
The submitter thinks this might be a block for the next release
resolve-candidate
This issue appears to have been answered or resolved, and may be closed soon.
syntax
Issues related with syntax or ABNF
I have been thinking about, and working together with a student of mine, on trying to use MF2 with Ruby on Rails. One problematic area I have found is that there are some conflicts between currently used/planned syntax characters in MF2 and in YAML, in particular '#' and '{'.
This raises serious questions, at least for me, whether '{', '{{', and '#', are really good choices for our syntax. I have to admit that I can't propose any alternatives at the moment because I don't know YAML well enough. But I can easily check out other proposals.
TL;DR
Ruby on Rails uses YAML to store resource strings. See https://guides.rubyonrails.org/i18n.html for a general explanation, and e.g. https://github.com/redmine/redmine/blob/master/config/locales for examples.
In YAML, strings can be written bare, without any kinds of quotes,...
(see https://github.com/redmine/redmine/blob/master/config/locales/en.yml#L155).
On the other hand, YAML uses various characters to indicate constructs other than strings.
In particular, '#' introduces comments (as it does in many scripting languages including Python, Ruby, and various shell languages).
Also, '{' starts a hash/map/dictionary, similar again to Python, Ruby, JavaScript, JSON and so on.
Below are examples of some one-liners in YAML (between >>> and <<<) and the resulting objects on the next line (strings in "", which is what we would want; others like hash/map/dictionary (in {}) are not what we want). There are even some cases where an error is produced.
And here's the Ruby program that generate the above, just for your reference (with comments for non-Rubyists):
The text was updated successfully, but these errors were encountered: