• kashirow

    (@kashirow)


    I make a posting like this:
    <div id=”blah>
    lorem ipsum yadda yadda
    <! — more — >
    lorem ipsum yadda yadda
    </div>
    (I have to do it this way to mark the inside of the post as a text that has first line indent, which only specific posts in my blog should.) The result chops the div in two and doesn’t close it, so the page no longer validates. What’s more annoying is that it doesn’t validate with very misleading error messages. (W3C validator thinks that it’s the “content” div that isn’t closed.)
    You could say ‘don’t do that, then’, but I think this isn’t how this should work. ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • davidchait

    (@davidchait)

    can I ask why you’re embedding a div wrapper within a post? just wondering… I’ve never even considered doing something like that.
    yes, adding more or page breaks are physical content splits, so spanning markup around them is, well, dangerous. ??
    I guess in a perfect world, WP would detect and temporarily-close your blocks for you… but, hmm, somehow that seems dangerous too. Dunno.
    -d
    https://www.chait.net

    Thread Starter kashirow

    (@kashirow)

    I do this so I can do this to the autogenerated paragraphs inside that div without having to manually style or assign a class to each one:
    .indented p {
    text-indent: 3em;
    margin-top: 0.1em;
    margin-bottom: 0.1em;
    }
    The other paragraphed text should not have this indent, which is why this isn’t set globally. But blocks of such text are usually pretty big and often need the more/page splitter. Notice that the more/page splits do the same to p tags too.
    So if we want the world to be perfect, WP should temporarily close them upon display. ??

    TechGnome

    (@techgnome)

    did you consider doing it like this?
    <div id=”blah>
    lorem ipsum yadda yadda
    </div>
    <! — more — >
    <div id=”blah>
    lorem ipsum yadda yadda
    </div>
    TG

    Thread Starter kashirow

    (@kashirow)

    I could do it like this, but isn’t making the software do this instead of me the right way?…

    tcervo

    (@tcervo)

    Also, by putting <!–more–> on a new line, with a line between the previous text, it will always close your tags:
    <div id=”blah>
    lorem ipsum yadda yadda
    <p;/div>
    <! — more — >
    lorem ipsum yadda yadda

    TechGnome

    (@techgnome)

    <blocquote>I could do it like this, but isn’t making the software do this instead of me the right way?… – KAShirow

    mmmmmm…. no. Because it would add too much to it, having to check for balanced tags when they may not be there. You said it yourself that it’s only in some categories and not all.
    I suspect that it still may not validate properly. Before your content, WP will add an opening <P> tag…. inside of which is your div tag. But at each blank line,WP is going to close the P tag and open an new one. But your div tag is still open…..
    When WP encounters a more or next page mark, the para is closed.
    At least this is the way I understand it.
    TG

    Thread Starter kashirow

    (@kashirow)

    Found the best solution to make it produce standard XHTML on output yet. Function get_the_content must be altered like this:
    if (count($content)>1) {
    if ($more) {
    $output .= '\n\n'.$content[1];
    $output = balanceTags($output);
    } else {
    $output .= " $more_link_text\n\n";
    $output = balanceTags($output);
    }
    }
    The result only calls an extra round of balancing the tags when it’s necessary and produces the correct output. Notice two extra newlines without which balancetags won’t close the last paragraph.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘More on the <! — more — >’ is closed to new replies.