Board index FlightGear Development Documentation

My personal solution to Wiki bugs

Discussion of the FlightGear documentation, how it can be improved and coordination of people working on it.

My personal solution to Wiki bugs

Postby dot_sent » Thu Feb 01, 2018 9:45 pm

A little update on my struggle with Wiki bugs. I got annoyed enough by the fact that I couldn't complete the translation work properly, so I've hacked together a small command-line editor that utilizes Wiki API and allows me to edit any articles without hitting neither "can't edit articles with non-latin characters in the page name", nor "can't edit external links via mobile view" issues.

As I've only created this for personal use, I hardcoded my environment preferences there - I've tested it only on Linux and with vim as an editor. It's written in Perl and the source code is on Github, feel free to lurk around and modify to your taste if you feel like it: https://github.com/dot-sent/FlightGearWikiClient

Example of interactive edit session:

Code: Select all
~/FlightGearWikiClient/apps/Perl$ ./editor.pl

*** Welcome to FlightGear Wiki editor ***

Available commands: help login read edit quit

editor (not logged in) [help]> help

Available commands: help login read edit quit

Synopsis: help [command]
Print help for given command. If no command given, print this help.

editor (not logged in) [help]> login Dot_sent
Enter password (won't be displayed) >
Logging in...
Successfully logged in as Dot_sent.
editor (Dot_sent) [help]> edit Dot_sent/Test_Editor
The page 'Dot_sent/Test_Editor' does not exist. Create new page? y/n [y]> y
Enter the title of page to copy (blank for empty) >
                                                                                                 <=== vim opens here

 1  == Test page ==
 2
 3  Plain text.
 4
 5  [http://example.com External link]
~
~
"temp.wiki" 5L, 68C written
                                                                                                 <=== vim closed here
Enter summary for your edit [Edited via FlightGear Wiki editor]>
Your edit has been saved. Check it out at http://wiki.flightgear.org/Dot_sent/Test_Editor :)
editor (Dot_sent) [help]> quit
~/FlightGearWikiClient/apps/Perl$


Currently editor supports:
  • reading articles (in wiki markup)
  • logging into Wiki
  • editing existing articles
  • adding new articles (with possibility to copy source text from already existing article)

Future plans:
  • Translate some more articles to Russian, as I've spent already quite some time working on this editor
  • Write a version of the client library in JS
  • Create a Chrome/Firefox plugin to enable in-browser edit through API with some additional comfort functions (automatically copy source from English article when starting a new translation, automatically add {{BeingTranslated}} etc.)
I'd be happy to hear comments and suggestions.
Best regards,
Dot_sent
dot_sent
 
Posts: 11
Joined: Wed Jan 03, 2018 1:49 pm
Location: Netherlands
Version: 2017.3.1
OS: XUbuntu Linux

Re: My personal solution to Wiki bugs

Postby bugman » Fri Feb 02, 2018 10:01 am

This sounds awesome! I would highly recommend that you cross-post this to the FlightGear mailing list. Ideally though, we really need to work out what is causing these nasty wiki bugs and eliminate them. This is however a very difficult task.

Cheers,
Edward
bugman
Moderator
 
Posts: 1698
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: My personal solution to Wiki bugs

Postby Hooray » Fri Feb 02, 2018 6:12 pm

Create a Chrome/Firefox plugin to enable in-browser edit through API with some additional comfort functions (automatically copy source from English article when starting a new translation, automatically add {{BeingTranslated}} etc.)

I'd be happy to hear comments and suggestions.


Hi & welcome !

I am not sure if you are already aware of it or not, but there's already a JavaScript-based tool to edit the FlightGear wiki which was created over the years to aggregate community discussions, i.e. to help bootstrap new wiki articles and help maintain those articles that are no longer actively maintained.

It's a rather simple piece of code actually that grew over time - originally it was just a UserScript using Greasemonkey - more recently, it's been ported to the Web Extension framework.

I think it is worth noting that this userscript is kinda "infamous", i.e. for having the reputation of adding "spam" to the wiki - much of this came from the fact that it was originally using the cquotes template, but after a number of discussions due to excessive "quoting" on the wiki, this got changed to use <ref> only additions, that can be semi-automatically rewritten using 3rd person speech (via a simple regex engine).

It all started out rather simple actually:
Image

After a while, a handful of other contributors began using it, so that more features were added, as well as design change (using jQuery), even introducing a simple wizard:

Image

And at some later point in time, we also began using the dedicated mediawiki API to dynamically retrieve article lists and update sections selectively:
Image


Meanwhile, the whole thing is no longer using jQuery, so a number of these features are currentlly disabled/not working - but that was mainly so that this could be turned into a web extension.

And like I said previously, the addon, and its usage, has a certain reputation for being "obnoxious" - but meanwhile, a number of contributors, including a few core developers, are actively helping maintain articles that were created using this "addon".

Obviously, that's really limited to quote-based contributions (which are meanwhile obsolete, all new articles are indeed using refs only).
That being said, there's no reason why the addon (web extension) could not be extended to allow for other uses, which might even make it a little more popular, and maybe even help its reputation ;-)


Anyway, even if you should decide not to get involved in the development of this particular addon, you may still want to take a look - even if just to fork it, it all started out being in the public domain anyway, and it's already serving a purpose - even a number of long-term contributors are beginning to see the potential behind the approach, despite not necessarily always agreeing with the tempoary ""outcome":

https://sourceforge.net/p/flightgear/ma ... /36014705/
bugman wrote: It is true that articles
are often trashed by being stuffed full of inappropriate and confusing
quotes. Hooray's quote system is good for starting an article [1, 2].
But for established articles they are often placed in locations that
break the original logic of the text.



To see for yourself, take a look at: http://wiki.flightgear.org/FlightGear_wiki:Instant-Refs

Obviously, feel free to get in touch if you'd like to use any of this - we never really "published" the addon, because it's really only being used by a handful of FG contributors involved in maintaining the wiki - so we didn't want to go through the hassle of getting it signed and setting up a git repo etc - but that would obviously still be possible, and it would also not be that much work to generalize things and make it work for any mediawiki installation
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: My personal solution to Wiki bugs

Postby dot_sent » Fri Feb 02, 2018 9:57 pm

Hello Edward, Hooray,

Thank you very much for the information! I was not aware about the Instant-Refs tool - I'll definitely take a look. From the documentation it indeed looks like a good place to put the translation helper functionality in.

It's a pity that nobody has packaged it yet - I'll see how complex it is :) I'm familiar with Chrome extension publishing process, but I've never written anything for FF.

At this point I plan to do some translations first and then I'll dive into Instant-Refs source.
Best regards,
Dot_sent
dot_sent
 
Posts: 11
Joined: Wed Jan 03, 2018 1:49 pm
Location: Netherlands
Version: 2017.3.1
OS: XUbuntu Linux

Re: My personal solution to Wiki bugs

Postby Hooray » Sat Feb 03, 2018 7:48 am

It's not complex at all - it can be packaged via the web-ext tool - running that takes 2 seconds.
But for it to be published on MDN (addon network) it has to be digitally signed, which requires an account - and then the whole thing is uploaded and is validated (which is basically, a malware check)

I didn't go through the signing process, because I didn't think the extension would have to be "published" (it is rather specific to the FlightGear/mediawiki use-case right now, but the underlying structure is sufficiently generic so that other front-ends and back-ends can be added at the mere cost of editing 2 hashes).

https://wiki.mozilla.org/Add-ons/Extension_Signing
https://developer.mozilla.org/en-US/Add ... stribution
https://developer.mozilla.org/en-US/Add ... bExtension

So, it's not exactly rocket science - I guess, it would take only 15 minutes to go through the whole process.

Most of your chrome related experience will be applicable 1:1, because the web extension framework is browser-agnostic - i.e. it's the successor to FireFox XUL Addons, so that web extensions indeed also work for chrome, opera etc.

Apart from that, the extension is using a simple regex-based engine to do search/replace in order convert forum/devel list announcements to 3rd person speech - something like that could also be used to help bootstrap translations from English to Russian I suppose.

Besides, because the whole thing using JavaScript (Node.JS), we do have access to a ton of libraries, including other web APIs, but also existing translation libraries.

As a matter of fact, I once tinkered with a machine-learning based approach to "evolve" valid XPath/regex expressions to extract certain contents from postings, which would obviously also work for other languages:

http://wiki.flightgear.org/FlightGear_w ... ion_solver
Image
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11329
Joined: Tue Mar 25, 2008 8:40 am


Return to Documentation

Who is online

Users browsing this forum: No registered users and 3 guests