Hi fellows,
I want to contribute two additions for ReST support. However, I don’t know how to extend existing syntax definitions or themes in-place (can anybody here tell me how to do this?), so I had to create duplicate versions of the shipped files with my extensions added:
(1) reStructuredTextExtended.tmLanguage, which is an extended version of the shipped restructuredText.tmLanguage file.
- Removed the meta.paragraph.restructuredtext definition, so that normal text will be colored just like all other standard text as defined in the currently used color theme.
- Added definitions for the ReST directives … sourcecode:: bash, … sourcecode:: console, … sourcecode:: guess and … sourcecode:: python
- Added definitions for the ReST directives … NOTE::, … ATTENTION:: and … WARNING::
- Corrected some regex flaws.
(2) TwilightExtended.tmTheme, which is an extended version of the shipped Twilight.tmTheme (modified with strong influences from Zenburn), including some basic ReST definitions I found elsewhere, as well as the additions described above.
Please consider these files as work-in-progress, I just hacked them together until it worked. The UUIDs were generated with Python’s uuid module (see comments in files) because I found no “official” way to do this. I also had to patch the shipped Shell-Unix-Generic.tmLanguage file a bit (i.e. the case clause was not closed properly). I attached it, too.
There are still some constructs that don’t work. Especially I failed at building a definition that would allow the console directive (see above) to be properly highlighted. Note that this directive is used in the Sphinx Documentation Generator. Here is an example:
.. sourcecode:: console
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
I would like to highlight the command following the prompt character “$” just like other bash code, but the lines without the prompt sign should be treated as a different scope (i.e. normal text or something else). You can still find fragments of my efforts in the provided files, I’m too lazy right now to clean them up
Since a cannot attach files here, I uploaded them by myself:
christianhinrichs.de/projekte/sublime/
Comments welcome.
Chh