WordPress.org

Support

Support » Plugins and Hacks » Proper markup is achieved how?

Proper markup is achieved how?

  • I’ve been tasked with creatnig a custom CMS for an intranet site. That’s the easy part. The difficult part is properly marking up the text from the database. For instance, if the text in the database is

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut fermentum est at felis. Integer sagittis leo at leo.
    ul>
    li>…../li>
    /ul>

    how does WP turn that into

    p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut fermentum est at felis. Integer sagittis leo at leo./p>
    ul>
    li>…../li>
    /ul>

    Notice that the paragraph tags have been inserted in the proper locations to ensure xhtml validity. I’ve been trying to develop an algorithm for a little while now and I’m stumped. Perhaps I’m thinking harder than I should? I assume there’s a function or collection of functions in WP that I could reference?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You’re looking for wpautop(), in functions-formatting.php (wp-includes/).

    Excellent! I appreciate the your help. I have but one issue. When running my text through that function, I’m getting a double dose of p> at the beginning of the first block of text. For instance:

    p>p>I’ve been grabbing and storing…/p>

    I can’t sort this bugger out either. As it is in the database, there is absolutely nothing before the first character of the paragraph (in this case I). This is simply too much pee. Cursory reviews of the source code reveals nothing obvious. Thoughts?

    I cannot debug what I cannot see. Post code here:

    http://paste.uni.cc

    Reply back with the url you receive.

    The code is just wpautop() unaltered. The source can be seen at http://paste.uni.cc/8463

    First, sorry for the delay.

    Second, what I was looking for was *your* code, as in how you’re trying to put wpautop() to use.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Proper markup is achieved how?’ is closed to new replies.
Skip to toolbar