David Barrett wrote:
-----Original Message----- From: Joel
Hi David,
It's not clear what rules you are using for Format Detection. Could you expound a little bit? As you know, these formatting rules are very ambiguous and rather context sensitive. I'd have to write that in Spirit's EBNF. Fortunately, Spirit allows context sensitivity and ambiguous grammars to some extent but there still has to be some formality. Let's focus with the *bold* markup. When does it apply and when does it not? For example, how do you detect that 3*4*5 will not make the 4 bold?
Yes, it's a nasty problem. Here is the regular expression I use for bold:
'/(?<=^|^\W|\s\W|\s|<b>|<i>|<code>)\*(([^*\s]+\s+)*[^*\s]+)\*(?=<\/b>|<\/i>|
<\/code>|\s|\W\s|\W$|$)/i'
Now, before giving me a headache (I always get one when reading regexes-- certainly one of the reasons why I wrote Spirit), how do you translate that in simple english?
In essence, I only allow bold under certain circumstances, and disallow
everything else. In the case you mention (3*4*5), my pattern would fail
because it's not surrounded by whitespace or non-word characters.
From what I gather, bold is applied only when all these are satisfied:
--> whitespace precedes the start * --> whitespace succeeds the end * --> non-whitespace succeeds the start * --> non-whitespace precedes the end *
anything else?
[...]
Cheers, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Boost-docs mailing list [EMAIL PROTECTED] Unsubscribe and other administrative requests: https://lists.sourceforge.net/lists/listinfo/boost-docs
