https://bugs.kde.org/show_bug.cgi?id=398314

Nibaldo G. <nibg...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Version Fixed In|                            |5.51.0
         Resolution|---                         |FIXED
      Latest Commit|                            |https://commits.kde.org/syn
                   |                            |tax-highlighting/c32cf60209
                   |                            |31ba47e04f477fd9144230c97c2
                   |                            |5dc
             Status|CONFIRMED                   |RESOLVED

--- Comment #7 from Nibaldo G. <nibg...@gmail.com> ---
Git commit c32cf6020931ba47e04f477fd9144230c97c25dc by Nibaldo González.
Committed on 28/09/2018 at 03:22.
Pushed by ngonzalez into branch 'master'.

YAML: add literal & folded block styles

Summary:
Highlight literal blocks after the operators `|`, `|-`, `|+`, `>`, `>-` and
`>+`.

To do this correctly, the indentation of the Key or operator is captured (with
dynamic rules). Note that in nested block collections, the `-` and `?`
characters are considered as part of the indentation (ref. [2] & [3]):

* With Key: Text lines with indentation of the Key plus a space are considered
literal. The `-` and `?` operators are considered as part of the indentation:
{F6286907}

* If there is no Key present: the literal/folded operator is at the beginning
of the line or there is `-` or `?` character before. In the first case, the
indentation of the literal/folded operator is captured and, in the second, the
indentation of `-` or `?`. In nested blocks or sequences, the indentation of
the last operator `?` or `-` is captured:
{F6286908}

* But, this implementation has a limitation: it only supports 6 nested
operadors (`?` and `-`) at most.

This only works with indentations with spaces. If a tab is detected, it is
highlighted with "Alert".
The empty lines are also part of the literal block.

Also, some minor improvements are included: the sequences require a dash plus a
space.

**Source**:
YAML 1.2 Specs:
* [1] Chapter 8: Block Styles: http://yaml.org/spec/1.2/spec.html#style/block/
* [2] 6.1. Indentation Spaces: http://yaml.org/spec/1.2/spec.html#id2777534
* [3] 8.2.1. Block Sequences: http://yaml.org/spec/1.2/spec.html#id2797382
FIXED-IN: 5.51.0

Test Plan:
The changes I verified according to:
* https://hackage.haskell.org/package/YamlReference
* https://github.com/haphan/yaml-validator

Reviewers: cullmann, dhaumann, #framework_syntax_highlighting, turbov

Reviewed By: turbov

Subscribers: turbov, kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D15780

M  +78   -5    autotests/folding/test.yaml.fold
M  +78   -5    autotests/html/test.yaml.html
M  +77   -4    autotests/input/test.yaml
M  +78   -5    autotests/reference/test.yaml.ref
M  +265  -19   data/syntax/yaml.xml

https://commits.kde.org/syntax-highlighting/c32cf6020931ba47e04f477fd9144230c97c25dc

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to