Last modified: 2006-09-27 18:27:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T9059, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7059 - Add {{hashencode:}}
Add {{hashencode:}}
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-18 14:28 UTC by Danny B.
Modified: 2006-09-27 18:27 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Danny B. 2006-08-18 14:28:36 UTC
While need to link to other wikimedia projects using querystring (?) and section
(#) there's need to encode the section name properly.

{{urlencode:}} as well as {{fullurl:}} as well as automatical url encoding in
browswer's address bar replaces "á" with "%C3%A1" but the element id in xhtml
source is ".C3.A1"

Therefore {{hashencode:}} (or choose another name you want) would do just regexp
substitution % -> . in {{urlencode:}}d string

Example:
[{{localurl:Commons:{{{1}}}}}?uselang=cs{{#if:
{{{section|}}}|#{{hashencode:{{{section}}}}}}} {{{2}}}]
would be able to point to such section on commons page and set the proper language.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-08-30 01:17:57 UTC
Trivial, of course:
	static function anchorencode( $parser, $s = '' ) {
		return str_replace('%','.',urlencode( $s ));
	}
Comment 2 Rob Church 2006-08-30 07:52:44 UTC
Added "anchorencode" colon function in SVN trunk, r16279.
Comment 3 Danny B. 2006-09-26 18:22:19 UTC
Reopening - it needs one more replace ("+" → "_"):

static function anchorencode( $parser, $s = '' ) {
return str_replace('%','.',str_replace('+','_',urlencode( $s )));
}

Comment 4 Jimmy Collins 2006-09-27 18:27:08 UTC
(In reply to comment #3)
> Reopening - it needs one more replace ("+" → "_"):

Done in r16675.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links