• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTML formatting in posts: preview vs. final

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a question about the way that JForum handles HTML in posts. We are seeing lots of extra spacing between lines in rendered messages when using basic HTML tags like

,

    and
  1. .

    It appears that when JForum renders its output, it manually inserts "
    " everywhere it sees a newline in the post text stored in the database. This means that if the message looks like this:

    Here is line one


    Here is line two


      ...

      Then the actual generated output looks like this:

      Here is line one



      Here is line two



        ...

        The resulting formatted message is then ugly because there is a lot of extra spacing before each line.

        Interestingly, this behavior doesn't occur when you preview a message - the
        tags aren't inserted in that case, and the message is formatted "correctly".

        Is there a way to tell JForum that a message is HTML, and so it should not replace every newline with a
        ? I tried modifying the CSS to reduce the spacing, but then the preview doesn't look right.

        Thanks in advance.

        [originally posted on jforum.net by lpod]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This seems to be happening in the PostCommon.preparePostForDisplay method.

This could be wrapped in a test for isHtmlEnabled but I'm not sure that is a good general solution.

This means that if you enable HTML, the only formatting allowed is HTML. So, if a user just want to add a little HTML flair to their posting, the rest of the formatting will be messed up.

Maybe this should be a site or forum specific setting.
[originally posted on jforum.net by monroe]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic