[Pmwiki-users] New pages using numeric characters

John Rankin john.rankin
Sun Jan 11 14:54:16 CST 2004


I know this is bad practice, but I change pmwiki.php so that the AsSpaced
function reads:

function AsSpaced($word) {
  $word = str_replace('_',' ',$word);
  $word = preg_replace("/([a-z0-9])([A-Z])/","\$1 \$2",$word);
## add spaces between letters and numbers ##
#  $word = preg_replace("/([0-9]+( |\$))/"," \$1",$word);
  $word = preg_replace("/([a-z])([0-9]+( |\$))/","\$1 \$2",$word);
  return preg_replace("/([A-Z])([A-Z][a-z0-9])/","\$1 \$2",$word);
}

This change makes pmwiki treat a number after a lower case letter as
if it were an  uppercase letter, whereas it treats a number after an
upper case letter as if it were a lower case letter.


Then you can write {{Suite103}} and if $SpaceWikiWords is on, you get

  Suite 103 

as the text of links to a page called Suite103

Alternatively, why not just write: {{Suite 103}}

Hope this helps.
-- 
JR
--
John Rankin

On Saturday, 10 January 2004 4:22 AM, Jonathan Scott Duff <duff at lighthouse.tamucc.edu> wrote:
On Thu, Jan 08, 2004 at 10:01:01PM -0600, Dawn Green wrote:
> When trying to create a link and new page using a combination of letters and
> numbers, I typed the following:
> 
> [[Suite103 Suite 103]]
> 
> However, the saved version showed exactly that which I typed.  When creating
> a page by appending 'Suite103' to the end of the URL, the page was created
> just fine.  I was told that in order to force the new page using the
> letter/number combination, I should try:
> 
> [[{{Suite103}} Suite 103]]
> 
> This worked.  Is there a way to override this more complicated way of
> creating new pages with numbers for a more uniform page creation method?  I
> noticed that the PmWiki Doc index makes no mention of numeric characters for
> new pages.

You could change $WikiWordPattern such that it would treat "Suite103"
the same as it does "WikiWord"  i.e.

	Suite103	-> Suite	103
	WikiWord	-> Wiki		Word

But I can't think of a way to do that right off that doesn't mess up
something else.

Another option would be to use {{Suite_103}} and change the way pmwiki
renders that to turn the underscore into a space.

Or, maybe a combination of those two, but have pmwiki treat underscore
as a captial letter and then you would make your links as Suite_103

	Suite_103	-> Suite	_103
	WikiWord	-> Wiki		Word

I seem to recall some discussion in the past about turning underscores
into spaces, but I don't remember if that was for links or titles or
files-on-disk or what.  (Gee, if only we had a nice way to search the
archives  ;-)

Hope this helps,

-Scott
-- 
Jonathan Scott Duff
duff at lighthouse.tamucc.edu

_______________________________________________
Pmwiki-users mailing list
Pmwiki-users at pmichaud.com
http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com






More information about the pmwiki-users mailing list