[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: reST HL woes
From: Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date: 2014-02-07 21:40:31
Message-ID: ld3js2$784$1 () ger ! gmane ! org
[Download RAW message or body]
The code highlighting in rest.xml has... problems. In particular, this:
* This is a list.
* It has a sub-list, with a code block::
This is code
* Hey, I'm still code?!
...breaks in the self-described manner. For plain reST this may not be
terrible, but I was experimenting with enhancing python.xml to treat
docstrings more like doxygen, i.e. different attribute, and include the
reST rules.
Unfortunately, it goes very badly sideways for stuff like:
def foo():
"""This is foo.
Here is an example of how to use foo::
foo()
Not much too it, is there?
"""
...because the code block does not end where intended, which in turn
causes the end of the docstring (and in fact the entire remainder of the
function!) to look like part of the code block.
See attached for the best I've been able to come up with... is this the
only way, or can we do something better?
--
Matthew
["rest-part.xml" (text/xml)]
<context name="CMakeCodeBlock" attribute="CMakeCode" lineEndContext="#stay">
<RegExpr attribute="CMakeCode" String="^(\s+)(?=\S)" context="CMakeCodeRegion" />
</context>
<context name="CppCodeBlock" attribute="CppCode" lineEndContext="#stay">
<RegExpr attribute="CppCode" String="^(\s+)(?=\S)" context="CppCodeRegion" />
</context>
<context name="CodeBlock" attribute="Code" lineEndContext="#stay">
<RegExpr attribute="Code" String="^(\s+)(?=\S)" context="Code" />
</context>
<context name="CMakeCodeRegion" attribute="CMakeCode" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="CppCode" String="^%1" lookAhead="true" context="CMakeCode" dynamic="true"/>
<RegExpr attribute="Normal" String="^(.|$)" lookAhead="true" context="#pop#pop"/>
<IncludeRules context="CMakeCode"/>
</context>
<context name="CMakeCode" attribute="CMakeCode" lineEndContext="#pop">
<IncludeRules context="##CMake" includeAttrib="true"/>
</context>
<context name="CppCodeRegion" attribute="CppCode" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="CppCode" String="^%1" lookAhead="true" context="CppCode" dynamic="true"/>
<RegExpr attribute="Normal" String="^(.|$)" lookAhead="true" context="#pop#pop"/>
<IncludeRules context="CppCode"/>
</context>
<context name="CppCode" attribute="CppCode" lineEndContext="#pop">
<IncludeRules context="##C++" includeAttrib="true"/>
</context>
<context name="Code" attribute="Code" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="Code" String="^%1" context="#stay" dynamic="true"/>
<RegExpr attribute="Normal" String="^(.|$)" lookAhead="true" context="#pop#pop"/>
</context>
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic