Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Nao
6901
Features / Re: New revs
« on December 11th, 2011, 11:43 PM »
rev 1189
(2 files, 18kb) (that one was pretty annoying... and I don't even get to commit it on an even number like 1190? :P)

* Moved mismatched tag fixer to preparsecode(), and added ability to either return an error message (when Wedge allows it), or fix the errors automatically. The automatic fixes are pretty solid, but it won't be able to rewrite your post if you enjoy mismatching plenty of tags in a row, forgetting openers and closers and doing strange things altogether. (Class-Editor.php, Post2.php)

* Hopefully a more solid code tag handler. If Wedge meets a code opener inside a code block, it will rewrite it to prevent further processing errors. (Class-Editor.php)

+ Wedge will now clearly indicate where the mismatch errors are located inside the post. (Class-Editor.php)

+ Added a check for posts opening a block-level tag when some non-block tags are still opened. Will attempt to fix automatically. (Class-Editor.php)

+ Wedge will also now attempt to turn block-level closers to openers if they're at the start of a new line *and* no matching opener was found before them. (Class-Editor.php)

* It will also no longer attempt to fix (or report) "errors" inside a code, html or nobbc block. (Class-Editor.php)


Note!!

The following lines require some testing: (i.e. I made last minute logic changes to them but didn't test them on my test suite)
2364: if ($found === false || !$really_found) (original had something like if (!$found || !$really_found))
2375: $text = substr_replace($text, '', $pos, strlen($full_tag)); (original had a 0 instead of the strlen...)
6902
Off-topic / Re: Doctor Who
« on December 11th, 2011, 10:17 PM »
I just saw bits of it... Probably downloaded it at the time, or something, but that was part of the couple of episodes I never really saw. (That, and the first episode of series 2. So that's two in a row.)
6903
Off-topic / Re: I couldn't sleep
« on December 11th, 2011, 10:16 PM »
Oh... even back in 1997, I didn't play it much!
The thing was that I played it from time to time, but not much, but my girlfriend of the time was addicted to Taipei, which I loathed, so I made a bet that I could do better than this in less than a week... After 4 days I had a much better clone and she switched to it. I just... didn't know *when* to stop working on it. ("A week" would have been a good suggestion.)

The only mahjongg games I played a LOT were the Shanghai family from Activision. Shanghai Dynasty, I loved these, mostly because they had the *proper* Mahjongg game as well (not the puzzle game.) The game's producer asked me if I was interested in hiring him after Activision pulled the plug on Shanghai. (That was sad.)
6904
Features / Re: Fixing mismatched BBCode
« on December 11th, 2011, 10:13 PM »
Quote from Arantor on December 11th, 2011, 09:12 PM
No, li doesn't have to authorise that. The only rule it really needs is that li must be inside a list. Then the trick is making sure where list is, which IIRC is anywhere that a block context allows it to be.
The preparsecode stuff to check for this is so fucked up, once again...

Okay, I'm... I'm... I think I'm finished with fixNestings. :sob:

It's really, really horribly complex. 200 lines of code after cleanup. It seems to work but it's so... fragile. I don't know if I should commit.

So I just need to know -- is anyone of you with read access, willing to commit some of their time to look through my new code, and try to ensure it won't break anything...?

Oh, and I just discovered that using specific footnote contents, you can break your page layout. Yay.
6905
Off-topic / Re: Doctor Who
« on December 11th, 2011, 08:50 PM »
The sad thing with the French DVDs is that they don't offer the first Christmas special on any of the box sets. It's like they didn't even know it existed, even though they included the later ones...
6906
Off-topic / Re: I couldn't sleep
« on December 11th, 2011, 08:47 PM »
I'm pretty sure I still have an archive somewhere of Kyodai Mahjongg 10.21, the last version that was built for OpenGL... Then I made the sad mistake of going Direct3D for version 11.00, and it took me several major updates to get it right. It was needed at the time (~1999) because OpenGL support was very poor on non-ATI, non-NVIDIA video cards. It wasn't the same market as nowadays.
I've always loved OpenGL more than D3D, but then looking at WebGL, I'm not sure I see much of the OGL syntax any more...

As for iOS, it's funny how you should all be talking about me making a version for it... I decided against it LONG ago, when I saw Moonlight Mahjongg on a friend's iPhone. It's pretty much KMJ for iOS, without the name and assets obviously. The guy is still working on it I believe... I bought it but I never play it. I don't play any MJ games actually...
6907
Features / Re: Fixing mismatched BBCode
« on December 11th, 2011, 08:42 PM »
I would assume that even if li > list > li is valid, it would have to be coded this way: li authorizes list and only that -- and list authorizes li and only that... That way, problem fixed. (i.e. I could rely on this setting to fix tag nesting.)

Anyway...

The current code is nearly TWO HUNDRED freaking lines long[1]. As opposed to the original dozen lines that did their job perfectly, i.e. point out any mismatched tags...
I'm not even sure it's worth committing the code. I mean, it (finally) works on my complex string, but OTOH, it's become such a beast that I'm sure we'll definitely find situations where it doesn't work very well... :-/
 1. It was about 150 lines long when I suddenly decided Wedge should be nice enough to prevent using block tags inside non-block tags. Heck... Even then, if you have something strange like an opening "s", then an opening "b", then a closing "s", it will add the closing "b" before the opening block tag of course, but then again AFTER the closing "s". Don't ask too much of me...
6908
Off-topic / Re: I couldn't sleep
« on December 11th, 2011, 08:58 AM »
Quote from Arantor on December 11th, 2011, 12:46 AM
Quote from Aaron on December 11th, 2011, 12:44 AM
Quote from Nao on December 10th, 2011, 10:44 PM
I still have plans myself for a Js game ;)
Kyodai Mahjongg, WebGL edition? ;)
Doooooo eeeeeeet :D
I'd rather start slow. And anyway. Do you see an economic model in that? :P
6909
Features / Re: Fixing mismatched BBCode
« on December 10th, 2011, 11:49 PM »
I'm trying to figure out a 'simple' way to prevent nesting 'li' tags inside others...
Does 'li' have some peculiarity in the bbcode table? I see there are things with require_parent, disallow_children and things like that, but I'm not sure I get the gist of it... li requires the list parent but doesn't disallow anything, right? Shouldn't it disallow li children..?

I didn't make much progress on fixNesting today. Only bug fixed is one that didn't allow me to precisely show where the errors were found... Now it should work fine. i.e. instead of giving you the bad tag in the list of tags, it shows you the bad tag, surrounded by the context in the message (post contents, other tags...)
6910
Off-topic / Re: I couldn't sleep
« on December 10th, 2011, 11:16 PM »
Well, that's what I'll be making sure of ;)

Of course I can't even get started on this before I'm done with Wedge 1.0... In my opinion. I know how... perfectionist I can be when it comes to any of my projects. And this would be a 'side project' and thus I'd devote time to it. Hopefully not too long but once I'm onto something... :P
6911
Off-topic / Re: I couldn't sleep
« on December 10th, 2011, 10:59 PM »
Gaps is the 'generic' name for Addiction Solitaire on Noisen ;) Took me years to find it out...
6912
Off-topic / Re: I couldn't sleep
« on December 10th, 2011, 10:44 PM »
I still have plans myself for a Js game ;)
Entirely in jQuery I think. A Gaps game using the card set I had had made for my 2006 project. Ah well!
6913
Features / Re: Fixing mismatched BBCode
« on December 10th, 2011, 06:34 PM »
I'm nearly done, and that's a feat really... Considering it took me two days to get it right...
I've only got a couple of quote tags opened at the end for no reason. There was an annoying number of bugs in my code which caused all of the problems -- most notably, I'm a bit ashamed of it, an array which I was accessing as if its first entry was $array[1]... Oops. No wonder it kept failing.

Anyway, I'm pretty disappointed overall with the 'dumbness' of the code, in that it doesn't really do much to help. It adds openers in boring places but at least it does it. Could be worse... Also, I'm still unable to get it right when it comes to block tags and inline tags. If you have, for instance, [b][s][/quote] and there's no quote opener in the post, Wedge won't even (as of now) close the b and s tags, it'll simply add an opener before the closer quote... It is definitely dumb. (It correctly closes the tags if it can find an opener quote before the b and s tags.) Problem is, I'm not even sure how best to fix this string, more precisely, where should I add the quote opener...? My guts tell me that it should be after the LAST closed block tag (if it finds any).
Oh, and don't get me started on more complicated setups of block tags being inserted inside non-block tags... I don't think I have any way to protect against these ultimately. Add to that the fact that these tags are to be inserted inside the original post, without its surrounding crap etc... And I haven't even started to consider checking whether a block closer is at the beginning of a line and immediately followed by contents -- in which case it should be turned into an opener for sure. It's so deadly... And tiring. And headache-inducing (literally.)

PS: this post needs no reply, I wrote it yesterday afternoon and forgot to post it... It's just a bonus post. I haven't worked on the feature today, as I'm very, very wary of the difficulties I know I will meet when finishing it. I'm quite tempted to just close unclosed tags when meeting a block closer and then add the block opener just before the closer... And as for non-block closers, just remove them entirely. Uh.
6914
Off-topic / Re: I couldn't sleep
« on December 10th, 2011, 05:43 PM »
Too fast for me. My best score while using Space is 13, while my best score while relying on probability (i.e. not touching anything at all) is 23, on the third, ahem, "try".

Are you working on our easter egg? :P
6915
Features / Re: Fixing mismatched BBCode
« on December 9th, 2011, 10:41 PM »
Okay, it's like there's an endless list of bugs to fix with this...
First, my code was foolishly taking care of mismatched tags INSIDE code tags. Woops...
Obviously, this had to go. Done. I'm also not fixing anything inside nobbc tags. Anything else?

Now to an interesting bug... My s tag (strike) was not closing correctly. What the hell?
Turns out -- and I only found out after a painful debugging session -- that 's' is actually considered as a block-level tag by Wedge... This isn't the case in SMF, so I'd say it's a typo by the unknown author who moved bbcodes to the database... :whistle:
Also, and this one IS in SMF, the br tag is not a block-level, while the hr tag is. It doesn't sound very logical to me... I'd tend to say they both are, though. Not that it will matter in my code anyway because it skips self-closing tags.
I'd also consider img tags to be block level... Shouldn't they?
li tags and things like that are block level, and THAT bothers me a bit... Because my code treats block level tags in a special way, and I suspect this wouldn't properly add the closer tags, and instead accumulate tags. i.e. [li]Hello[li]world[/li] would add a closer after the last closer, instead of before the last opener.

Also. I added the code to turn a closer quote into an opener if it turned out it's at the start of a line and is followed by anything but a newline. Then I figured, okay MAYBE people could actually start a new line, type in [ /quote] and then immediately after, another [/ quote] to close a nested quote. Or even [ /code] or whatever... So I added a test for '[/' after the tag. Now, I suppose there are suddenly dozens of new ways to break this... Obviously I suppose I could test 'simply' for a-z... I don't know. It's hell.
And all of that because I sometimes would have one of these closers at the start of a line when I meant to be using an opener.

Sometimes I wonder if we shouldn't just, ahem, call parse_bbc inside preparsecode, and have parse_bbc return a pseudo-BBC version instead of a html version... Would probably make things... easier. For me. Ah ah.
Well, I'm saying that but I've nearly reached the end... (And then in a weeks time I'll still be on it........... It's just a fucking pre-parser, arghhh!!)
Quote from Arantor on December 9th, 2011, 06:38 PM
This is where it gets very problematic. None of the hybrid solutions I've seen that support both WYSIWYG and bbcode do this. They always leave the bbcode alone and render it from bbcode to HTML as needed.
I don't see where it would be impossible to implement.
We just need to always have the same code for quotes for instance... I mean, the current code generator is very simple. It can easily be emulated through jQuery to actually add that code to the post.... Heck, we could even take the quote's HTML code from within the database, and put it into a JS string...! That's the logical way to do it, even...
Quote
That being said, it won't render properly in the context of WYSIWYG. WYSIWYG editors, conceptually, are voodoo, and not nice voodoo. (They all work principally the same way: take an iframe, receive all events while the 'textbox' has focus, and transmit all the events to handlers to manipulate the iframe as if it were a true RTE component.)
That, and contentEditable.
Quote
For example, more than once I've seen people shorten [Unknown]'s name to [U], and be surprised at the result. The reason for their surprise is that other systems just silently fail to render the tag at all if there isn't a safe matching closer (IIRC vBulletin does/did this)
That's... interesting.
But then again, as important Unknown is the the SMF community (it's a no-brainer), I'm prepared to have his name removed entirely from posts if people shorten it to 'u'...
Quote
There's no one right answer for this.
In our case, with my code, the missing u closer will be added.