Opened 9 years ago

Closed 9 years ago

#2223 closed Bug (fixed)

Unnecessary link piping

Reported by: Joe B. Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version: SVN (FCKeditor) - Retired
Keywords: fixed Cc:

Description

When defining links, every single link is piped, regardless of whether it is necessary or not.

For instance

[[William Adama]]

turns into

[[William Adama|William Adama]]

It is a mild irritation for those who like clean code (wiki or otherwise), since piping is unnecessary in the above case.

Attachments (9)

2223.patch (2.9 KB) - added by Artur Formella 9 years ago.
2223_2.patch (4.0 KB) - added by Artur Formella 9 years ago.
2223_3.patch (2.2 KB) - added by Artur Formella 9 years ago.
2223_4.patch (3.1 KB) - added by Artur Formella 9 years ago.
2223_5.patch (9.3 KB) - added by Artur Formella 9 years ago.
2223_5.2.patch (10.5 KB) - added by Artur Formella 9 years ago.
list.txt (1.5 KB) - added by Artur Formella 9 years ago.
2223_6.patch (11.2 KB) - added by Artur Formella 9 years ago.
2223_7.patch (11.3 KB) - added by Artur Formella 9 years ago.

Download all attachments as: .zip

Change History (31)

comment:1 Changed 9 years ago by Wojciech Olchawa

Keywords: Confirmed added; over link piping pipe link syntax removed
Version: SVN

Changed 9 years ago by Artur Formella

Attachment: 2223.patch added

comment:2 Changed 9 years ago by Artur Formella

Keywords: Review? added

comment:3 Changed 9 years ago by Wiktor Walc

Keywords: Review+ added; Review? removed

I can't find any issues with it. Go ahead committing it.

Changed 9 years ago by Artur Formella

Attachment: 2223_2.patch added

comment:4 Changed 9 years ago by Artur Formella

Keywords: Review? added; Review+ removed

It didn't work with link dialog. Repaired in 2223_2.patch

comment:5 Changed 9 years ago by Wiktor Walc

Keywords: Review+ added; Review? removed

comment:6 Changed 9 years ago by Artur Formella

Keywords: fixed added; Confirmed Review+ removed
Resolution: fixed
Status: newclosed

Fixed with 2394

comment:7 Changed 9 years ago by Wiktor Walc

Keywords: fixed removed

Fixed with [2394].

comment:8 Changed 9 years ago by Wiktor Walc

Resolution: fixed
Status: closedreopened

Ooops, it still doesn't work with links that contain underscore:

[[Foo_Bar]]

is changed into:

[[Foo Bar|Foo_Bar]]

Changed 9 years ago by Artur Formella

Attachment: 2223_3.patch added

comment:9 Changed 9 years ago by Artur Formella

Keywords: Review? added

comment:10 Changed 9 years ago by Wiktor Walc

Keywords: Review- added; Review? removed

Unfortunately I have found another example that still doesn't work:

[[Help:Link#Subpage feature]]

is changed into

[[Help:Link#Subpage feature#Subpage feature|Help:Link#Subpage feature]]

Changed 9 years ago by Artur Formella

Attachment: 2223_4.patch added

comment:11 Changed 9 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:12 Changed 9 years ago by Wiktor Walc

Keywords: Review- added; Review? removed

It looks like [2394] completely broken parsing tags inside of [[ ]] (!).

When using revision 2388, Images are displayed properly when switching to wikitext and back:

[[Image:Test.gif]]

when using current revision, they're changed into links.

This definitely has something to do with adding RTENOTITLE straight after [[ which changes everything into a link.

Changed 9 years ago by Artur Formella

Attachment: 2223_5.patch added

comment:13 Changed 9 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:14 Changed 9 years ago by Wiktor Walc

Keywords: Review- added; Review? removed

Looks very good. I didn't check it deeply, but when checking random articles from MediaWiki I managed to find just two more issues:

[[Official position]]s

is changed into:

[[Official position|RTENOTITLEs]]

Links to categories now are broken:

[[Category:Help]]

changes into:

[[Category:Help|RTENOTITLE]]

I haven't checked it, but it seems that this code either removes the following feature, or moves it into other place, could you explain it? It looks like it:

  • removes fix for #2075 in FCKeditorParser.body.php
  • removes fix for #2483 in FCKeditorSkin.body.php (RTECOLON)

Changed 9 years ago by Artur Formella

Attachment: 2223_5.2.patch added

comment:15 Changed 9 years ago by Artur Formella

Keywords: Review? added; Review- removed

I need to change RTECOLON to ':' before creating A tag so there is no point in doing it one more time.

makeSelfLinkObj is changed so line

$text = preg_replace("/<strong class=\"selflink\">(.*?)<\/strong>/", 
"<a href=\"".$this->mTitle->mDbkeyform."\" class=\"selflink\">$1</a>", $text);

is now useless, of course selflinks still work.

I attached a list of expressions.

Changed 9 years ago by Artur Formella

Attachment: list.txt added

comment:16 Changed 9 years ago by Wiktor Walc

Keywords: Review- added; Review? removed

Review-, FCKeditor should at least leave those links functional (below are examples of known and unkown links):

[[Main_Page#Limitations_and_workarounds]]
[[Main_Page#Limitations_and_workarounds|Limitations_and_workarounds]]
[[Main_Page#Limitations_and_workarounds|Limitations and workarounds]]
[[Main_Page#Limitations_and_workarounds|Main_Page#Limitations_and_workarounds]]
[[Main_Page#Limitations_and_workarounds|Main_Page#Limitations and workarounds]]
[[Main_Page#Limitations_and_workarounds|Limitations]]

[[Main_Pag#Limitations_and_workarounds]]
[[Main_Pag#Limitations_and_workarounds|Limitations_and_workarounds]]
[[Main_Pag#Limitations_and_workarounds|Limitations and workarounds]]
[[Main_Pag#Limitations_and_workarounds|Main_Pag#Limitations_and_workarounds]]
[[Main_Pag#Limitations_and_workarounds|Main_Pag#Limitations and workarounds]]
[[Main_Pag#Limitations_and_workarounds|Limitations]]

Another issue I found is that in makeSelfLinkObj() $args is not initialized.

Changed 9 years ago by Artur Formella

Attachment: 2223_6.patch added

comment:17 Changed 9 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:18 Changed 9 years ago by Wiktor Walc

Keywords: Review+ added; Review? removed

Ok, let's give it a try.

Please remove this code from makeBrokenLinkObj():

//[[Main page]] -> [[Main_page]]
$u = str_replace($nt->getText(), $nt->getDBkey(), $u);

(let's keep the more user friendly names for links).

comment:19 Changed 9 years ago by Wiktor Walc

Keywords: Review- added; Review+ removed

Ooops unfortunately I have to change my opinion.

[[[[wikipedia:]]]]

is changed into

[[[[:wikipedia:|http://en.wikipedia.org/wiki/]]]]

all other things seems to work fine.

Example taken from http://meta.wikimedia.org/wiki/Help:Interwiki_linking .

Changed 9 years ago by Artur Formella

Attachment: 2223_7.patch added

comment:20 Changed 9 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:21 Changed 9 years ago by Wiktor Walc

Keywords: Review+ added; Review? removed

Review+, I found at least one minor bug which has left, but it I believe this patch can be comitted already and we can fix those minor bugs in new tickets. This way it will be easier to track if we break something else while fixing those less important bugs.

comment:22 Changed 9 years ago by Artur Formella

Keywords: fixed added; Review+ removed
Resolution: fixed
Status: reopenedclosed

Fixed with [2466]

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy