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

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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