HTML output not well-formed in case of nested <ul> lists

Please post all questions on Help+Manual 8 here

Moderators: Alexander Halser, Tim Green

Post Reply
michal_novomesky
Posts: 62
Joined: Thu Jan 12, 2012 2:21 pm
Contact:

HTML output not well-formed in case of nested <ul> lists

Unread post by michal_novomesky »

Preconditions:
[*] Disable the checkbox: Webhelp > HTML export Options > Export Lists as text (recommended)
[*] Having list in list in Topic content

Topic content source code:

Code: Select all

    <para styleclass="Normal">We need to collect or have access to following information:</para>
    <list id="0" type="ul" listtype="bullet" formatstring="&#183;" format-charset="SYMBOL_CHARSET" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:Symbol; font-size:11pt; color:#3a3a3a;">
      <li styleclass="Normal">Your full name, country, valid email address and your login credentials are required for registration and use of the Account, for provision of Services and for establishment, exercise and defense of our legal claims. Moreover, we will obtain some basic technical information about a device and application You use to log into your Account.</li>
    </list>
    <list id="1" type="ul" listtype="bullet" formatstring="&#45;" format-charset="EASTEUROPE_CHARSET" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:Calibri; font-size:11pt; color:#3a3a3a;">
      <list id="1" level="1" type="ul" listtype="bullet" formatstring="&#111;" format-charset="EASTEUROPE_CHARSET" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:&apos;Courier New&apos;; font-size:11pt; color:#3a3a3a;">
        <li styleclass="Normal">Browser fingerprint to detect suspicious attempts to log in.</li>
        <li styleclass="Normal">You may choose to use third-party authentication provided by Apple or Google to register and/or sign to your Account. In such case, We will process your email address (provided to us by such third party) and country of your location during the registration process and for other purposes specified above.</li>
      </list>
    </list>
The HTML output for the topic is not XML well-formed. Redundant </li>, see the attached screenshot.

I can provide a zipped folder where the issue is replicated by email or private message.
You do not have the required permissions to view the files attached to this post.
User avatar
Tim Green
Site Admin
Posts: 7819
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: HTML output not well-formed in case of nested <ul> lists

Unread post by Tim Green »

Hi Michal,

I can reproduce this directly with your example. We'll look into it right away. Note that this is almost just cosmetic, however. No browsers are going to trip up on this redundant closing </li> tag. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
Posts: 7819
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: HTML output not well-formed in case of nested <ul> lists

Unread post by Tim Green »

Hi Michal,

This is actually more complicated than it looks at first glance. It is happening because what you are creating in your code is two separate lists, and you are starting the second list at level 2 instead of the top level. The "additional" </li> is actually not additional at all, the problem here is the missing additional opening <li>, which is needed because you cannot nest two <ul> lists directly without a <li> to hold the second list. However, if Help+Manual did that in the case of a list starting at level 2, as in this case, you would get a spurious empty paragraph/space between the two lists.

To make a long story short: The simplest way to solve this is to select the entire 2-list block and press the List tool several times to de-list and re-list it as a single list. Then set up your lower level components accordingly. And generally speaking, don't try to start new lists at lower levels, because that can and will cause issues. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
michal_novomesky
Posts: 62
Joined: Thu Jan 12, 2012 2:21 pm
Contact:

Re: HTML output not well-formed in case of nested <ul> lists

Unread post by michal_novomesky »

You are right that there is no issue in the browser.
But, if you would like to post-process the file using a XML parser, you will receive a parse error.

I tried to play with it again (removing/re-adding the list in H&M 8.4.1), the lists now have the same list ID (they didn't have in my previous post). Now the XHTML output is valid.

H&M XML:

Code: Select all

    <list id="0" type="ul" listtype="bullet" formatstring="&#183;" format-charset="SYMBOL_CHARSET" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:Symbol; font-size:11pt; color:#3a3a3a;">
      <li styleclass="Normal">Your full name, country, valid email address and your login credentials are required for registration and use of the Account, for provision of Services and for establishment, exercise and defense of our legal claims. Moreover, we will obtain some basic technical information about a device and application You use to log into your Account.</li>
      <list id="0" level="1" type="ul" listtype="bullet" formatstring="&#111;" levelreset="true" legalstyle="false" startfrom="1" styleclass="Normal" style="font-family:&apos;Courier New&apos;; font-size:11pt; color:#3a3a3a;">
        <li styleclass="Normal">Browser fingerprint to detect suspicious attempts to log in.</li>
        <li styleclass="Normal">You may choose to use third-party authentication provided by Apple or Google to register and/or sign to your Account. In such case, We will process your email address (provided to us by such third party) and country of your location during the registration process and for other purposes specified above.</li>
      </list>
    </list>
HTML:

Code: Select all

<ul style="list-style-type:disc">
<li class="p_Normal">Your full name, country, valid email address and your login credentials are required for registration and use of the Account, for provision of Services and for establishment, exercise and defense of our legal claims. Moreover, we will obtain some basic technical information about a device and application You use to log into your Account.<ul style="list-style-type:circle">
<li class="p_Normal">Browser fingerprint to detect suspicious attempts to log in.</li>
<li class="p_Normal">You may choose to use third-party authentication provided by Apple or Google to register and/or sign to your Account. In such case, We will process your email address (provided to us by such third party) and country of your location during the registration process and for other purposes specified above.</li>
</ul>
</li>
</ul>
Note that I need using the switch <config-value name="exportmarkersastext">0</config-value> only for RTL languages, as the original H&M do not render the HTML list output properly for RTL. That is, however, a different minor issue.

Anyway, thanks and resolved :)
User avatar
Tim Green
Site Admin
Posts: 7819
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: HTML output not well-formed in case of nested <ul> lists

Unread post by Tim Green »

Thanks for the feedback!
Note that I need using the switch <config-value name="exportmarkersastext">0</config-value> only for RTL languages, as the original H&M do not render the HTML list output properly for RTL. That is, however, a different minor issue.
Help+Manual only has very limited support for RTL languages. This is an area we don't really cater to. None of the designed HTML skins support them, and generating PDF with an RTL language will export the text as glyphs, which means the text will not be selectable or searchable and the file will be very large. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply