Edgewall Software
Modify

Opened 11 years ago

Last modified 10 years ago

#11359 new defect

unintentional Camelcase links with slashes e.g. Bla/Blo

Reported by: anonymous Owned by:
Priority: normal Milestone: undecided
Component: wiki system Version: 1.0-stable
Severity: minor Keywords: link camelcase
Cc: Ryan J Ollos Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Two ore more Uppercase words separated by a slash e.g. Bla/Blo are treated as CamelCase and therefore generate a wikipage link. This is not welcome. It should better not be hyper-linked.

Examples

"Bla/Blo", "Tom/Thomas" and "Berlin/Germany" produce unwanted wiki-links to non-existing wiki pages.

Argumentation

In routine work it happens quite often that unintended (dead) hyperlinks are created when writing texts fragments e.g. in Berlin/Germany or Tom/Lisa said.
In my opinion it should be like this:

  • Germany/Berlin → shall be not be linked,
  • LocationGermany/Berlin → shall be linked

because the first one can occur in natural writing and natural writing shall not be wiki-interpreted. In my opinion Germany/Berlin shall not be interpreted as CamelCase.

According to CamelCase and WikiPageNames slashes are allows to make "hierarchy" links. Rule 5 of WikiPageNames says:

  1. The use of slash ( / ) is permitted in page names (possibly representing a hierarchy).

In my opinion this rule should be changed as follows:

  1. The use of slash ( / ) is permitted in page names (possibly representing a hierarchy). In this case the above rules apply to each of the name fragments.'

Severity and Workaround

I do not really have a big problem here, since:

  • one can simple insert spaces Germany / Berlin or
  • escape the link with an exclamation mark e.g. !Camel/Case or
  • use one of the configuration options e.g. ignore_missing_pages = true.

However I think that the wiki processor shall not negatively interfere with natural writing.

Relation and History

There is also an old discussion in #733 (especially comment:3). It seemed to be solved for TRAC 0.9 in 2004 but until then somehow there was an regression and the unwanted effect reappeared..

The effect of unwanted linking is reported for TRAC versions 0.12, 1.0 and 1.1(dev). Other version I cannot test other versions now, but from my memories I believe that TRAC 0.10 and/or 0.11 did not suffer from the effect.

Attachments (0)

Change History (7)

comment:1 by Ryan J Ollos, 11 years ago

I didn't catch the mailing list discussion until just now, so I'll just be repeating what was already described there. The behavior appears to be intentional, or at least known and well-described at the time it was implemented: #9025 and [9252].

I have also found it to be unexpected that Germany/Berlin is interpreted as a link. You say that LocationGermany/Berlin should be linked. Should Germany/LocationBerlin also be linked? The latter seems even more natural than LocationGermany/Berlin, since it could be interpreted as a wikipage within the Germany page index. Maybe the best solution is to require at least one of the words to be CamelCased.

I haven't tested extensively, but I think the following patch might fix the issue:

  • trac/wiki/api.py

    diff --git a/trac/wiki/api.py b/trac/wiki/api.py
    index 343d738..aaa82d4 100644
    a b class WikiSystem(Component):  
    341341
    342342    def get_wiki_syntax(self):
    343343        wiki_page_name = (
    344             r"(?:[%(upper)s](?:[%(lower)s])+/?){2,}" # wiki words
     344            r"((?:[%(upper)s](?:[%(lower)s])+)+/)*"  # capitalized or camelcase word
     345            r"(?:[%(upper)s](?:[%(lower)s])+){2,}"   # wiki camelcase word
     346            r"(/(?:[%(upper)s](?:[%(lower)s])+)+)*"  # capitalized or camelcase word
    345347            r"(?:@[0-9]+)?"                          # optional version
    346348            r"(?:#%(xml)s)?"                         # optional fragment id
    347349            r"(?=:(?:\Z|\s)|[^:\w%(upper)s%(lower)s]|\s|\Z)"

I agree with Peter's comment on the mailing list that it isn't good to change existing behavior, though if the behavior didn't already exist, I think it would be best to not have Germany/Berlin interpreted as a link.

comment:2 by Ryan J Ollos, 11 years ago

Cc: Ryan J Ollos added

in reply to:  description comment:3 by Peter Suter, 11 years ago

Yes, maybe if this wouldn't exist yet there would be little reason to introduce it.

But there are several easy and effective workarounds:

Severity and Workaround

I do not really have a big problem here, since:

  • one can simple insert spaces Germany / Berlin or
  • escape the link with an exclamation mark e.g. !Camel/Case or
  • use one of the configuration options e.g. ignore_missing_pages = true.

Are there any for when this is changed? (I.e. so all links like Maps/Germany written since 11.7 still link to the existing subpages.)

(Except "Carefully review all existing wikitext in pages, tickets, etc. and fix all important links that have stopped working.")

If not, I would vote for WONTFIX and update the documentation if necessary.

comment:4 by anonymous, 11 years ago

Clemens Feige wrote:

In my opinion it should be like this:

Germany/Berlin → shall be not be linked,

From: Peter Suter

I'm not so sure it's a good idea to change this back. Trac users since 0.12 have surely intentionally created such pages and links.

Hi Peter.

Indeed, one has to balance my proposal with backward-compatibility with those cases which depend on the regression.

However, I would claim that most users which actively use implicit CamelCase-hyperlinking always use CamelCase wiki page names. The other smaller group of users, which use non-CamelCase wiki page names, would use the explicit wiki: macro anyway. I other words the impact of backward compatibility would not be as big as it looks at first view.

I vote for changing the regex to have Germany/Berlin not be linked. I prefer good software usability and confusion avoidance over backward compatibility. Note that we are talking of "backward compatibility" to an regression i.e. to a bug. Remember that with older TRAC versions (0.9?) it worked the other way. I was confused when things changed, and I have many old wiki texts which depend on the old behaviour.

Clemens

in reply to:  4 comment:5 by anonymous, 11 years ago

I am Clemens Feige, the one who reported this ticket.

Sorry, for anonymous writing. I do not have a TRAC account yet. I promise to create one soon.

Replying to anonymous:

Clemens Feige wrote:

in reply to:  1 comment:6 by Christian Boos, 11 years ago

Replying to rjollos:

[…] I haven't tested extensively, but I think the following patch might fix the issue:

Seems to be working fine, but one motivation to implement it the way it was done in r9252 was that I could already measure a performance penalty by introducing the Lu and Ll lists (the 'upper' and 'lower' lists of Unicode characters used in that regexp are quite long, respectively 943 and 1217 characters). Repeating them more may induce further slow-downs (to be measured). Besides the performance issue, there's also a limit on the regexp size itself, don't forget this is only a piece of an even bigger regexp and sometimes people already hit that limit (#10190).

I agree with Peter's comment on the mailing list that it isn't good to change existing behavior, though if the behavior didn't already exist, I think it would be best to not have Germany/Berlin interpreted as a link.

If we had #425 (configurable or pluggable wiki page name syntax), it would be possible to keep the current behavior as default for existing installations yet make it easy to "fix" it for people that want another behavior.

comment:7 by Ryan J Ollos, 10 years ago

Milestone: undecided

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.