[Doc-SIG] Re: docutils REs
Edward D. Loper
edloper@gradient.cis.upenn.edu
Thu, 22 Mar 2001 11:20:29 EST
01> _descriptive = """\
02> (?P<item> # start our *item*
03> (?: # an unnamed group
04> [^\n]* # 0..n of anything but newline
05> '[^'\n]+' # a literal string, containing 1 or more chars
06> [^\n]* # 0..n of anything but newline
07> )* # end group
08>
09> | # or
10>
11> [^\n]* # 0..n of anything but newline
12>
13> (?! # negative lookahead for
14> ' # a quote
15> [^']* # 0..n of anything but quote
16>
17> [ ]+ -- [ ]+ # spaces -- spaces
18>
19> [^']* # 0..n of anything but quote
20> ' # a quote
21> ) # end of negative lookahead
22> ) # end of our *item*
23>
24> [ ]+ -- [ ]+ # spaces -- spaces
25>
26> (?P<text> .*) # 0..n of any character
27> """
What are lines 11-21 for? The only cases I can think of that
they capture (that 3-7 don't) are dubious cases like::
bad 'apostrophe nesting -- in the key
Also, I wanted to make sure you're clear that '^' and '$' match
beginning and end of LINE, not of STRING (although the latter is
a subset of the former). You might want to use '\Z' and '\A'
to be more clear (although '\Z' still bothers me a little because
it matches both '' and '\n' (but not '\n\n').. seems like it
should just match '').
I don't think that STNG currently requires whitespace before
*emph* or **strong** etc... that's why I coded it like I did.
But I think that STpy's approach may be more reasonable..
(we should start making a list of proposed changes to STNG,
in order to make STpy and STNG more compatible.. Otherwise,
STminus will just end up being a big useless mess :) )..
Hm.. I guess s/we/I/ in that last parenthetical. :-/
I haven't decided yet on whether I'm happy about having this
concept of "acceptable ending punctuation.." It sort of seems
like *all* punctuation should be ok, or *none*.. But I'll
think on it some more. (e.g., should it be ok to have a dash after
an *emph region*-like this?)
-Edward