Michael,
I'm not sure if someone got back to you privately on this, but I
thought I would "bump" it to bring it to everyone's attention again.
I'd love to see a CLM or full-fledged language module for
ReStructuredText (and Markdown while we're at it). Hopefully you (or
someone) can get this working.
Doug
On Sep 14, 2006, at 2:52 PM, Michael Tsai wrote:
I'm trying to make a CLM for ReStructuredText:
<http://docutils.sourceforge.net/rst.html>
The "functions" are similar to Setext in that there are subsections
and
sections:
Section
=======
Subsection
----------
However, any of "-=+~." (and a few others that I don't use) can be
used
for the bar. This allows for more than two levels of sections.
Ideally,
I would like to have:
(a) all the section titles show up in the function pop-up.
(b) titles in function pop-up are indented according to level.
(c) nested fold markers match the section hierarchy.
I can get (a) using this Function Pattern:
(?x:
(?P<function>
^(?P<function_name>.+)\x0D
(?P<bar>\+{3}|={3}|-{3}|~{3}|\.{3}).*\x0D
(?s).*?
)
(?=(\x0D(?-s).*\x0D
(\+{3}|={3}|-{3}|~{3}|\.{3}))
|
(?-m)$)
)
There is no syntax for the end of the section, so the pattern needs to
match the next title and bar and use that as the end-of-section
marker.
I put this in a positive lookahead assertion because otherwise it
seemed
not to look in that text when applying the pattern again for the next
function (even though the next section isn't part of the "function"
group). Of course, the last section doesn't have a next section, so I
also allow the assertion to match the end of the file.
I think (b) is probably impossible with CLMs.
For (c), I came up with this pattern:
(?x:
(?P<function>
^(?P<function_name>.+)\x0D
(?P<bar>\+{3}|={3}|-{3}|~{3}|\.{3}).*\x0D
(?s).*?
)
(?=(\x0D(?-s).*\x0D
(?P=bar))
|
(?-m)$)
)
The difference here is that it requires the next section to have the
same bar character as the current function, i.e. the next section must
be of the same level.
When I search for this pattern from the Find & Replace window, it
seems
to correctly find all the sections and subsections. However, when I
put
it in the CLM BBEdit only finds the top-level sections. Is there
something wrong with my pattern, or do CLMs not support nested
functions? I'm guessing the latter, because of Seth's message earlier
today, but it would be nice to know for sure.
--Michael
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>