LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LQ Suggestions & Feedback (https://www.linuxquestions.org/questions/lq-suggestions-and-feedback-7/)
-   -   how to print an ampersand in posts and comments (https://www.linuxquestions.org/questions/lq-suggestions-and-feedback-7/how-to-print-an-ampersand-in-posts-and-comments-4175665585/)

dogpatch 12-07-2019 09:38 PM

how to print an ampersand in posts and comments
 
In this thread (2nd post), I can't answer the OPs question because i can't get an ampersand to print, either within [CODE] tags or otherwise.

I would like to print [ampersand]#10; to designate one way to represent a newline character.

If i use '&' to print an ampersand, i get '&' literally; the initial ampersand doesn't get interpreted.

If i use [ampersand]#38; to print an ampersand, it interprets the ampersand AND the following '#10;', and i get nothing but a whitespace.

petelq 12-08-2019 05:56 AM

Is this serious? Your post clearly shows 2 ampersands.

pan64 12-08-2019 05:59 AM

you need to understand how BB codes work: https://www.linuxquestions.org/quest....php?do=bbcode (not so trivial)
[noparse]&[/noparse] should work

rtmistler 12-08-2019 07:02 AM

Why does it need any bbcodes?

Perhaps we don't understand the problem?

Ampersand? That is & ?

And the problem is having it show in an LQ post?

What does happen instead?

dogpatch 12-08-2019 09:23 AM

OK, let me try pan64's advice:

Code:



I used the 'noparse' tag to print the above; that seems to work. I had been trying to use '&', or '&', which gave me unexpected results.

thanks, pan64!

rknichols 12-08-2019 10:42 AM

Quote:

Originally Posted by dogpatch (Post 6065795)
OK, let me try pan64's advice:

Code:



I used the 'noparse' tag to print the above; that seems to work. I had been trying to use '&', or '&', which gave me unexpected results.

thanks, pan64!

Actually, anything between the "&" and the "#10" will solve the problem. Here I will just make the "&" bold, and &#10 behaves just fine. So does an empty bold string there (&[B][/B]#10): &#10.

Without something to break up that sequence, parts of the editor treat that as a character code in decimal.

pan64 12-08-2019 11:03 AM

I would say OP mixed the html (or whatever) codes and BB codes. This board uses BB codes and no need to use HTML codes (or anything else).

dogpatch 12-13-2019 06:18 PM

Quote:

Originally Posted by pan64 (Post 6065827)
I would say OP mixed the html (or whatever) codes and BB codes. This board uses BB codes and no need to use HTML codes (or anything else).

Guess that explains it. What threw me off was that some ampersand tags seem to work in LQ posts. Anyway, now i know.


All times are GMT -5. The time now is 10:21 AM.