oOo--STAR--oOo

  • @Arantor Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time
  • Posts: 43
Smart Tag Closer
« 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.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Smart Tag Closer
« Reply #1, 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 ;)

oOo--STAR--oOo

  • @Arantor Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time
  • Posts: 43
Re: Smart Tag Closer
« Reply #2, 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?

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Smart Tag Closer
« Reply #3, 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... ;)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Smart Tag Closer
« Reply #4, 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.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Smart Tag Closer
« Reply #5, 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?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Smart Tag Closer
« Reply #6, 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.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Smart Tag Closer
« Reply #7, on March 24th, 2012, 11:01 PM »
Post Time...? I don't see how...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Smart Tag Closer
« Reply #8, on March 24th, 2012, 11:30 PM »
You rewrote it, remember, so it validates that tag matches are correct?

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Smart Tag Closer
« Reply #9, 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.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Smart Tag Closer
« Reply #10, 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)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Smart Tag Closer
« Reply #11, on March 25th, 2012, 03:12 AM »
Hmm. Wed have to apply it to all earlier posts through a maintenance task or something.

oOo--STAR--oOo

  • @Arantor Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time
  • Posts: 43
Re: Smart Tag Closer
« Reply #12, 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

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Smart Tag Closer
« Reply #13, 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.

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Smart Tag Closer
« Reply #14, 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...
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.