Bug 407060 - incorrect YAML highlighted some text block
Summary: incorrect YAML highlighted some text block
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Nibaldo G.
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-29 18:16 UTC by Alexandr Zamaraev (aka Tonal)
Modified: 2019-05-31 18:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.59.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Zamaraev (aka Tonal) 2019-04-29 18:16:48 UTC
SUMMARY
Incorrect highlighted text as comment
Break highlighting in double quote inside text block

STEPS TO REPRODUCE
1. Paste this fragment to Kate:
<yaml>
7:
  domain: example.org
  reg_list:
  - reg: ?#XPath //div[@class="product_item cf"][@id] ))(?sx)
      id="product(?P<code>[^"]+)"
      .+?<h4><a\s+[^>]+>(?P<title>[^<]+)</a></h4>
      .+?>(?:(?P<artikul>[^<]+)|\s*)</span>
      .+?(?:new|usual)Price">(?:(?P<price>[\d\s,.]*\d)(?:<span\s+ class="(?P<rub>rur)">)?|<span[^>]*>по\s+ запросу)
  - reg: ?#XPath //div[@class="product_item cf"][not(@id)] ))(?sx)
      <h4>\s*<a\s+href=[^>]+>(?P<title>[^<]+)</a></h4>
      .+?<div\s+ class="divRow"\s+ id="rowOffer(?P<code>\d+)">
      .+?<span\s+ class="nameForOffer">(?:(?P<artikul>[^<]+)|\s*)</span>
      .+?(?:new|usual)Price">\s*(?:(?P<price>[\d\s,.]+\d)\s*<span\s+class="(?P<rub>rur)">|<span\s+[^>]+>\s*по\s+ запросу)
  - reg: ?#XPath //div[@class="second_column left"] ))"name"\scontent="(?P<title>[^<]+)">[\s\S]+?Артикул:\s<span>(?P<artikul>[^<]+)</span>[\s\S]+?Price">(?P<price>[\d\s,.]+)[\s\S]+?id="spinner(?P<code>[^"]+)"
</yaml>

OBSERVED RESULT
Incorrect highlighted comment after '?'
Break highlighting in double quote inside text block

EXPECTED RESULT
3 key "reg". Values - text block without comments.


SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.15
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.0
Kernel Version: 4.15.0-48-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-6200U CPU @ 2.30GHz
Memory: 19,5 ГиБ
Comment 1 Alexandr Zamaraev (aka Tonal) 2019-04-30 01:33:05 UTC
Comment spec: https://yaml.org/spec/1.2/spec.html#id2780069
Comment 2 Nibaldo G. 2019-05-25 20:29:45 UTC
Proposed patch: https://phabricator.kde.org/D21411
Comment 3 Nibaldo G. 2019-05-31 18:58:52 UTC
Git commit 28b11e39fba077fc1b41e27ee31439a331fd066e by Nibaldo González.
Committed on 31/05/2019 at 18:58.
Pushed by ngonzalez into branch 'master'.

YAML: only comments after spaces and other improvements/fixes

Summary:
FIXED-IN: 5.59.0

Improvements and corrections to YAML.

**Changes:**
* Only highlight comments after spaces.
* Add folding indentation, like the Python highlighter.
* Avoid highlighting lists, hashes and strings within blocks with multiple lines, incorrectly.
* Highlight two points of Keys in another color, to make it easier to differentiate Keys and attributes in some color schemes.
* Changes in colors:
     * The Keys are now in bold, helps to differentiate Keys and attributes, especially in the Solarized schemes.
     * Data types are highlighted with `dsOthers`, to differentiate from the Attribute color.
     * "Normal Text" is now `dsAttribute`, to unify the colors of attributes, since in attributes with multiple lines the colors are inconsistent. This is done according to other text editors such as VSCode and Atom, where the same color is used for attributes and normal text.

{F6849805}

{F6849807}

Solarized scheme:
{F6849808}

Normal block & literal block:
{F6849809}

Reviewers: dhaumann, cullmann, #framework_syntax_highlighting

Reviewed By: dhaumann, cullmann, #framework_syntax_highlighting

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

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

M  +34   -28   autotests/folding/test.yaml.fold
M  +4    -4    autotests/html/example.rmd.html
M  +98   -92   autotests/html/test.yaml.html
M  +6    -0    autotests/input/test.yaml
M  +4    -4    autotests/reference/example.rmd.ref
M  +89   -83   autotests/reference/test.yaml.ref
M  +190  -127  data/syntax/yaml.xml

https://commits.kde.org/syntax-highlighting/28b11e39fba077fc1b41e27ee31439a331fd066e