i had thought that i needed to add some sort of word boundary character to get this to work; such as [].

and i only thought that since that was required to make this work.

but after looking at the code i see that the filter actually attempts to do what i need it to do; which is to use even spaces as a word boundary.

the issue is; that my wysiwyg editor doesnt allow me to put an acronym on a line by itself without stripping spaces.

so when i simply put:

 CTA 

even with spaces on either side of it, the output html that hits the abbrev filter looks like this:

<p>&nbsp;CTA</p>

so even though it replaces my first space with a nbsp, the semi-colon from that does work as a word boundary; but it simply strips the trailing space (and then adds P tags around the whole thing.

it would seem like this should still work; but the < in the closing P tag does not work as a word boundary and therefore a match is not found.

i am not a regex expert.. but i'll see if i can figure out the correct $pattern for this.

CommentFileSizeAuthor
#3 abbrvfilter-use_tag_boundary.patch1.01 KBliquidcms

Comments

liquidcms’s picture

I am sure there is a reason for the < filter in the last line of $pattern definition; but if it is removed and the line becomes this:

(?=([^\>]|[^\>]*$)) # Which is followed by any number of characters that are not ">", and then either "<" or the end of the string

this seems to work.

liquidcms’s picture

ok, my fix above doesn't work. So still need a change to the regex so that html tags (actual just so that a <) is seen as a word boundary.

liquidcms’s picture

Title: html tags not considered word boundaries » consider html tags as word boundaries, and i18n support
Status: Active » Needs review
StatusFileSize
new1.01 KB

ok, this seems better:

not sure why this line:
([^\>\w]) # Any character that is not a word character

simply a word boundary seemed better, so I replaced with

(/b)

and this works much better now.

also, i added support for i18n