[Home]WikiBugs/LinksOnRecentChangesAlwaysCapitalized

UseModWiki | WikiBugs | RecentChanges | Preferences

If $FreeUpper is set to 0, lowercase page names appears correct on RecentChanges, but in the link the page name is capitalized.

FIX:

in FreeToNormal() replace

 $id = ucfirst($id);

with

 $id = ucfirst($id) if ($FreeUpper);

-- MarkusLude


I am not certain this is a bug--could you give me a sample of what you think should happen? Your fix will not change the code behavior at all when $FreeUpper is set to 1, which makes your report confusing. (You seem to be reporting a problem that happens when $FreeUpper is set to 1.) The default for $FreeUpper is 1, and not many people are likely to change it.

The wiki code is designed to always make the first letter of a page name uppercase, which allows a little bit of case-insensitivity that works well in English wikis. (Consider the following sentences with links: "[My vacation pictures]? are now posted." "I went on vacation--see [my vacation pictures]?.") Even if $FreeUpper is set to 0 both links will be to the same page. If $FreeUpper is set to 1 then all words in the link will be capitalized.

I'm still willing to look into this more, but I don't see the bug here. --CliffordAdams

Sorry, this happens only if $FreeUpper is set to 0, not 1. The lowercase page name and the capitalized link is confusing and inconsistent. In my opinion both should be lowercase (or both capitalized). -- MarkusLude

I seem to have forgotten one further detail. Links like test give action=edit&id=Test. In this case "test" is capitalized. If you enter action=edit&id=test directly as parameters to the wiki script, the pagename is lowercase and the strange behaviour mentioned above occures. Compare to entry on RecentChanges.

I just inserted the following code for 1.0 (into the DoEdit subroutine), which should stop this from happening again:

  if ($FreeLinks) {
    $id = &FreeToNormal($id);  # Take care of users like Markus Lude :-)
  }
--CliffordAdams (Note that this particular wiki is not yet using the 1.0 (actually 0.99-final-beta) code as of August 6, 2003.)

I don't understand the purpose of FreeUpper, if page names almost always get capitalized.

-- MarkusLude

The FreeUpper setting capitalizes all words within a free link: [my vacation pictures]? becomes a link to the page titled "My Vacation Pictures" (all words capitalized). If FreeUpper is set to 0 and $UpperFirst? is set to 1, the link [my vacation pictures]? goes to a page titled "My vacation pictures". If both are set to 0, the link will go to "my vacation pictures". Finally, if $FreeUpper is 1 and $UpperFirst? is 0, the code will act the same as if both settings were 1.

The $FreeUpper code only recognizes the characters [a-z] as lowercase, while the $UpperFirst? option uses Perl's ucfirst() option. This could cause some strangeness on non-English wikis, since non-[a-z] characters will only be uppercased if they are the first character of a page name.

Note that on most non-Windows systems the filesystem is case-sensitive, so different titles will lead to different pages. This is the main reason for the default setting of $FreeUpper to 1. --CliffordAdams


For 1.0 I have made the ucfirst($id) code optional with a new minor option called $UpperFirst?, which is set to 1 by default (which keeps the current behavior). If you set it to 0, the wiki will no longer automatically uppercase the first letter of a free link. One reason I made this change is that I am not certain that ucfirst() is always a safe thing to do with other languages and charsets. (It should be safe since localization should change the behavior of ucfirst(), but I can conceive of ways that things could go wrong.) --CliffordAdams

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 15, 2007 3:18 am by MarkusLude (diff)
Search: