Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

When posting code...

A *lot* of people have a hard time getting source code to display correctly. It seems as though input is taken verbatim, then spat out at the browser, which means that if you want a less than or greater than sign to show up right in your message, you'll have to use the HTML things for them: > for >, etc.



It seems like it would be better to take input verbatim, then escape the HTML stuff when sending to the browser. Then you can simply type "#include <stdio.h>" and when sending the message to a browser, change the '>' and '<' characters to the HTML entities &gt; and &lt;. The problem with this, of course, is that you could no longer include HTML formatting in your messages, which a lot of people take advantage of.



An alternative idea: a "codebox" of some sort implemented with a form text area. A special tag in the message could set it off, then everything inside that tag would be "escaped" as described above, and displayed as the default text in a text area similar to the Message textbox used when posting a message.


Comments

  • Yes, I am aware of the problem and I will create a solution for this very soon.



    /WEBMASTER



    : A *lot* of people have a hard time getting source code to display correctly. It seems as though input is taken verbatim, then spat out at the browser, which means that if you want a less than or greater than sign to show up right in your message, you'll have to use the HTML things for them: > for >, etc.

    :

    : It seems like it would be better to take input verbatim, then escape the HTML stuff when sending to the browser. Then you can simply type "#include " and when sending the message to a browser, change the '>' and '<' characters to the HTML entities > and <. The problem with this, of course, is that you could no longer include HTML formatting in your messages, which a lot of people take advantage of.<br>
    :

    : An alternative idea: a "codebox" of some sort implemented with a form text area. A special tag in the message could set it off, then everything inside that tag would be "escaped" as described above, and displayed as the default text in a text area similar to the Message textbox used when posting a message.

    :






  • : Yes, I am aware of the problem and I will create a solution for this very soon.



    How soon is very soon? Your post is two weeks old, and a solution is a few hours of work. Do you need help? I would gladly volunteer my time to avoid another *frustrating* post. Even when I'm extremely careful, I still slip from time to time. Then there's no way to take it back or edit it, so you post the same thing again ("this one formatting correctly"), only to find another goof. You can proof read all you want, but once you post this forum mangles it. Simply disabling HTML is all that's needed, how hard is that? Just escape a few special characters in your done.



    Otherwise people will simply move on, and tell their friends "oh, yeah, that site coulda been cool, but the adminstration was fucked, so don't bother"




  • I've been thinking lately of a way to handle code. Instead of a "code box", let the user enclose his/her code in &lt;CODE&gt; and &lt;/CODE&gt;, but instead of outputting what's between them, *skip it* and instead output a link that, when selected, displays the code as plaintext (Content-type: text/plain, I think), thereby eliminating all the HTML tag problems while preserving the original format of the code. The text of the message could then still use HTML, same as always. Each CODE section could be tagged somehow, or have all the CODE sections saved in a separate file to go along with the message when submitted, or just create a link at the bottom of the message to display all CODE sections.



    Or some variation thereof.



    [Just sneaking in to see how things are going... haven't been here in a while.]



    (.piliq.)




  • I've been away too long. :-/



    (.piliq.)




Sign In or Register to comment.