FlightGear wiki talk:Instant-Refs

From FlightGear wiki
Jump to navigation Jump to search

more sources

at some point, we may also want to add support for other sources, such as:

that should cover all important sources. And it would allow us to also use the same script to help populate FlightGear Newsletter & changelogs, but also Release plan/Lessons learned. So this could be a real time-saver. --Hooray (talk) 14:40, 1 June 2014 (UTC)

Automatic update of script and old quotes

Thanks for the heads-up. Now, that makes me wonder if I can adapt the script to automatically parse existing wiki articles and update cquotes there automatically by re-opening the URL and re-running the extraction logic :) BTW: That reminds me: I was going to investigate adopting the downloadURL attribute[2] so that scripts can auto-update --Hooray (talk) 22:51, 11 June 2014 (UTC)

selection/clipboard buffer or alert() limits ?

There seems to be a minor glitch when selecting large text blobs, at some point the text gets truncated. I assume it's some browser-specific limit that is applied here, or maybe it's just the alert() dialog? To work around that, we would either need to use a different "OUTPUT" method, or maybe just use a for() loop to show multiple alert() dialogs for each part of the blob. It's not a major issue, but it's also easy to miss - still need to investigate where the real culprit is. --Hooray (talk) 14:11, 12 June 2014 (UTC)

I would argue that's a feature :D Yes, there should be an alert. I was also thinking, will it be possible to hook up the ctrl-c event and output directly to the clipboard? EDIT: no... it would be a security issue.
--Bigstones (talk) 22:02, 13 June 2014 (UTC)
right, there are several potential security issues involved here-but we can circumvent several SOP restrictions easily because using "TamperMonkey" we can directly hook into the HTML code of the document. According to SO the real issue here is probably a size restriction of the alert() message box. So we could either show multiple alerts or simply use a different output method, i.e. by showing a new form/popup, or even by directly writing to a wiki form. It's not a big issue, but I'll see what we can do about it.--Hooray (talk) 23:16, 13 June 2014 (UTC)

Issues

phpBB code snippets not displayed using syntaxhighlight

Cquote1.png What you can do for input and output properties representig periodic values (like heading) is to normalize them into a given range:
<periodic>
     <min>-180</min>
     <max>180</max>
</periodic>

will transform a value of -190 to +170 for example. But that's probably not what you asked for.


Cquote2.png

too greedy non-greedy regexes

The problem described in the previous section regarding regexes that eat up half messages seems to be related to my misunderstanding of the non-greediness. So, I managed to fix it for this one case, but this means that using .*? to match everything until you meet the following character (as I currently do pretty much everywhere) is dangerous and prone to failure. Any occurrence of that should be changed as I did in this edit and that's clearly cumbersome, not to say that it can still be incorrect: say I have

<a someprop="href" href="http://www.link.org" ... >

If I want to mach anything between a and href, I use [^(?:href)]*, but that would match only up to the text inside someprop, so I'd have to check that it's not inside doublequotes... Well, I guess this is getting too complicated for handling it the Chtulu way.

So my approach would be: fix this whenever the problem comes up, but don't overdo because we're already moving in dangerous ground. Or, rewrite it all using only xpaths *sobs*. --Bigstones (talk) 16:49, 17 June 2014 (UTC)

regex vectors

When testing things I realized that you are right: there are some scenarios where the regex may fail depending on how "complete" the selection is, because we obviously have hard-coded assumptions here. I'll see if it's feasible to also support vectors for regexes to extract the corresponding fields and try each regex in order to get a certain field, or if that doesn't make any sense... But quoting with/without author (anonymous quote) would be a valid test case here.--Hooray (talk) 16:46, 16 June 2014 (UTC)

Probably going to look into this sooner or later because this could be a simple solution to also support PM quoting - without having to parse the actual URL, we'd just try different regexes in order and use the one that succeeds. --Hooray (talk) 16:46, 16 June 2014 (UTC)

Syntaxhighlighting

Need to investigate what needs to be updated to support quoting code sections, as per [3] --Hooray (talk) 22:33, 14 June 2014 (UTC)

Postings that break our script for some reason

Misc notes

Detecting failed XPaths

you've got a point, we should probably check if xpath/regexes succeed or fail, and show a warning so that we know that the scripts needs to be updated because some xpath/regex may have changed.

Paragraphs / br (trailing slash)

There are some minor issues now, i.e. newline2br will no longer contain the trailing forward slash, so there's probably some JavaScript/regex oddity involved here, maybe slashes just need to be escaped. Will be testing the code with a few different forum postings and check the resulting cquote

Done Done. That's because newline2br wasn't used at all in html mode. I added addNewlines which puts newlines after br's and list related tags, if there are more newlines to be added that should be the place.
--Bigstones (talk) 14:03, 17 June 2014 (UTC)

support/ignore highlighted keywords/smilies

see Understanding Forward Compatibility for examples

Done Done --Bigstones (talk) 15:13, 17 June 2014 (UTC)

Chopped strings and stripped \n's: we need an alternative output

At first, the limitation of the alert dialog was only on the length of the text. Now radi reports that Firefox strips the newlines (as in \n) making the string hardly readable, and I can confirm this on Iceweasel (Debian's re-branded Firefox). It seems that the most flexible way out of this is a superimposed div. I made some experiments, however it seems that all of this could be handled easier through some library like jQuery. I think I don't even know how to include a library inside a JS script. To escape the html code to show it in the html body (like br's and others) a nice and easy solution is here.

I agree that we should explore adding alternate OUTPUT methods, probably using jQuery. I experimented with that a while ago, and adding external dependencies/scripts should be a no-brainer once we modify the document to inject additional script tags [4][5][6]. That way, we could also use HTML to create custom message boxes/dialogs, or directly modify the DOM like you suggest. So I am not opposed to using an external "library" for such purposes, because we could easily customize the whole thing - in fact, we could even present a "wizard"-like interface at some point. A few weeks ago I played with an AJAX output method to directly modify a wiki text box by inserting the modified cquote. --Hooray (talk) 15:11, 22 June 2014 (UTC)
I added a jQuery dialog output method. Right now it is not very usable. There should be the autoselection of the content, I went for a textarea but it could be anything. Importing the jQuery UI css works, but then it has relative urls to the images... Another not-really-an-issue is that selecting the text in the textarea triggers the script again (failing). However ctrl-a ctrl-c does the job of selecting and copying, I guess it gets automatically the focus. It also breaks the normal selection (you can cancel, but the selection is gone).
It needs to be enabled by setting OUTPUT = OutputMethods().jqueryDiag;
--Bigstones (talk) 14:34, 29 June 2014 (UTC)