Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: oOo--STAR--oOo on March 23rd, 2012, 08:37 PM

Title: Smart Tag Closer
Post by: oOo--STAR--oOo on March 23rd, 2012, 08:37 PM
Hi I was testing out the smart tag closer and its not just closing tags, its adding new ones as well.

Example
Code: [Select]
[b]Hey[/b]



[b]

All I typed then was
Code: [Select]
[b]hey
then hit shift and enter
It produced another opening tag a few lines down.

I love the auto post save feature, this is most definitely needed.
Title: Re: Smart Tag Closer
Post by: Nao on March 23rd, 2012, 09:51 PM
It isn't creating anything.

Here's the logic behind the smart tag closer: if you press shift+enter, which is a conscious choice, you're telling Wedge you want to create a new line where all open tags are closed.
So it'll go through the post, see the open "b", close it, and reopen it after that.
It's exactly as desired...
It doesn't work 'only' for quotes, it works for any kind of tag. It's just *most* useful for quotes ;)
Title: Re: Smart Tag Closer
Post by: oOo--STAR--oOo on March 24th, 2012, 05:06 PM
Quote from Nao on March 23rd, 2012, 09:51 PM
It isn't creating anything.

Here's the logic behind the smart tag closer: if you press shift+enter, which is a conscious choice, you're telling Wedge you want to create a new line where all open tags are closed.
So it'll go through the post, see the open "b", close it, and reopen it after that.
It's exactly as desired...
It doesn't work 'only' for quotes, it works for any kind of tag. It's just *most* useful for quotes ;)
Thanks for the explanation.
I thought it was just to close all tags in the post.
Wouldn't that be better?
Title: Re: Smart Tag Closer
Post by: Nao on March 24th, 2012, 05:26 PM
In case you don't know, Wedge and even SMF have always done that automatically at post time... ;)
Title: Re: Smart Tag Closer
Post by: Arantor on March 24th, 2012, 06:35 PM
Not at post time, no. It's actually done at parse time for most tags, with only massive-layout-breaking ones done at preparse.
Posted: March 24th, 2012, 06:17 PM

Also, just noticed it gets confused if you happen to have a quote with something like $_REQUEST['start'] in it as it tries to make a closing [/'start'] tag, but ['start'] should be overridden somewhere in parsing to prevent it being considered for parsing.
Title: Re: Smart Tag Closer
Post by: Nao on March 24th, 2012, 06:42 PM
Quote from Arantor on March 24th, 2012, 06:35 PM
Not at post time, no. It's actually done at parse time for most tags, with only massive-layout-breaking ones done at preparse.
Argh... I see no good reason to do this at parse time. Saving space? Meh...
Quote
Also, just noticed it gets confused if you happen to have a quote with something like $_REQUEST['start'] in it as it tries to make a closing [/'start'] tag, but ['start'] should be overridden somewhere in parsing to prevent it being considered for parsing.
Gah...
I remember hearing about issues with the splitter. I think I fixed them, though. From what you're telling me, it would be simpler to just ensure that the tag is only a series of alphabetical characters...

Code: [Select]
else if (log_tags && !in_array(baretag, closed_tags) && /[^a-zA-Z]/.exec(baretag) != null)

I added the last part after the &&. Do you think that would be enough?
Title: Re: Smart Tag Closer
Post by: Arantor on March 24th, 2012, 10:32 PM
I suppose it should be done at post time now, especially given that the post is validated for tag matches.

I'd personally allow for a-zA-Z0-9, but simple alphabetic would be safe enough.
Title: Re: Smart Tag Closer
Post by: Nao on March 24th, 2012, 11:01 PM
Post Time...? I don't see how...
Title: Re: Smart Tag Closer
Post by: Arantor on March 24th, 2012, 11:30 PM
You rewrote it, remember, so it validates that tag matches are correct?
Title: Re: Smart Tag Closer
Post by: Nao on March 24th, 2012, 11:57 PM
I do remember. Worked hard on that one. Feels like every month I find myself a new Herculean task to accomplish ;)
I didn't get what you meant though. Now I do. You were talking about the fact that it was parse_BBC that did the matching.
Title: Re: Smart Tag Closer
Post by: Arantor on March 25th, 2012, 01:03 AM
It is still done in parse_bbc as well last I remember, on the assumption that tags may be mismatched, especially code or quote tags.

But we can mostly assume tags are closed on Wedge created content (but not for imported content)
Title: Re: Smart Tag Closer
Post by: Nao on March 25th, 2012, 03:12 AM
Hmm. Wed have to apply it to all earlier posts through a maintenance task or something.
Title: Re: Smart Tag Closer
Post by: oOo--STAR--oOo on April 1st, 2012, 10:37 PM
Quote from Nao on March 24th, 2012, 05:26 PM
In case you don't know, Wedge and even SMF have always done that automatically at post time... ;)
O yeah, I just remembered that XD


I suppose your method would be great for things like tables and lists as you can open and close new ones fast.
Rather than having to type in [li] all the time

I just noticed its not working now :S
Title: Re: Smart Tag Closer
Post by: Arantor on April 1st, 2012, 10:47 PM
Define 'not working'.

The smart tag closer kicks in when you're *in the middle of tags* and press shift-enter. If you're not in the middle of any tags, it won't close anything. It's mostly for splitting quote tags up, nothing more.
Title: Re: Smart Tag Closer
Post by: live627 on April 1st, 2012, 11:03 PM
Not working,as in, not closing tags like it should using the special key combination? Such is the case on my end...
Title: Re: Smart Tag Closer
Post by: Arantor on April 1st, 2012, 11:21 PM
Browser? Works on other browsers?
Title: Re: Smart Tag Closer
Post by: oOo--STAR--oOo on April 1st, 2012, 11:29 PM
Hold up.

Sorry I am using google chrome, maybe you have made some changes that require me to clear cache unless your using ?blah on the end of the links to your scripts/css

I tried to repeat it with [b]hello
Its not doing what it used to before.

As in closing the tag and opening a new one :S

Sorry about the not working statement.. Kinda dumb.
Title: Re: Smart Tag Closer
Post by: Arantor on April 1st, 2012, 11:48 PM
Please re-read the second post in this thread. It isn't designed to close that tag. It's designed to be used when you're *already inside a tag* to end it and start another one.

Like when you've quoted a post, you press-shift enter in the middle of it to close the existing tag, create a new opening tag after where you were, so you can reply to it in parts.

That said, it isn't working right now, though I figured that was due to my laptop having an odd keyboard.

Clearing the cache won't get you anywhere because the files are automatically compressed and they're given a new filename each time that's done so it shouldn't be caching anything because it's a physically different filename.
Title: Re: Smart Tag Closer
Post by: oOo--STAR--oOo on April 2nd, 2012, 12:03 AM
Alright, no problem man.. I understood the 2nd post.

Also you may already know / use this but have you looked at google developers?

https://developers.google.com/pagespeed/#url=wedge.org&mobile=false

I see you have got almost everything covered here XD compared to mine anyway LOL.

Helps a lot when designing, a night mare on something already fully running and full of manual rubbish lol.
Title: Re: Smart Tag Closer
Post by: Nao on April 2nd, 2012, 11:49 AM
Quote from oOo--STAR--oOo on April 2nd, 2012, 12:03 AM
Also you may already know / use this but have you looked at google developers?
   
   https://developers.google.com/pagespeed/#url=wedge.org&mobile=false
Of course, it's my second home... At least it used to be, ah ah.
Well, some of their remaining hints are things I can't deal with, such as compressing another item by 200 bytes... They're nice but I can't. What they're actually suggesting, is removing the copyright comments and recompressing it.
Or that hint about no longer executing jQuery... :) That only costs us a point at worst though, and saves us another 10 or 20 just by reducing the overall size of the whole page.
Title: Re: Smart Tag Closer
Post by: Nao on April 4th, 2012, 11:05 AM
Oh, a fixed bug... Gone to archived now, gone.