FlightGear wiki:Instant-Refs: Difference between revisions

Jump to navigation Jump to search
Finish re-write
(Start cleanup)
(Finish re-write)
Line 1: Line 1:
The '''Instant-Cquotes''' script is a userscipt implemented in JavaScript in order to convert [http://forum.flightgear.org/ forum] or [[mailing list]] quotes into MediaWiki markup.  It is supported by Firefox, Chrome/Chromium, (probably) Opera, and others.
The '''Instant-Cquotes''' script is a userscript implemented in JavaScript in order to convert [http://forum.flightgear.org/ forum] or [[mailing list]] quotes into MediaWiki markup.  It is supported by Firefox, Chrome/Chromium, Opera, Safari.


== Background ==
== Background ==
FlightGear development is not centrally coordinated in any way - at the very best, FlightGear development is "self-coordinated" - i.e. contributors discuss ideas and make proposals to contribute in a certain fashion and then team up to implement certain features and building blocks temporarily.  
FlightGear's development is not centrally coordinated in any way at best, it is "self-coordinated," i.e., contributors discuss ideas and make proposals to contribute in a certain fashion and then team up to implement certain features and building blocks.  


Obviously, ideas and feature requests made by end-users are also appreciated. But at the end of the day, people who do the actual work have obviously more say about future development than those who merely make suggestions. And contributors tend to prioritize work on items that are prioritized/suggested by other contributors, especially those offering to get involved and help in some way, and of those having some kind of track record in the form of past contributions.
Obviously, ideas and feature requests made by end-users are also appreciated. But at the end of the day, it's the people who do the actual work that have more say about future development than those who make suggestions. Contributors tend to prioritize items that are prioritized/suggested by other contributors, especially regular contributors and/or those offering to get involved and help in some way.


But given the lack of development manpower, many good ideas tend to have a fairly long shelf life unfortunately. So that good ideas may be forgotten over time.
Unfortunately, because of the lack of development manpower, many good ideas tend to have a fairly long shelf life; there is a danger that good ideas may be forgotten over time.


This is also why it is important for other developers/contributors to know who came up with a certain idea and who originally supported/supports it, possibly months (or even years) after a discussion took place - which is why good ideas should not just be preserved, but accompanied by corresponding quotes, linking back to the original discussion, so that potential contributors can make up their own minds to determine if/how they want to get involved in some effort or not. The script that you can find below is intended to help with this (as well as allowing people to easily reuse forum/devel list announcements in wiki articles, e.g. to update the changelog, newsletter or "release plan/lessons learnt" section) - it allows people to easily copy&paste important discussions over to the wiki, without having to rewrite any text, and without having to put together proper cquotes manually. In fact, it's a matter of just a few seconds.
This is why it is important for other developers/contributors to know who came up with a certain idea and who originally supported it, possibly months (or even years) after a discussion took place.  Good ideas should not just be preserved, but accompanied by corresponding quotes, linking back to the original discussion, so that potential contributors can make up their own minds to determine if/how they want to get involved in some effort or not.  
Use this article's discussion page to get in touch (e.g. if there are any bugs/problems or features requests).
 
The Instant-Cquotes script is intended to help with this.  It also allows people to easily reuse forum or mailing list announcements in wiki articles, e.g., to update the [[Next Changelog|changelog]], [[Next newsletter|newsletter]] or the [[Release plan/Lessons learned]] page.  It does this by making it easy to copy & paste important discussions over to the wiki, without having to rewrite any text or manually put together a proper [[Template:FGCquote|Cquote]]. It doesn't take more than a few seconds.
 
If you want to suggest a new feature/improvement, or have discovered a bug, please add details to the [[#Known Limitations|Known Limitations]] or [[#Feature Requests & Ideas|Feature Requests & Ideas]].


== Example Output ==
== Example Output ==
Line 25: Line 28:
     |title=<nowiki>Re: Get objects to show up on Map/Radar</nowiki>
     |title=<nowiki>Re: Get objects to show up on Map/Radar</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |date=<nowiki>Sat Jun 14</nowiki>
     |date=Jun 14th, 2014
   }}
   }}
}}
}}


== Installation ==
== Installation ==
* Install the GreaseMonkey/[https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en TamperMonkey] extension.
* '''Firefox'''
* Install the script:
# Install [http://www.greasespot.net/ Greasemonkey].
** '''Firefox:''' Save the script as <code>instant_cquotes.user.js</code>, then drag-and-drop it into Firefox.
# Save [[#the script|the script]] below as <code>instant_cquotes.user.js</code>, then drag-and-drop it into Firefox.
* '''Chrome/Chromium''', '''Opera''', or '''Safari'''
# Install [https://tampermonkey.net/ Tampermonkey] (download links: [https://tampermonkey.net/index.php?ext=dhdg&browser=chrome Chrome/Chromium], [https://tampermonkey.net/index.php?ext=dhdg&browser=opera Opera], [https://tampermonkey.net/index.php?ext=dhdg&browser=safari Safari]).
# Navigate to "Add a new Script"
# Copy and paste [[#the script|the script]] below into the editing window.
# Click the save button (just above the {{button|Search}} button).


== Usage ==
== Usage ==
* go to some sourceforge.net mail archive URL, for example: http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5389094A.3080601%40gmail.com/#msg32400727
# Go to some [[mailing list]] archive URL, for example: http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5389094A.3080601%40gmail.com/#msg32400727  
: or to any forum message, such as: http://forum.flightgear.org/viewtopic.php?f=71&t=23299#p212558
: Or to any forum message, such as: http://forum.flightgear.org/viewtopic.php?f=71&t=23299#p212558.
* copy/mark some relevant portion of text (the script converts links, images and even youtube videos - wiki images are properly converted, too and it will try to retain basic formatting)
# Select the relevant portion of text.
* and directly get a full cquote paragraph (including author, date, thread and URL) that you can add to the wiki here using CTRL+C & CTRL-V
# When you release the mouse button, a box will appear containing the converted text.
# As the text will already be selected for you, press {{key press|Ctrl|c}} to copy it.
# Paste the text into the desired wiki page.


== Known Limitations ==
== Development ==
* <s>newline2br</s> addNewline() should also insert CR/LF for separating paragraphs in the cquote (also, the trailing slash is not added) {{done}}
{{Note|A Chrome/Chromium-specific extension that will not need Tampermonkey installed is under development.}}
* quoting code doesn't yet work properly {{Not done}}
* our regexes may fail once the HTML DOM of the source changes (e.g. phpBB/theme update), so we should better show a warning when that's the case [http://sourceforge.net/p/flightgear/mailman/message/31936560/]{{Not done}}
== Issues/limitations ==
* it may make sense to provide multiple regexes that are tried in order {{Not done}}
* Quoting code doesn't work properly yet. {{Not done}}
* The script uses a conventional JavaScript alert() box for providing the output, these dialogs are typically restricted to a max size of ~10kb-we may need to explore other/extended options  {{Not done}}
* The JavaScript <code>alert();</code> boxes used are typically restricted to a max size of about 10 kb {{clarify}}; other options should be looked at. {{Not done}}
* The script has already seen several iterations and created dozens of cquotes we're using in various places, but it might be possible to use the script to update previously created cquotes/FGCquotes automatically, instead of using the getSelection() helper, we could register a '''match''' for wiki.flightgear.org with the '''action=edit''' set, so that we can directly process all text of an edited page (using AJAX calls to open the URL in the background would make sense) {{Not done}}


== Feature Requests & Ideas ==
== Feature requests & ideas ==
* GET-encoded sid arguments should be stripped from forum URLs
* GET-encoded sid arguments should be stripped from forum URLs. {{Not done}}
* gitorious links converted to wiki markup could/should probably use the "Git link" template, e.g. see the quote at [http://wiki.flightgear.org/Canvas_ND_Framework#Design]
* Links to repositories should be converted to use wiki templates. {{Not done}}
* <s>the year is missing in the date</s> {{Fixed}} (by [http://wiki.flightgear.org/index.php?title=FlightGear_wiki:Instant-Cquotes&diff=83743&oldid=73477 this edit])
* The {{Abbr|regexes|regular expressions}} used may fail if the HTML DOM of the source changes (e.g., phpBB/theme update)
** Show a warning when that's the case. {{Not done}}
** Try multiple regexes in order. {{Not done}}
* Use the script to update previously created Cquotes automatically
** Instead of using the getSelection() helper, we could register a match for <tt>wiki.flightgear.org</tt> with <code>action=edit</code> set, so that we can directly process all text of an edited page, using AJAX calls to open the URL in the background. {{Not done}}


== The Script ==
== The Script ==

Navigation menu