Questions and Answers :
Web site :
BBCode -> HTML translator is doing [pre] incorrectly
Message board moderation
Author | Message |
---|---|
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
The BBCode -> HTML translator is doing <pre> incorrectly, adding an extra <br> at the end of each line. <pre>Application Progress Report deadline Status<br> This results in the post looking like the following, with the extra blank lines. Application Progress Report deadline Status ------------------ -------- -------------------- ---------------------- Astropulse v5 5.03 59% 6/20/2009 7:27:02 AM Running, high priority Astropulse v5 5.03 6% 6/20/2009 7:27:02 AM Running Is it possible to fix this? Note: The BBcode [pre] is properly translating into HTML as <pre>. Note Too: Why on Earth did they invent and use something sort of like HTML but not? Why not just use HTML??? |
Michael Roberts Send message Joined: 20 Aug 99 Posts: 2588 Credit: 791,775 RAC: 0 |
The BBCode -> HTML translator is doing <pre> incorrectly, adding an extra <br> at the end of each line. ... This is a long-standing problem which has also been irritating me -- see this post in Einstein@Home for example. Note Too: Why on Earth did they invent and use something sort of like HTML but not? Why not just use HTML??? The motivation for using bbcode is: // Functions that process user-supplied text (e.g. messages) Clearly the last aim is being misapplied in some circumstances. I am making another attempt to track this down... |
Michael Roberts Send message Joined: 20 Aug 99 Posts: 2588 Credit: 791,775 RAC: 0 |
Please see ticket 891. |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
Here is a simple solution... <style type="text/css">pre br {display:none}</style> |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
Sounds like a lot more work to re-invent most of HTML than it would be to simply excise all occurrences of <script ...> ... </script> |
OzzFan Send message Joined: 9 Apr 02 Posts: 15691 Credit: 84,761,841 RAC: 28 |
BBCode is also used on a lot of sites to prevent HTML savvy users from writing in code that they shouldn't. BBCode gives forum managers the power to control how much code to use and what not to use, whereas straight HTML does not provide those luxuries. For instance, I visit one site that only uses parts of BBcode and not others (users are not allowed to embed images, and use strikeout text). |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
No bold, no italic, no underline? My goodness, was that site paranoid or what? There is no security threat of any sort in allowing such formatting. Images are actually a bigger threat from DOS attacks on users with slow network connections, and from IP trapping. No Script |
OzzFan Send message Joined: 9 Apr 02 Posts: 15691 Credit: 84,761,841 RAC: 28 |
Bold, italic and underline were all allowed. Just no images and no strikeout text. Some network/forum administrators wish to have fine-grain control over their servers, and everyone has their own ideals on how to run a network/forum. |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
Whoot! No extra blank lines here! Thanks guys! |
Michael Roberts Send message Joined: 20 Aug 99 Posts: 2588 Credit: 791,775 RAC: 0 |
Whoot! ... Thanks guys! You're welcome! Sounds like a lot more work to re-invent most of HTML than it would be to simply excise all occurrences of <script ...> ... </script> No. The challenges of allowing an acceptable subset of user-specified html are daunting. Just for starters:
|
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
No. The challenges of allowing an acceptable subset of user-specified html are daunting.... All that you say is true, still... as you say those of us who check our posts using ( Preview ) will see the problem before the post is submitted, and even those who do not will still be able to hit ( Edit ). This applies even if the user submits HTML ( <pre> instead of ). Which reminds me, is there a way to escape the opening square bracket so that it is not interpreted? The only reason you can see the one above is because I didn't put... oops .... I just did! |
Michael Roberts Send message Joined: 20 Aug 99 Posts: 2588 Credit: 791,775 RAC: 0 |
... is there a way to escape the opening square bracket so that it is not interpreted? Not as far as I know - mostly people start with a curly brace instead {pre] or add a space [ pre]. Some bbcode implementations seem to allow escaping with '\', but not ours. You would then need to escape the combination '\[' and so on... I think the best way to do it would be define [sqb] (or whatever) as '[', since we would not be messing up the handling of any other characters. oops .... I just did! LOL. |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
What is that -> |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
How about &lsqbr;pre&rsqbr; |
Gundolf Jahn Send message Joined: 19 Sep 00 Posts: 3184 Credit: 446,358 RAC: 0 |
...Which reminds me, is there a way to escape the opening square bracket so that it is not interpreted? From http://setiathome.berkeley.edu/bbcode.php: If you don't close a tag or don't specify a parameter correctly, the raw tag itself will display instead of the formatted text. I use that to show BBCode tags without using a curly brace instead {pre] or adding a space by inserting [b][/b], which results in [pre]...[/pre]. :-) Gruß, Gundolf Computer sind nicht alles im Leben. (Kleiner Scherz) SETI@home classic workunits 3,758 SETI@home classic CPU time 66,520 hours |
Michael Roberts Send message Joined: 20 Aug 99 Posts: 2588 Credit: 791,775 RAC: 0 |
... inserting [b][/b], which results in [pre]...[/pre]. :-) Clever man! |
Michael Roberts Send message Joined: 20 Aug 99 Posts: 2588 Credit: 791,775 RAC: 0 |
What is that -> It is "Phoenix" by Sabine Betschke (copyright, used with permission.) I think of it as the closed eye of a phoenix. Apart from the fact that I just like it, the name matches my team, Phoenix Rising. |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
Cool... [[b][/b]pre]...[/pre] = [pre]...[/pre] |
Gundolf Jahn Send message Joined: 19 Sep 00 Posts: 3184 Credit: 446,358 RAC: 0 |
Cool... Wow, that are many b's in the reply window ;-) |
Steven Meyer Send message Joined: 24 Mar 08 Posts: 2333 Credit: 3,428,296 RAC: 0 |
Cool... Yep |
©2024 University of California
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.