<html xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="en"
      lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="producepublish">

    <metal:fill fill-slot="main" tal:define="result view/debugLevels">
        <h1 i18n:translate="label_debug_document_structure">Document structure</h1>
        <div class="formHelp" i18n:translate="help_document_structure">
            This report allows you to check the hierarchical structure of the
            aggregated content.  Problems like H3 tag following directly a H1
            tag are reported in red color.  <br/> In general: A H2 tag must
            have a H1 as parent, a H3 tag must have a H2 tag as parent an so
            on.
        </div>
        <table class="listing" id="debug-levels">
            <thead>
                <tr>
                    <th i18n:translate="label_document" width="350px">Document</th>
                    <th i18n:translate="label_structure">Structure</th>
                </tr>
            </thead>
            <tbody>
                <tal:loop repeat="d result">
                    <tr tal:attributes="class python: repeat['d'].even() and 'even' or 'odd'">
                        <td>
                            <span class="title">
                            <a tal:attributes="href d/url"
                                    tal:content="string:${d/title} (${d/id})" 
                            />
                            <div class="formHelp" tal:content="d/description" />
                        </td>
                        <td>
                            <tal:loop repeat="row d/heading">
                                <div tal:attributes="class string:level-${row/level}">
                                    <span tal:attributes="class python: row['error'] and 'structural-error' or 'structure-ok'"
                                          tal:content="string: H${row/level}: ${row/text}" 
                                    />
                                </div>
                            </tal:loop>
                        </td>
                    </tr>
                </tal:loop>
            </tbody>
        </table>
        <a tal:attributes="href context/absolute_url" i18n:translate="label_back_to_conversion">Back to conversion folder</a>
    </metal:fill>
</html>
