Bug#941058: multiline string support
Nicholas D Steeves wrote:
> On Tue, 24 Sep 2019 at 01:54, Trent W. Buck <trentbuck@gmail.com> wrote:
>> In the attached file, yaml-mode indents the multi-line strings incorrectly.
>> Please fix indentation for multi-line strings.
>>
>> (At least, ansible complains about the tab stops that yaml-mode suggests.
>> I don't know speak yaml fluently, so I may have missed something obvious.)
>
> I'm not familiar with Ansible's syntactic requirements, but the
> provided example doesn't look right to me. Here is a link to a few of
> the different ways to do multiline strings in YAML:
> https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-over-multiple-lines
Thanks -- I learned about this after creating the bug report.
Before:
# Ref. https://github.com/paluh/ansible-augeas
- hosts: all
tasks:
- action: augeas commands='ins ForwardAgent before "/files/etc/ssh/sshd_config"
set "/files/etc/ssh/sshd_config/ForwardAgent" "yes"'
- action: augeas commands='
ins ForwardAgent before "/files/etc/ssh/sshd_config"
set "/files/etc/ssh/sshd_config/ForwardAgent" "yes"
'
After:
- hosts: all
tasks:
- augeas:
commands: |
set /files/etc/lvm/lvm.conf/backup/dict/backup_dir/str /var/backups/lvm/backup
set /files/etc/lvm/lvm.conf/backup/dict/archive_dir/str /var/backups/lvm/archive
I'm 99% sure I tested all syntaxes and confirmed they all edited lvm.conf correctly.
Since the "after" notation works, is easier to read, and is already
indented correctly by yaml-mode, I no longer care about this ticket.
> Also, if it would make your work easier I'm willing to package this:
> https://github.com/k1LoW/emacs-ansible
>
> Please file a wnpp bug and include me in the X-Debbugs-CC if you'd
> like me to get to work on that ansible mode.
Thanks, I did not know about this. I had a quick look.
Its documentation doesn't list the features / benefits over plain yaml-mode.
>From reading the source, it looks like it provides
* keyword highlighting (useful),
* autocompletion of keywords (not useful), and
* yasnippets templates (not useful).
It depends on packages named simply "s" and "f" (oy!), but
those appear to be in Debian already (elpa-s and elpa-f).
I installed those then did
emacs -nw -q \
-l emacs-ansible/ansible.el \
-eval "(require 'yaml-mode)" \
cyber-ansible/Cyber-BCP.yaml \
-eval '(ansible +1)'
...and yeah OK, there's more color. It treats "name: xxxx" specially,
and it tries to recognize the embedded jinja2 {{}} {%%} crap without
actually resorting to using an actual jinja major mode (via mumamo or
mmm).
I guess elpa-ansible would be useful to me, but
not enough to put you to any significant trouble.
I'll file an RFP and let you decide whether to action it. :-)
Reply to: