mhaack / helix-importer

Foundation tools for importing website content into that can be consumed in an Helix project.
Apache License 2.0
0 stars 3 forks source link

[JCR importer] container properties should not be considered as a container item #21

Closed jckautzmann closed 2 weeks ago

jckautzmann commented 4 months ago

when importing an accordion with a title as the first row followed by its items:

+-----------------------------------------------------------------------------------------------------+
| Accordion (image)                                                                                   |
+=====================================================================================================+
| ## Our principles                                                                                   |
+---------------------------------+-------------------------------------------------------------------+
| ![We partner deep][image1]      | ### We partner deep                                               |
|                                 |                                                                   |
|                                 | The right team will help you achieve measurably improved outcomes |
|                                 | in utilization, cost, capacity, risk, and time. By offering you   |
|                                 | one point of contact, we source the right expertise from Danaher  |
|                                 | Life Sciences' entire ecosystem of engineering, science, and      |
|                                 | technology innovators.                                            |
|                                 |                                                                   |
|                                 | [Talk to an Expert -->](/content/danaher/ls/us/en/expert.html)    |

The importer considers the title row as an item and maps it as an item in the xml:

    <block sling:resourceType="core/franklin/components/block/v1/block" jcr:primaryType="nt:unstructured" name="Accordion" filter="accordion">
          <item jcr:primaryType="nt:unstructured" sling:resourceType="core/franklin/components/block/v1/block/item" name="Accordion Item" fileReference="Our principles" model="accordion-item" />
   <item_0 jcr:primaryType="nt:unstructured" sling:resourceType="core/franklin/components/block/v1/block/item" name="Accordion Item" fileReference="/content/dam/danaher/homepage-rebrand/we-partner-deep.jpg" accordion_title="We partner deep" accordion_titleType="h3" accordion_description="&lt;p>The right team will help you achieve measurably improved outcomes in utilization, cost, capacity, risk, and time. By offering you one point of contact, we source the right expertise from Danaher Life Sciences' entire ecosystem of engineering, science, and technology innovators.&lt;/p>" model="accordion-item" />

It seems to happen at https://github.com/mhaack/helix-importer/blob/html2jcr/src/importer/html2jcr/hast2jcr/handlers/block.js#L323: takes all children as items, instead of filtering out if the first row belongs to the container