Improve reStructuredText highlighting
ClosedPublic

Authored by turbov on Aug 11 2017, 4:46 AM.

Details

Summary
  1. make code-block directive looks like a "directive" and not like a "code"
  2. highlight directive options for code-block (and code) -- just like "other" directives can
  3. introduce a list of standard directives and their options
  4. introduce a list of Sphinx directives and their options
  5. support for "complex" names of roles and directives (like :cmake:command: & etc)

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
turbov created this revision.Aug 11 2017, 4:46 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 11 2017, 4:46 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
turbov updated this revision to Diff 17992.Aug 11 2017, 4:49 AM

Fix attribute name

turbov updated this revision to Diff 17993.Aug 11 2017, 4:55 AM

Make code block :: works as again as expected

dhaumann requested changes to this revision.Aug 11 2017, 6:54 AM
dhaumann added a subscriber: dhaumann.

In general ok, but there are two issues to be fixed

  1. Remove spaces around items as noted in the comment
  2. Please extend / add a highlighting test case in autotest/input/

The goal is to have all highlighting files unit tested, since otherwise we can not maintain this over time.

data/syntax/rest.xml
21 ↗(On Diff #17991)

Please remove the space before and after attention, i.e. " attention " -> "attention". Syntax highlighting files with spaces raise warnings and soon will not be accepted anymore.

The reason for this change was that when loading the xml files, we want to avoid to trim hundreds of thousands of QStrings.

Same for all the office items.

This revision now requires changes to proceed.Aug 11 2017, 6:54 AM
turbov updated this revision to Diff 18321.Aug 18 2017, 6:41 AM
turbov edited edge metadata.

Looks better, but still, could you provide an autotest case for unit testing, licensed under MIT ?

Hi, please add a testcase and we are done here.
Without a test case this can easily degenerate later again.

@turbov ping

pong...
I wanted to make some improvements...
And it would be nice to have some hint about how to add the mentioned tests...

Sorry, for the tests: inside the autotests, there is input/reference/html
Just add your testcase in input, run the tests, take a look at the results and check them in as references.

@turbov ping again :-) After adding the reference file in autotest/input, run make test, and then call ./autotests/update-reference-data.sh in your build folder. Then git status will tell you which files are new and need to be added updated.

If you are happy with the current state, I can add some auto-test for you and push this.

cullmann accepted this revision.Aug 14 2018, 1:30 PM
dhaumann accepted this revision.Aug 14 2018, 1:31 PM

Sorry for the delay. Shall we take care of this?

This revision is now accepted and ready to land.Aug 14 2018, 1:31 PM
turbov marked an inline comment as done.Aug 14 2018, 2:00 PM

I'm using this syntax 'till nowadays from my repo... I know about some not covered cases in it, but have no time these days to improve it even more %)
Most of the time I quite satisfied w/ it... and sorry for the tests :(

You can just close this MR, I'll be back sometime later w/ highlighting example and tests...

Hmm, should we not commit this state at least as is?
Or do you want to do a new request including a new state & tests?
I would be fine with just pushing this as an intermediate step, too.

@cullmann,

Up to you... When I'll fix it for the cases I've found (trying to write the hightlighting.rst test file) I come back w/ a new PR :)

cullmann closed this revision.Aug 14 2018, 9:39 PM

Ok, then we just close this and wait for the next update.
Thanks for the work on that!