GNOME Bugzilla – Bug 635381
Syntax highlighting for MediaWiki
Last modified: 2013-05-28 21:09:52 UTC
Add syntax highlighting for Wiki such as MediaWiki. '''Bold''' text, ''italic'' text, '''''bold and italic''''' text And [[internally linked]] text. And [http://www.gnome.org/ GNOME] external links. == Header == * Bulleted list entry 1 * Bulleted list entry 2 * Bulleted list entry 3 == Subheader == # Numbered list entry 1 # Numbered list entry 2 # Numbered list entry 3
== Header == === Subheader === ==== Subheader ==== ===== Subheader ===== ====== Subheader ====== {{template}}
Oh, just saw that this exists. But I don't have it on my computer running gedit 2.30.3. http://www.jpfleury.net/logiciels/gedit-mediawiki.php
Dunno, is this generic enough to be included? Is there some standard for wiki pages?
Creole is an attempt at a standard for writing wiki pages. http://en.wikipedia.org/wiki/Creole_%28markup%29
There's already an existing gtksourceview plugin which works great: http://www.jpfleury.net/logiciels/gedit-mediawiki.php I'd certainly like for it to be integrated. Chris
(In reply to comment #5) > There's already an existing gtksourceview plugin which works great: > > http://www.jpfleury.net/logiciels/gedit-mediawiki.php > > I'd certainly like for it to be integrated. > > Chris Hi Chris, that lang file uses the GPL licence. Currently the project can only use code under LGPL (see bug #159134). Could you contact the author of the file to know if he's willing to do it? Carnë
I've mailed Jean-Philippe Fleury (the author of the code in question) with a link to this bug and an inquiry as to whether he'd be prepared to re-licence. Chris
I'm the author of this lang file. I've changed license from GPL to LGPL. New files are on my website.
There's another plugin which supports Dokuwiki syntax https://github.com/zealot128/Gedit-Dokuwiki-Syntax. Wish it could be included.
Another lang file for Moinmoin markup: http://moinmo.in/GeditHighlighting, it works pretty well, suitable for editing Google Code wiki pages.
Created attachment 226078 [details] [review] Patch adding support for mediawiki syntax highlighting
After looking in a lot of places (the documentation is really scattered!) I managed to figure out how to prepare a patch. For future reference, here are the relevant links: - http://git.gnome.org/browse/gtksourceview/ (.lang files at tree/data/language-specs) - https://live.gnome.org/GnomeLove/SubmittingPatches - http://git.gnome.org/browse/gtksourceview/tree/HACKING I just attached the patch to this bug. I'll see if I can get someone at IRC (http://client02.chat.mibbit.com/?server=irc.gnome.org&channel=%23gedit) to take a look :)
Created attachment 226082 [details] [review] Patch adding support for mediawiki syntax highlighting Fix indentation to use 2 spaces rather than tabs, and add the file to data/language-specs/Makefile.am and po/POTFILES.in. Thanks pbor @IRC for the hints.
Created attachment 226083 [details] [review] Patch adding support for mediawiki syntax highlighting Oops! I had accidentally added the patch file itself into the patch! Should be ok now.
Sorry all for the spam: I'm just adding a couple more links to complement the ones at comment #12, in case anyone in the future use this thread as a starting point to create and/or propose the addition of other language files: - http://developer.gnome.org/gtksourceview/stable/lang-reference.html (Language Definition v2.0 Reference) - http://developer.gnome.org/gtksourceview/stable/lang-tutorial.html (Language Definition v2.0 Tutorial) - https://live.gnome.org/GtkSourceView/LanguageDefinitions (list of plugins for other languages)
Review of attachment 226083 [details] [review]: The patch looks good although see the comments inline. ::: data/language-specs/mediawiki.lang @@ +4,3 @@ +Copyright © Jean-Philippe Fleury, 2009, 2011-2012. + +Ce programme est un logiciel libre; vous pouvez le redistribuer ou Hey, please put the copyright in english @@ +20,3 @@ +--> +<language id="mediawiki" _name="MediaWiki" version="2.0" _section="Others"> + <metadata> 2 spaces indentation is a must. @@ +26,3 @@ + + <styles> + <style id="emphase-forte" _name="Emphase forte" map-to="def:statement"/> organize this a bit by putting the name in one column and the mapping in another
Created attachment 226311 [details] [review] Patch adding support for mediawiki syntax highlighting For some reason my previous conversion from tabs to spaces didn't take effect (I might have forgotten to add the file before amending the commit). Double-checked this time, should be ok. Remaining suggestions implemented: Copyright info now in English, as well as the element IDs and so on; style names and mappings now aligned in columns for easier inspection. Also, changed language section from "Others" to "Markup".
Review of attachment 226311 [details] [review]: patch looks good to me. Let's commit after branching.
Hm.... I can't find anything wrong with the .lang file, but copying it to /usr/share/gtksourceview-3.0/language-specs/ makes it show up on the list of languages to pick, but nothing happens when it's selected. The original file from http://www.jpfleury.net/en/software/gedit-mediawiki.php does work, though... What am I overlooking?
Here's a diff: http://diffchecker.com/pOA0C589
Everything is fine with it. We just can't commit it right now. We have to wait until we branch gtksourceview which will be probably this week.
Created attachment 226312 [details] [review] Patch adding support for mediawiki syntax highlighting Ugh. Translation of identifiers wasn't complete in previous version, which broke the file. This time I verified that it works on my gedit installation before submitting. Sorry for the noise. It's late/early, I should go to bed.
Can this be merged now?
Review of attachment 226312 [details] [review]: pushed
Pushed after solving merging issues. See: https://git.gnome.org/browse/gtksourceview/commit/?id=db965e3ac704c574d04023606d4b7afc4ec133ad This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.