This code change allows page names to have spaces in. URL's are then in this format when you have mod_rewrite ( i havnt tested it without mod_rewrite - i suspect it would fall over so any solution to this would be good) http://www.domain.com/Page+Name+here. That would go to a page called 'Page Name here'.

This also changes the format for forced links. Because pages can now have spaces obviouly the old method of the seperator being a space wont work any more. So on JavaWoman JavaWoman's suggestion i changed it to a | (pipe). the new format after these changes for a forced link is [[name here|link text here]] or [[name here]]

edit:
THIS CODE IS NOT QUITE READY
just realised it breaks the category system a bit. and probly the backlink action




in wikka.php find:
  1. // is this a full link? ie, does it contain alpha-numeric characters?
  2. elseif (preg_match("/[^[:alnum:],ÄÖÜ,ßäöü]/", $tag))


and replace it with:
  1. // is this a full link? ie, does it contain characters not valid for a wiki page name?
  2. // changed so that a space is a valid character for a wikiname
  3. elseif (preg_match("/[^[:alnum:] ÄÖÜßäöü]/", $tag))



and last but not least, find:
  1. return ($linkedPage ? "<a href=\"".$this->Href($method, $linkedPage['tag'])."\" title=\"$title\">".$text."</a>" : "<a class=\"missingpage\" href=\"".$this->Href("edit", $tag)."\" title=\"Create this page\">".$text."</a>");


and replace with:
  1. // changed so that the tag name is urlencoded. this converts the spaces to +'s to make the URL valid
  2. return ($linkedPage ? "<a href=\"".$this->Href($method, urlencode($linkedPage['tag']))."\" title=\"$title\">".$text."</a>" : "<a class=\"missingpage\" href=\"".$this->Href("edit", urlencode($tag))."\" title=\"Create this page\">".$text."</a>");


then in handlers/page/edit.php find
  1. if (!(preg_match("/^[A-Za-zÄÖÜßäöü]+[A-Za-z0-9ÄÖÜßäöü]*$/s", $this->tag))) {


and replace with:
  1. // changed so the edit handler allows pages with spaces in the names to be created/edited
  2. if (!(preg_match("/^[A-Za-zÄÖÜßäöü]+[A-Za-z 0-9+ÄÖÜßäöü]*$/s", $this->tag))) {


and the last file to change is formatters/wakka.php.
find:
  1. else if (preg_match("/^\[\[(\S*)(\s+(.+))?\]\]$/s", $thing, $matches))      # recognize forced links across lines


and replace with:
  1. // changed so that the seperator for forced links is a | (pipe) and not the first space.
  2. else if (preg_match("/^\[\[(.+?)(\|(.+))?\]\]$/s", $thing, $matches))       # recognize forced links across lines


i THINK thats all of the changes. let me know what you think, if anything needs to be changed or whatever.


Need Help

So so.. i can't use FreeLinks at WikiName with Korean or Japanese.
If fill in WikiName with Japanese, ???????? is output and can't create mySQL db field. If fill in WikiName with Korean, i have to see just blank page.

Somebody any idea?


Categories: CategoryUserContributions
Comments
Comment by 82.231.148.85
2006-02-08 16:14:04
Is there a working solution for free links (including Categories) now ?
Comment by DarTar
2006-02-09 06:54:19
Wikka uses forced links and named forced links - we are not planning to support free links atm.
Comment by 131.254.11.199
2006-02-09 07:31:50
Why not? I think it would nice as a configurable option. In some languages writing as camel case is really bad (for example in french, where words are usually longer than in english, camel case is hard on the eyes: UneNouvelleConstitutionEuropéenne). It is also not natural for new users. I know I can uncamel easily the output, but then writing/editing would be different than in viewing mode which is a bit confusing. In addition, as it is mentioned in this page, support for mod_rewrite is important in many sites.
Comment by DarTar
2006-02-09 08:17:44
There are different reasons why we are not planning free links atm.
The first one is backward compatibility: given the convention of using a space to separate the page tag from the link description in named forced links:
[[link This is a link]]
if we implemented free links this would result in incorrectly parsed links for websites running older versions of Wikka. A simple enhancement would be to allow undescores in page names. We are planning to add some flexibility to the regex patterns used for valid links, so stay tuned...

Forced links and free links are really two different ways of implementing links. You are not limited to camelcase in Wikka, you can easily create (named) forced links like [[blabla]] or [[blabla This is a link]] or even [[blabla 简体中文]].
The problem of long tags readability is addressed by the SmartTitle function: http://wikkawiki.org/SmartTitlesInfo
Comment by 131.254.11.199
2006-02-09 12:34:14
I see the point regarding backward compatibility, and I agree it is very important not to break existing markup. Thanks for pointing me to the "smart titles" tip...
However, I think I will try to add support for an alternative markup for free links, such as @"a free link", in my local installation.

It is true that it is possible to "force" non-camel links, but unfortunately as every tags are nevertheless encoded as wiki words in Wikka, they popup everywhere: in index, in categories listings, in titles. Then, the mix up between camel and uncameled names is even more confusing to explain to users.

The solution to uncamel on the fly is not good either, as "cameling" is a lossy operation raising ambiguities when it comes to recover the spaces: Using iTunes -> UsingITunes -> ? Using I Tunes or Using ITunes ?
-- Paul
Comment by DarTar
2006-02-09 15:37:58
Paul, one of the features I would like to see implemented in future releases is an option to enable/disable CamelCase. I agree it is annoying when your wiki contains a lot of "natural" CamelCase strings that you don't want to have automatically parsed as links.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki