Last modified: 2013-02-28 05:01:34 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 T22657, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20657 - make get_language_name_from_extension() accessible to other extensions
make get_language_name_from_extension() accessible to other extensions
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: upstream
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-16 01:15 UTC by Lee Worden
Modified: 2013-02-28 05:01 UTC (History)
1 user (show)

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


Attachments

Description Lee Worden 2009-09-16 01:15:17 UTC
I am writing an extension that creates <source> tags and invokes SyntaxHighlight_GeSHi to highlight source code for various filenames with a range of file types.  It needs to call the GeSHi::get_language_name_from_extension() function in order to create a source tag with the correct "lang" attribute given a filename.  Currently I have to do some gyration, first calling SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi() as a roundabout way to ensure that geshi/geshi.php is loaded in, then creating a GeSHi object to provide the member function.  The php file is probably in $IP/extensions/SyntaxHighlight_GeSHi, it's true, but there's nothing requiring it to be located there.

This function could be static, and if either it were moved to the SyntaxHighlight_GeSHi class, or a SyntaxHighlight_GeSHi class function were provided that calls it, it would allow me and others to get the job done without relying on undocumented implementation details.  Or failing that, it would be helpful to add the GeSHi class to $wgAutoloadClasses.
Comment 1 Bugmeister Bot 2011-08-19 19:12:42 UTC
Unassigning default assignments. http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/54734
Comment 2 mIRROR 2013-02-28 03:42:32 UTC
Bump.
Comment 3 Sam Reed (reedy) 2013-02-28 04:56:37 UTC
Why not just include it in your own code?

Are you actually using anything from the SyntaxHighlight_GeSHi class?

As you can only have one thing handling one tag, having this loaded in aswell would be useless.

What's the point of moving it to the SyntaxHighlight_GeSHi class? It will still exist in the source. In the same idea, you could "move" (well, copy) it to your own code..

And to top all that off, get_language_name_from_extension isn't even static (when it should probably be), so you're instantiating an instance of the class and anything else it loads in, for these 90 lines of code.


You should probably just use SyntaxHighlight_GeSHi::prepare( 'foo', 'ext')->get_language_name_from_extension( 'ext' )
Comment 4 Sam Reed (reedy) 2013-02-28 05:01:34 UTC
Though, I'm not sure why you didn't make this request upstream.

https://sourceforge.net/p/geshi/code/2573/

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


Navigation
Links