<table><tr><td style="">nibags created this revision.<br />Restricted Application added projects: Kate, Frameworks.<br />Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel.<br />nibags requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D14760">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Fix some reported bugs and update the syntax for YAML 1.2:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Fixes the end of a Key:</li>
</ul>
<p>BUG: 366586</p>
<p>Any line of text before <tt style="background: #ebebeb; font-size: 13px;">:</tt> is highlighted as Key, which is very general and gives rise to errors. As mentioned in the bug, in a line like the following, everything is considered as a Key, until the last <tt style="background: #ebebeb; font-size: 13px;">:</tt><br />
{image1}</p>
<p>To fix this, it's necessary to add a space/end-line to the end of a Key <tt style="background: #ebebeb; font-size: 13px;">KEY:(?=\s|$)</tt>. <br />
The YAML documentation mentions: *Mappings use a colon and space (“: ”) to mark each key: value pair* [1].</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Fix delimiter characters in a Key:</li>
</ul>
<p>BUG: 389636</p>
<p>On the next line, it is highlighted as a Key: <tt style="background: #ebebeb; font-size: 13px;">{b:</tt></p>
<p>Within hashes and lists, the characters <tt style="background: #ebebeb; font-size: 13px;">{</tt>, <tt style="background: #ebebeb; font-size: 13px;">[</tt> and <tt style="background: #ebebeb; font-size: 13px;">,</tt> should not be highlighted as Keys, since these are delimiting characters that mark the start/end of an element.</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Allow inline attributes in lists: <tt style="background: #ebebeb; font-size: 13px;">[key1: value, key2: value, ...]</tt></li>
</ul>
<p>Previously, when writing a key, the entire line was highlighted as a value, now the value ends with "," or "]" (in the example, <tt style="background: #ebebeb; font-size: 13px;">3, 2, !!ddfgdf</tt> is Key and <tt style="background: #ebebeb; font-size: 13px;">sdsd 1, takeoff]}</tt> is value).</p>
<p>For this, the context "attribute-pre-inline" is separated in the contexts "list-attribute-pre-inline" and "hash-attribute-pre-inline"; and "attribute-inline" is separated in "list-attribute-inline" and "hash-attribute-inline". The only difference is that one ends with "}" and another with "]".</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Highlight values in Key with multiple lines. That is, when ":" is the first character of a line.</li>
</ul>
<ul class="remarkup-list">
<li class="remarkup-list-item">Highlight references, aliases, strings, etc. in hashes. Before, the hashes only support content of the type <tt style="background: #ebebeb; font-size: 13px;">key: value</tt>. This improves highlighting in keys with many lines.</li>
</ul>
<ul class="remarkup-list">
<li class="remarkup-list-item">Add mapping-key operator: <tt style="background: #ebebeb; font-size: 13px;">?</tt>. In the current highlight, references, aliases, sequences and dash after "?" are not highlighted, that is corrected. This also applies to lists and hashes.</li>
</ul>
<p>In Keys, the operator "?" now it is highlighted with the "Operator" attribute.</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Add escapes [2]. Single quote strings admit only one type of escape: <tt style="background: #ebebeb; font-size: 13px;">''</tt>. Also, allow escapes in keys quoted. Ex: <tt style="background: #ebebeb; font-size: 13px;">"key\"a": value</tt> or 'key''a': value`.</li>
</ul>
<ul class="remarkup-list">
<li class="remarkup-list-item">Add Integers [4] & Floats [5] [3] (the documentation shows the exact regular expressions).</li>
</ul>
<ul class="remarkup-list">
<li class="remarkup-list-item">Add booleans [7] & improves the detection of null (add missing null keywords) [6]. These are highlighted with "dsChar".</li>
</ul>
<div style="margin: 16px 0;
padding: 12px;
border-left: 3px solid #2980b9;
background: #daeaf3;"><span class="remarkup-note-word">NOTE:</span> Booleans, null, integers & floats require specific delimiters to avoid incorrect highlighting (for example, not highlight numbers present in sentences or dates). For that reason I use several RegExpr instead of keywords or other rules.</div>
<p><strong>References:</strong></p>
<ul class="remarkup-list">
<li class="remarkup-list-item">[1] YAML Specs, Collections: <a href="http://yaml.org/spec/1.2/spec.html#id2759963" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/spec/1.2/spec.html#id2759963</a></li>
<li class="remarkup-list-item">[2] YAML Specs, Escaped Characters: <a href="http://yaml.org/spec/1.2/spec.html#id2776092" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/spec/1.2/spec.html#id2776092</a></li>
<li class="remarkup-list-item">[3] YAML Specs, Integer & Float: <a href="http://yaml.org/spec/1.2/spec.html#id2803828" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/spec/1.2/spec.html#id2803828</a></li>
<li class="remarkup-list-item">[4] Integer Language-Independent Type for YAML™ Version 1.1: <a href="http://yaml.org/type/int.html" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/type/int.html</a></li>
<li class="remarkup-list-item">[5] Floating-Point Language-Independent Type for YAML™ Version 1.1: <a href="http://yaml.org/type/float.html" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/type/float.html</a></li>
<li class="remarkup-list-item">[6] Null Language-Independent Type for YAML™ Version 1.1: <a href="http://yaml.org/type/null.html" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/type/null.html</a></li>
<li class="remarkup-list-item">[7] Boolean Language-Independent Type for YAML™ Version 1.1: <a href="http://yaml.org/type/bool.html" class="remarkup-link" target="_blank" rel="noreferrer">http://yaml.org/type/bool.html</a></li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>BRANCH</strong><div><div>fix-yaml</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D14760">https://phabricator.kde.org/D14760</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/folding/test.yaml.fold<br />
autotests/html/test.yaml.html<br />
autotests/input/test.yaml<br />
autotests/reference/test.yaml.ref<br />
data/syntax/yaml.xml</div></div></div><br /><div><strong>To: </strong>nibags<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, michaelh, kevinapavew, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>