Community
Participate
Working Groups
Hi, Could it be possible to provide the MediaWikiApiImageFetchingStrategy class with other image pattern than "Image" or "File" to support other mediawiki languages ? May this be an option in the mediawiki-to-eclipse-help ant task? For instance I'm using a french version, and got the following exception : "Unexpected title format: Fichier:MyImage.png" In french, "Fichier" stands for File. Regards Nicolas Guyomar
Nicolas, feel free to make a contribution here. I've attached a Mylyn context with landmarks pointing to the relevant code. You'll need to modify both @MediaWikiApiImageFetchingStrategy@ and @ImageReplacementToken@.
Created attachment 184809 [details] mylyn/context/zip
Discussion on changes at https://bugs.eclipse.org/bugs/show_bug.cgi?id=383287 might be interesting for you. Best regarsds, Carsten
An other approach to get all the images used in a page, could be to use the MediaWiki API: Example : http://wiki.eclipse.org/api.php?format=xml&action=query&prop=images&titles=DocumentationGuidelines/CrowdSourcingExample Give this back: <api> <query> <pages> <page pageid="23598" ns="0" title="DocumentationGuidelines/CrowdSourcingExample"> <images> <im ns="6" title="Image:Crowdsourcing-help-content.png"/> <im ns="6" title="Image:Crowdsourcing-toc.png"/> <im ns="6" title="Image:What-is-wikitext.png"/> </images> </page> </pages> </query> </api> The images are in <im> tags (children of <images>). This works also with a MediaWiki instance configured in french. This do not solve the parsing part (ImageReplacementToken is still english only). It will be hard to have the WikiText Library to follow all the MediaWiki namespaces possibilities (it is possible to localized and to alias them) See: https://www.mediawiki.org/wiki/Help:Namespaces#Localisation A possible approach would be to access the configuration of the MediaWiki instance: The "Image" or "File" or whatever Namespace has id=6 + its aliases. http://wiki.eclipse.org/api.php?format=xml&action=query&meta=siteinfo&siprop=namespaces|namespacealiases This is the output on a MediaWiki 1.17.0 (English): <api> <query> <namespaces> <ns id="-2" case="first-letter" canonical="Media" xml:space="preserve">Media</ns> <ns id="-1" case="first-letter" canonical="Special" xml:space="preserve">Special</ns> <ns id="0" case="first-letter" content="" xml:space="preserve"/> <ns id="1" case="first-letter" subpages="" canonical="Talk" xml:space="preserve">Talk</ns> <ns id="2" case="first-letter" subpages="" canonical="User" xml:space="preserve">User</ns> <ns id="3" case="first-letter" subpages="" canonical="User talk" xml:space="preserve">User talk</ns> <ns id="4" case="first-letter" canonical="Project" xml:space="preserve">TestMediaWiki</ns> <ns id="5" case="first-letter" subpages="" canonical="Project talk" xml:space="preserve">TestMediaWiki talk</ns> <ns id="6" case="first-letter" canonical="File" xml:space="preserve">File</ns> <ns id="7" case="first-letter" subpages="" canonical="File talk" xml:space="preserve">File talk</ns> <ns id="8" case="first-letter" subpages="" canonical="MediaWiki" xml:space="preserve">MediaWiki</ns> <ns id="9" case="first-letter" subpages="" canonical="MediaWiki talk" xml:space="preserve">MediaWiki talk</ns> <ns id="10" case="first-letter" canonical="Template" xml:space="preserve">Template</ns> <ns id="11" case="first-letter" subpages="" canonical="Template talk" xml:space="preserve">Template talk</ns> <ns id="12" case="first-letter" canonical="Help" xml:space="preserve">Help</ns> <ns id="13" case="first-letter" subpages="" canonical="Help talk" xml:space="preserve">Help talk</ns> <ns id="14" case="first-letter" canonical="Category" xml:space="preserve">Category</ns> <ns id="15" case="first-letter" subpages="" canonical="Category talk" xml:space="preserve">Category talk</ns> </namespaces> <namespacealiases> <ns id="6" xml:space="preserve">Image</ns> <ns id="7" xml:space="preserve">Image talk</ns> </namespacealiases> </query> </api>
Thanks for the MediaWiki configuration API pointer, that looks very useful. A good place to start would be to take a look at subclassing @org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguageConfiguration@ which is intended to be used for this type of configuration.
As suggested by David Green in comment #5, I have pushed a patch that add a @MediaWikiLanguageConfiguration@: https://git.eclipse.org/r/8378 Feel free to give feedback. To my mind this patch can be contributed without having the mediawiki-to-eclipse help using it. We can discuss (here a in a new bug) how the mediawiki-to-eclipse should set the local mediawiki configuration. I think the best way is to parse the API file (with simple XPath queries).
Closed as part of backlog clean-up. Please re-open if you'd like to see this revisited, perhaps with a contribution.
The problem still exists. Please reopen
reopening per comment #8
Mylyn has been restructured, and our issue tracking has moved to GitHub [1]. We are closing ~14K Bugzilla issues to give the new team a fresh start. If you feel that this issue is still relevant, please create a new one on GitHub. [1] https://github.com/orgs/eclipse-mylyn