D23400: reST: handle some more corner cases, add an actual test file

Vladimír Vondruš noreply at phabricator.kde.org
Sat Aug 24 14:33:05 BST 2019


mosra created this revision.
mosra added reviewers: cullmann, dhaumann.
Herald added projects: Kate, Frameworks.
Herald added subscribers: kde-frameworks-devel, kwrite-devel.
mosra requested review of this revision.

REVISION SUMMARY
  I'm writing reST quite a lot and finally got to the point where I had to submit a patch :) While doing so, I discovered there was an unmerged https://phabricator.kde.org/D7245 which lacked a test file. This one *does* have a test file but compared to the other patch doesn't add the default / Sphinx directives / roles since I don't personally have any use for these. Adding everyone involved with the other patch as a reviewer here, hope that's okay :)
  
  - Both `.. code-block::` and `.. code::` are valid, the former is a Sphinx thing, while `.. code ::` is a reStructuredText builtin.
  - Directives, interpreted text roles and fields can contain `:` in the name. Used very often by Sphinx and CMake docs. Until now, things like `.. py:function::` were treated as comments. Colons in field names are *not* handled by this patch, as the handling in the highlighting file is non-trivial, I am completely new to this and thus have a fear of breaking things :)
  - A `..` alone on a line is a comment too, doesn't need to be followed by a space. This also makes it work for multi-line comments where the first line is just a `..`.
  - Highlighting default interpreted text role (single backticks) similarly to named roles.
  
  The CMake test was the only place testing for reST highlighting, referencing the umerged https://phabricator.kde.org/D7245, updated it accordingly and removed the patch reference since the problems shown there are fixed by this patch.
  
  The test for reST contains some additional things like block quotes, lists, definition lists etc., which are currently not highlighted (but e.g. Markdown highlighter handles them). This test data might be useful for further improvements to the highlighter.

TEST PLAN
  Look at the HTML output of the test file, plus compare the before/after CMake highlighting.

REPOSITORY
  R216 Syntax Highlighting

REVISION DETAIL
  https://phabricator.kde.org/D23400

AFFECTED FILES
  autotests/folding/highlight.cmake.fold
  autotests/folding/highlight.rst.fold
  autotests/html/highlight.cmake.html
  autotests/html/highlight.rst.html
  autotests/input/highlight.cmake
  autotests/input/highlight.rst
  autotests/reference/highlight.cmake.ref
  autotests/reference/highlight.rst.ref
  data/syntax/rest.xml

To: mosra, cullmann, dhaumann
Cc: kwrite-devel, kde-frameworks-devel, turbov, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190824/359e925c/attachment.html>


More information about the KWrite-Devel mailing list