After tackling down the issue I sadly have to confirm that some cosmetic beautiless html is printed out by Clean markup for panels, but actually caused by some simple and small Drupal core errors and issues known from Drupal core. These small findings are sitting in the panels-clean_element-pane.tpl.php:

  1. Folding code in mixed php html files can cause unwanted line breaks in the final html output. Especially in if-condition scenarios which render temporary false but the line break from code persist. And these can badly multiply under certain conditions.
    • ++ changing panels-clean_element-pane.tpl.php to single-line if-loops helps a lot.
  2. We also have an unneeded white space written before <?php print $id; ?> statement in panels-clean_element-pane.tpl.php code here in line 29:
    <?php if ($pane_wrapper): ?><<?php print $pane_wrapper_tag; ?><?php print $additional_attributes; ?> class="<?php print $classes . $clean_markup_classes; ?>" <?php print $id; ?>><?php endif; ?>
    

    ... causing an html closing bracket with white space before in final html output if no id is given, since core already prints a space for such circumstances, if needed. This is breaking HTML validity since after final attribute-quotes the final closing bracket has to come appearently, not after another space. This is only wanted for xhtml elements ending with .../>

    • ++ putting <?php print $id; ?> directly after the closing quote of last attribute-prints in panels-clean_element-pane.tpl.php removes the white space before last html element closing tag bracket.

... small patch is on the way ...

Comments

dqd’s picture

Issue summary: View changes
dqd’s picture

Issue summary: View changes
dqd’s picture

Issue summary: View changes
dqd’s picture

Title: Some small tpl render issues caused by code folding and print $id » Minor tpl render issues caused by code folding and white-space
Status: Active » Needs review
StatusFileSize
new3.24 KB

To clarify a bit more: the problem and motivation behind this small issue is that if you don't fully use all features of Clean markup like "inner div" you will have empty lines. Or if you would like to use Clean markups options to change default html element wrapping to put fields into lists or into h2 tags, the empty lines and line breaks and white spaces become unreadable in html source code since h2 content never gets placed in the middle of 2 or more empty lines usually before the next h2 closing tag occurs. Since most tpl files deal with conditions only, this happens rarely. But Clean markup has to deal with tag variables. Nesting those in a tpl file the usual way (indents, tabs and code line breaks), can create unwanted effects in html output. That's why we have to use the more unreadable tpl file (no indent, less code line breaks) to have a more readable and cleaner html output (priority).

Before.

.
.
<h2 class="panel-pane pane-token pane-node-title title" >
.
"                    My node title . . . . . . . . . . . . . . "
.
                       </h2>
.
.

(watch the empty space before closing tag! Caused by leaving id input field empty in Clean markup settings.

After ...

<h2 class="panel-pane pane-token pane-node-title title">
My node title
</h2>

which removes all the white space and double line breaks but keeps the single line breaks between opening and closing tags, which is a compromise between the usual look of container tags and text tags. Even if h2 would look nicer inline we have to keep it in the flow of cases like div or ul containers and such ... That's why I kept the single line breaks between the tags.

dqd’s picture

Issue still persist in v 2.6 and 2.7.

mparker17’s picture

Status: Needs review » Closed (won't fix)

Looking over this issue again, I think there's some misunderstanding over the purpose of this module.

Clean Markup is designed to control, reduce, or ideally, eliminate the excessive amount of HTML <div> elements in Drupal 7 core's block and panels markup, not duplicate the efforts of the HTML Tidy module.

I also worry that the patch in #4 will make the module harder to maintain, because it's difficult to see where the different parts of the template file begin and end.

Thus, I'm marking this as "Won't fix". Sorry for the delay, and thank you for your interest and understanding!