00742: Uncapitalize links

Summary: Uncapitalize links
Created: 2006-05-21 05:32
Status: Discussion
Category: Feature
From: PRZ
Assigned:
Priority: 44
Version: 2.1
OS:

Description: The function [[PageName|+]], which replaces the page name by its title, is quite useful for translated pages, but it has a serious drawback: the replaced title is capitalised, so when inserting that in a sentence, you get a less than elegant look.

Another option allowing the use of an uncapitalised title may be useful; it can be done while using, for example, [[PageName|-]]

If PmWiki adds some string case conversion code, perhaps that code should

  • encompass the three basic case conversions: all lowercase, all uppercase and WikiWord (first letter of each word capitalized), and
  • be made generally available to any page-variable or string. Pico May 21, 2006, at 09:17 AM

..."If PmWiki adds some string case conversion code"...

Propose a markup...?

Pm


How about using "^" to signal uppercase, "_" to signal lower case, and "^_" to signal initial caps and wrapping them either in single square, or curly, brackets, like this:

  • [^upper case^]
    • [_lower case_] and
      • [^_initial caps_^] or [^_initial caps^_] or
  • {^upper case^}
    • {_lower case_} and
      • {^_initial caps_^} or {^_initial caps^_}

Pico May 23, 2006, at 09:31 PM

____

The Cookbook:MarkupExtensions recipe already uses [^footnote^]. I'll have to think about the others, though.

In some sense I'd like to have a generic markup that means "reformat the text". In addition to doing upper/lower/title case conversions, we also have an outstanding issue of wanting to be able to reformat dates and times. So, something that could generically handle all of these seems to be warranted.

--Pm

The grave (backtick or backquote) seems very underutilized: `WikiWord. What if it were used in a three-instance sequence, like a definition list, to enclose the text to be reformatted and then the reformatting instructions, something like this:

`string`Aa`String
`string`AA`STRING
`string`aa`string
`date`mm/dd/yyyy`05/24/2006
`date`yyyymmdd`20060524

Pico May 24, 2006, at 11:00 AM


With backtick it's hard to know where the beginning and ending is. Each of the examples above doesn't include values with whitespace, and once whitespace is introduced, it's hard to know what's being affected.

Also, the backticks will look like apostrophes to many people. So, it's hard to see the difference between (or know what will happen with):

    
    `Will this text be capitalized, since it has an `AA` in it? `aa`

    `Will this text be capitalized, since it has an 'AA' in it? `aa`

Of course, things get worse when we have something like:

    `this is bold and caps and this is just caps`AA`

Pm


How about a directive, like (:format:)? Could that be used to define some sort of string translation that could apply to all subsequent instances whenever a specified string, or its source, was rendered?

For example, for the current PITS proposal, could a (:format:) directive allow an author to specify the title by reference to its underlying source ({$Title}), or maybe even by reference to its triggering markup string, ("+" or "|+" or "|+]]"), so that every reference to [[PageName|+]], [[AnotherPageName|+]], would reformat the title?

The advantages of this would be that

  • the markup used throughout the page, such as [[PageName|+]], would not have to be burdened with reformatting markup
  • the directive can allow various parameters that would provide flexibility and power
  • perhaps the translation formulas can be expressed in markup, in the directive, or on a shared page (much like the fmt= parameter of pagelist and search directives can refer to conditions and markup "formulas" that can be clustered in separate templates, or on the current page

An alternative approach might be to look to wikistyles and provide extended functionality that allows a custom style to direct that text be reformatted whenever that custom style is invoked.

See Martin Fick's post about a (:linkpage args ...:) that would add the args to any page links on the page containing this directive automatically so that you would not have to add it manualy to every link on the page.


See Also: