Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ Forum ➜ Problems ➜ Backslashes

Backslashes

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Worstje   Netherlands  (899 posts)  Bio
Date Tue 27 Jul 2010 10:26 AM (UTC)
Message
When Forum Codes are checked in a post, the forum decides to eat one 'layer' of backslashes out of the post when reading it, no matter whether it is inside a tag or not. In the edit screen however everything will appear allright.

This is something I have never seen in any other forum, nor do I see any reason in the Forum Codes or Templates to explain that kind of behaviour in turn for a feature of sorts.

It makes posting code examples very confusing, and in my opinion should be removed.

Examples (this post has forum codes turned OFF):

One backslash: \
Two backslashes: \\
Three backslashes: \\\
Four backslashes: \\\\
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Tue 27 Jul 2010 10:26 AM (UTC)

Amended on Tue 27 Jul 2010 10:30 AM (UTC) by Worstje

Message
Examples (this post has forum codes turned ON):

One backslash: \
Two backslashes: \
Three backslashes: \\
Four backslashes: \\


For examples of the confusion the above can cause, see: http://www.gammon.com.au/forum/?id=10451&page=999#62400
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 27 Jul 2010 09:27 PM (UTC)
Message
As I explained in that post, since forum codes use square brackets, we must have a way of putting the forum codes literally in, eg.


Please use the [code] tag.


To do that I had to post:


Please use the \[code\] tag.


And since we are using backslashes in order to display square brackets, we must have a way of displaying backslashes themselves. So, we have to put two backslashes in the forum posts, if forum codes are turned on, for every one we want to see.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #3 on Wed 28 Jul 2010 03:17 AM (UTC)

Amended on Wed 28 Jul 2010 03:19 AM (UTC) by Worstje

Message
Right. I guess that explains the why. I still can't say I'm convinced about the logic though.

I write most snippets impromptu in my browser. Half the time I won't even have access to MUSHclient, or go through the entire motion for testing since I just want to help people along and get started.

Newer or less frequent users won't understand why their posts miss the backslashes either. It only adds to the confusion.

I would ask myself this: what will a person do more often? Discuss how to use forum codes, or write regular expressions in their posts? And regarding the [code] tag - you added a very useful template for that exact statement: [codetag].

Template:codetag To make your code more readable please use [code] tags as described here.


At most, you've given people a good reason not to use the [code] tag. :)
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #4 on Wed 28 Jul 2010 03:26 AM (UTC)
Message
Quickie solution: add a "Convert forum codes" button to the post form that runs some Javascript to convert the current contents of the input box. This would be the best balance of easy and user-friendly, IMHO. Or you could just make the button post to the server and have the server fix up the output before rendering the page again with the fixed content in the input box.

(Honestly, the forum is a better place than MUSHclient to put such a feature anyways.)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 28 Jul 2010 04:12 AM (UTC)

Amended on Wed 28 Jul 2010 05:06 AM (UTC) by Nick Gammon

Message
Worstje said:

At most, you've given people a good reason not to use the [code] tag. :)


It's not just the [code] tag, it's any tags. And if your code happens to have [i] in it (as in: a = b [i] ) then that switches forum codes on, and it will turn the rest of the post into italics.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #6 on Wed 28 Jul 2010 05:36 AM (UTC)
Message
The obvious solution is to have your webhost provide luacgi, and do the forum tags and escaping in LPEG... ;)
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #7 on Wed 28 Jul 2010 05:39 AM (UTC)
Message
Ah I was hoping LPEG could be worked into this somehow. ;)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


28,499 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.