[pmwiki-users] capital first letters
jo at durchholz.org
Fri Jul 1 01:38:15 CDT 2005
Patrick R. Michaud wrote:
> On Thu, Jun 30, 2005 at 02:07:02PM +0100, Hans wrote:
>>## firstcap markup
>> '<:block><p class=\'firstcap\'>$1$2</p>');
> Another way to do this is to actually look for the <p> tags
> after things have been converted into paragraphs and styled.
> Markup('firstcap', '>%%',
> '<p class=\'firstcap\'>$1');
> This even handles the case where other tags have been inserted between
> the initial paragraph tag and the first letter of the paragraph.
Slight improvement for the second line:
This should properly handle things like
<img title="foo -> bar">
One other generalisation should be done IMHO: Some tags should prevent
capitalisation. I can imagine stuff like <h1>, ... <h6>, <ul>, etc.
Not sure how that could be best done though; things that spring to my
mind are "lookahead assertion" (which may be entirely unnecessary
though), "do we look for tags that we want to skip, or do we look for
tags that we *don't* want to skip?", and "the tag list should be
separated out into a separate PHP variable, so that people who aren't
regex experts can make use of that".
More information about the pmwiki-users