From: Sabri L. <sab...@st...> - 2007-09-28 08:57:50
|
Hi all, I'm using phpwiki-1.3.12 and I'm trying to make it recognize CamelCase = words with numbers inside as wikiwords, fo example: - CamelCase2 -> is a wikiword - Camel2Case -> is also a wiki word - 2CamelCase -> is also a wiki word I think there should be a regular expression somewhere in the code that = decides if a word is a wikiword. Can someone teel where to find it ? If = there will some side effects whenever numbers are considered into = wikiwords ? Thanks, -- Sabri. |
From: Campo W. <rf...@nl...> - 2007-09-28 16:39:02
|
On Fri, Sep 28, 2007 at 10:57:24AM +0200, Sabri LABBENE wrote: > Hi all, > I'm using phpwiki-1.3.12 and I'm trying to make it recognize CamelCase words with numbers inside as wikiwords, fo example: > - CamelCase2 -> is a wikiword > - Camel2Case -> is also a wiki word > - 2CamelCase -> is also a wiki word > > I think there should be a regular expression somewhere in the code that decides if a word is a wikiword. Can someone teel where to find it ? If there will some side effects whenever numbers are considered into wikiwords ? Hi, We had a similar requirement and solved it back with phpwiki 1.3.3 by changing the definition of $WikiNameRegexp in index.php With more recent releases there is WIKI_NAME_REGEXP in config/config.ini It takes some tweaking to arrive at the right compromise between the regex being too wide or too narrow. I think too wide is worse than too narrow: you can always force linking to a page by putting the name in [brackets], which is less painful than having to escape every other word on a page... We have been using this for years now: WIKI_NAME_REGEXP = "(?<![[:alnum:]])[[:upper:]][[:alnum:]]*?[[:lower:]][[:alnum:]]*?[[:upper:]][[:alnum:]]*(?![[:alnum:]])"; Btw, the default is WIKI_NAME_REGEXP = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" Hth, -- $_ = "Campo Weijerman [rfc822://nl.ibm.com/]" and tr-[:]/-<@>-d and print; |
From: Reini U. <ru...@x-...> - 2007-09-29 09:06:20
|
Campo Weijerman schrieb: > On Fri, Sep 28, 2007 at 10:57:24AM +0200, Sabri LABBENE wrote: >> Hi all, >> I'm using phpwiki-1.3.12 and I'm trying to make it recognize CamelCase words with numbers inside as wikiwords, fo example: >> - CamelCase2 -> is a wikiword >> - Camel2Case -> is also a wiki word >> - 2CamelCase -> is also a wiki word >> >> I think there should be a regular expression somewhere in the code that decides if a word is a wikiword. Can someone teel where to find it ? If there will some side effects whenever numbers are considered into wikiwords ? > > Hi, > > We had a similar requirement and solved it back with phpwiki 1.3.3 by > changing the definition of $WikiNameRegexp in index.php > > With more recent releases there is WIKI_NAME_REGEXP in config/config.ini > > It takes some tweaking to arrive at the right compromise between the > regex being too wide or too narrow. I think too wide is worse than > too narrow: you can always force linking to a page by putting the name > in [brackets], which is less painful than having to escape every other > word on a page... > > We have been using this for years now: > > WIKI_NAME_REGEXP = "(?<![[:alnum:]])[[:upper:]][[:alnum:]]*?[[:lower:]][[:alnum:]]*?[[:upper:]][[:alnum:]]*(?![[:alnum:]])"; > > Btw, the default is > > WIKI_NAME_REGEXP = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" config-dist.ini in CVS has these options: http://phpwiki.cvs.sourceforge.net/phpwiki/phpwiki/config/config-dist.ini?revision=1.83&view=markup ; Perl regexp for WikiNames ("bumpy words"): ; (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well ; Allow digits: BumpyVersion132 ; WIKI_NAME_REGEXP = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]]+){2,}(?![[:alnum:]])" ; Allow lower+digits+dots: BumpyVersion1.3.2 ; WIKI_NAME_REGEXP = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]\.]+){2,}(?![[:alnum:]])" ; Default old behaviour, no digits as lowerchars. ;WIKI_NAME_REGEXP = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" -- Reini Urban http://phpwiki.org/ http://murbreak.at/ http://helsinki.at/ http://spacemovie.mur.at/ |
From: Sabri L. <sab...@st...> - 2007-10-01 11:35:12
|
Reini Urban wrote: >Campo Weijerman schrieb: >> On Fri, Sep 28, 2007 at 10:57:24AM +0200, Sabri LABBENE wrote: >>> Hi all, >>> I'm using phpwiki-1.3.12 and I'm trying to make it >recognize CamelCase words with numbers inside as wikiwords, fo example: >>> - CamelCase2 -> is a wikiword >>> - Camel2Case -> is also a wiki word >>> - 2CamelCase -> is also a wiki word >>> >>> I think there should be a regular expression somewhere in >the code that decides if a word is a wikiword. Can someone >teel where to find it ? If there will some side effects >whenever numbers are considered into wikiwords ? >> >> Hi, >> >> We had a similar requirement and solved it back with phpwiki 1.3.3 by >> changing the definition of $WikiNameRegexp in index.php >> >> With more recent releases there is WIKI_NAME_REGEXP in >> config/config.ini >> >> It takes some tweaking to arrive at the right compromise between the >> regex being too wide or too narrow. I think too wide is worse than >> too narrow: you can always force linking to a page by putting the name >> in [brackets], which is less painful than having to escape every other >> word on a page... I tried the regexp and it keeps catching CamelCase words without digits inside. I don't understand why you need to escape some other words in your page. May be you have as requirement to only link pagenames that contains digits. >> We have been using this for years now: >> >> WIKI_NAME_REGEXP = >> >"(?<![[:alnum:]])[[:upper:]][[:alnum:]]*?[[:lower:]][[:alnum:]]*?[[:up >> per:]][[:alnum:]]*(?![[:alnum:]])"; >> >> Btw, the default is >> >> WIKI_NAME_REGEXP = >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" > >config-dist.ini in CVS has these options: >http://phpwiki.cvs.sourceforge.net/phpwiki/phpwiki/config/confi >g-dist.ini?revision=1.83&view=markup > >; Perl regexp for WikiNames ("bumpy words"): >; (?<!..) & (?!...) used instead of '\b' because \b matches >'_' as well >; Allow digits: BumpyVersion132 >; WIKI_NAME_REGEXP = >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]]+){2,}(?![[: >alnum:]])" >; Allow lower+digits+dots: BumpyVersion1.3.2 >; WIKI_NAME_REGEXP = >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]\.]+){2,}(?![ >[:alnum:]])" >; Default old behaviour, no digits as lowerchars. >;WIKI_NAME_REGEXP = >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" Great, it works ! Thanks Reini and Campo. Best Regards, -- Sabri. |
From: Campo W. <rf...@nl...> - 2007-10-01 12:52:04
|
On Mon, Oct 01, 2007 at 01:35:02PM +0200, Sabri LABBENE wrote: > Reini Urban wrote: > >Campo Weijerman schrieb: > >> On Fri, Sep 28, 2007 at 10:57:24AM +0200, Sabri LABBENE wrote: > >>> Hi all, > >>> I'm using phpwiki-1.3.12 and I'm trying to make it > >recognize CamelCase words with numbers inside as wikiwords, fo example: > >>> - CamelCase2 -> is a wikiword > >>> - Camel2Case -> is also a wiki word > >>> - 2CamelCase -> is also a wiki word > >>> > >>> I think there should be a regular expression somewhere in > >the code that decides if a word is a wikiword. Can someone > >teel where to find it ? If there will some side effects > >whenever numbers are considered into wikiwords ? > >> > >> Hi, > >> > >> We had a similar requirement and solved it back with phpwiki 1.3.3 by > >> changing the definition of $WikiNameRegexp in index.php > >> > >> With more recent releases there is WIKI_NAME_REGEXP in > >> config/config.ini > >> > >> It takes some tweaking to arrive at the right compromise between the > >> regex being too wide or too narrow. I think too wide is worse than > >> too narrow: you can always force linking to a page by putting the name > >> in [brackets], which is less painful than having to escape every other > >> word on a page... > > I tried the regexp and it keeps catching CamelCase words without digits > inside. I don't understand why you need to escape some other words in your > page. May be you have as requirement to only link pagenames that contains > digits. Sure. The problem is, if you start tweaking the regexp it is easy to come up with something that considers too many words a WikiWord, and you'll end up having to escape lots of words. > >> We have been using this for years now: > >> > >> WIKI_NAME_REGEXP = > >> > >"(?<![[:alnum:]])[[:upper:]][[:alnum:]]*?[[:lower:]][[:alnum:]]*?[[:up > >> per:]][[:alnum:]]*(?![[:alnum:]])"; > >> > >> Btw, the default is > >> > >> WIKI_NAME_REGEXP = > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" > > > >config-dist.ini in CVS has these options: > >http://phpwiki.cvs.sourceforge.net/phpwiki/phpwiki/config/confi > >g-dist.ini?revision=1.83&view=markup > > > >; Perl regexp for WikiNames ("bumpy words"): > >; (?<!..) & (?!...) used instead of '\b' because \b matches > >'_' as well > >; Allow digits: BumpyVersion132 > >; WIKI_NAME_REGEXP = > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]]+){2,}(?![[: > >alnum:]])" > >; Allow lower+digits+dots: BumpyVersion1.3.2 > >; WIKI_NAME_REGEXP = > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]\.]+){2,}(?![ > >[:alnum:]])" > >; Default old behaviour, no digits as lowerchars. > >;WIKI_NAME_REGEXP = > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" > > Great, it works ! > Thanks Reini and Campo. Actually, the suggestions offered by Reini better match what you asked for. I use phpwiki mostly for documenting IT-related stuff, and as we all know there are many acronyms used. The traditional definition of WikiWord will include anything containing an embedded acronym, like for example DocBookXML2LaTeX (at least, I don't think it does). The alternative regexp I am now using will match any sequence of non-blank non-punctuation that starts with a Capital letter and alternates sufficiently between lower and uppercase. This works pretty well. Regards, -- $_ = "Campo Weijerman [rfc822://nl.ibm.com/]" and tr-[:]/-<@>-d and print; |
From: Sabri L. <sab...@gm...> - 2007-10-01 13:05:40
|
On 10/1/07, Campo Weijerman <rf...@nl...> wrote: > > On Mon, Oct 01, 2007 at 01:35:02PM +0200, Sabri LABBENE wrote: > > Reini Urban wrote: > > >Campo Weijerman schrieb: > > >> On Fri, Sep 28, 2007 at 10:57:24AM +0200, Sabri LABBENE wrote: > > >>> Hi all, > > >>> I'm using phpwiki-1.3.12 and I'm trying to make it > > >recognize CamelCase words with numbers inside as wikiwords, fo example: > > >>> - CamelCase2 -> is a wikiword > > >>> - Camel2Case -> is also a wiki word > > >>> - 2CamelCase -> is also a wiki word > > >>> > > >>> I think there should be a regular expression somewhere in > > >the code that decides if a word is a wikiword. Can someone > > >teel where to find it ? If there will some side effects > > >whenever numbers are considered into wikiwords ? > > >> > > >> Hi, > > >> > > >> We had a similar requirement and solved it back with phpwiki 1.3.3 by > > >> changing the definition of $WikiNameRegexp in index.php > > >> > > >> With more recent releases there is WIKI_NAME_REGEXP in > > >> config/config.ini > > >> > > >> It takes some tweaking to arrive at the right compromise between the > > >> regex being too wide or too narrow. I think too wide is worse than > > >> too narrow: you can always force linking to a page by putting the > name > > >> in [brackets], which is less painful than having to escape every > other > > >> word on a page... > > > > I tried the regexp and it keeps catching CamelCase words without digits > > inside. I don't understand why you need to escape some other words in > your > > page. May be you have as requirement to only link pagenames that > contains > > digits. > > Sure. The problem is, if you start tweaking the regexp it is easy to > come up with something that considers too many words a WikiWord, and > you'll end up having to escape lots of words. > > > >> We have been using this for years now: > > >> > > >> WIKI_NAME_REGEXP = > > >> > > >"(?<![[:alnum:]])[[:upper:]][[:alnum:]]*?[[:lower:]][[:alnum:]]*?[[:up > > >> per:]][[:alnum:]]*(?![[:alnum:]])"; > > >> > > >> Btw, the default is > > >> > > >> WIKI_NAME_REGEXP = > > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" > > > > > >config-dist.ini in CVS has these options: > > >http://phpwiki.cvs.sourceforge.net/phpwiki/phpwiki/config/confi > > >g-dist.ini?revision=1.83&view=markup > > > > > >; Perl regexp for WikiNames ("bumpy words"): > > >; (?<!..) & (?!...) used instead of '\b' because \b matches > > >'_' as well > > >; Allow digits: BumpyVersion132 > > >; WIKI_NAME_REGEXP = > > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]]+){2,}(?![[: > > >alnum:]])" > > >; Allow lower+digits+dots: BumpyVersion1.3.2 > > >; WIKI_NAME_REGEXP = > > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:][:digit:]\.]+){2,}(?![ > > >[:alnum:]])" > > >; Default old behaviour, no digits as lowerchars. > > >;WIKI_NAME_REGEXP = > > >"(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])" > > > > Great, it works ! > > Thanks Reini and Campo. > > Actually, the suggestions offered by Reini better match what you asked > for. I use phpwiki mostly for documenting IT-related stuff, and as we > all know there are many acronyms used. The traditional definition of > WikiWord will include anything containing an embedded acronym, like > for example DocBookXML2LaTeX (at least, I don't think it does). The > alternative regexp I am now using will match any sequence of non-blank > non-punctuation that starts with a Capital letter and alternates > sufficiently between lower and uppercase. This works pretty well. OK, I see. BTW, did you faced some slowness in document rendering, or any other side effects after changing the regexp aside from having to escape other words? BR -- Sabri. |
From: Campo W. <rf...@nl...> - 2007-10-01 14:34:41
|
On Mon, Oct 01, 2007 at 03:05:41PM +0200, Sabri LABBENE wrote: > OK, I see. > BTW, did you faced some slowness in document rendering, or any other side > effects after changing the regexp aside from having to escape other words? I didn't notice anything like that. Just change it and see what happens--if you don't like it, change it again, or change it back. There is one gotcha: when playing with it, I used to open any page in edit mode, then hit Preview to see which words would be rendered as WikiWords. With 1.3.14 and the MonoBook theme, this now seems to be delayed until the page is finally saved. Similarly, the effect of changing the the regexp will not become obvious immediately. There may be an admin option somewhere that lets you re-generate all pages, I think it's called the markup cache. Hth, -- $_ = "Campo Weijerman [rfc822://nl.ibm.com/]" and tr-[:]/-<@>-d and print; |
From: Sabri L. <sab...@gm...> - 2007-10-01 15:59:49
|
On 10/1/07, Campo Weijerman <rf...@nl...> wrote: > > On Mon, Oct 01, 2007 at 03:05:41PM +0200, Sabri LABBENE wrote: > > OK, I see. > > BTW, did you faced some slowness in document rendering, or any other > side > > effects after changing the regexp aside from having to escape other > words? > > I didn't notice anything like that. Just change it and see what > happens--if you don't like it, change it again, or change it back. At the moment, every thing is ok in my wiki. I just wanted to know more about your case and if have you have noticed something particular after changin the wiki regexp. There is one gotcha: when playing with it, I used to open any page in > edit mode, then hit Preview to see which words would be rendered as > WikiWords. With 1.3.14 and the MonoBook theme, this now seems to be > delayed until the page is finally saved. Similarly, the effect of > changing the the regexp will not become obvious immediately. There may be > an admin option somewhere that lets you re-generate all pages, I think it's > called the markup cache. Right. Purging the cached html versions of the pages from admin section will regenerate every page from its markup. Thanks for sharing you experiments. BR -- Sabri. |
From: Reini U. <ru...@x-...> - 2007-10-01 16:25:32
|
I also have a new plugin with action page which regenerates the markup cache: page:_Retransform <? plugin _Retransform ?> call it like MyPage?action=_Retransform change config.ini MyPage?action=_Retransform 2007/10/1, Sabri LABBENE <sab...@gm...>: > On 10/1/07, Campo Weijerman <rf...@nl...> wrote: > > On Mon, Oct 01, 2007 at 03:05:41PM +0200, Sabri LABBENE wrote: > > > OK, I see. > > > BTW, did you faced some slowness in document rendering, or any other > side > > > effects after changing the regexp aside from having to escape other > words? > > > > I didn't notice anything like that. Just change it and see what > > happens--if you don't like it, change it again, or change it back. > > > At the moment, every thing is ok in my wiki. I just wanted to know more > about your case and if have you have noticed something particular after > changin the wiki regexp. > > > There is one gotcha: when playing with it, I used to open any page in > > edit mode, then hit Preview to see which words would be rendered as > > WikiWords. With 1.3.14 and the MonoBook theme, this now seems to be > > delayed until the page is finally saved. Similarly, the effect of > changing the the regexp will not become obvious immediately. There may be > an admin option somewhere that lets you re-generate all pages, I think it's > called the markup cache. > > > Right. Purging the cached html versions of the pages from admin section will > regenerate every page from its markup. > > Thanks for sharing you experiments. > > BR > -- Sabri. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwiki-talk > > -- Reini Urban http://phpwiki.org/ http://murbreak.at/ http://spacemovie.mur.at/ http://helsinki.at/ |