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 Import] issue with link parsing in block item #33

Closed mhaack closed 2 weeks ago

mhaack commented 2 weeks ago

Links are not parse correctly, maybe because they are part of the block/item? For links within blocks it works.

From the block below everything is converted correctly, except the link. The JCR contains the link only, but the link text is missing.

+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| fast-facts                                                                                                                                                                                 |
+==========+=======================================+=========================================================================================================================================+
| ### \~90 | ###### \                         | [Forbes](https://www.forbes.com/sites/gregpetro/2022/03/11/consumers-demand-sustainable-products-and-shopping-formats/?sh=515b8fa66a06) |
|          |                                       |                                                                                                                                         |
| %        | ### \                            |                                                                                                                                         |
|          |                                       |                                                                                                                                         |
|          | of Gen X consumers say they’d be      |                                                                                                                                         |
|          | willing to pay more for sustainable   |                                                                                                                                         |
|          | items—compared to 34% just a couple   |                                                                                                                                         |
|          | of years ago.                         |                                                                                                                                         |
+----------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| ### 77   | ###### \                         | [Ware2Go](https://ware2go.co/articles/defining-fast-shipping/)                                                                          |
|          |                                       |                                                                                                                                         |
| %        | ### \                            |                                                                                                                                         |
|          |                                       |                                                                                                                                         |
|          | of shoppers are more likely to make a |                                                                                                                                         |
|          | purchase if delivery is promised in   |                                                                                                                                         |
|          | two days or less.                     |                                                                                                                                         |
+----------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+

HTML:

<table>
        <tr>
          <th colspan="3">fast-facts</th>
        </tr>
        <tr>
          <td>
            <div>
              <h3>~90</h3>
              <p>%</p>
            </div>
          </td>
          <td>
            <div>
              <h6>&amp;nbsp;</h6>
              <h3>&amp;nbsp;</h3>
              <p>of Gen X consumers say they’d be willing to pay more for sustainable items—compared to 34% just a couple of years ago.</p>
            </div>
          </td>
          <td>
            <div><a href="https://www.forbes.com/sites/gregpetro/2022/03/11/consumers-demand-sustainable-products-and-shopping-formats/?sh=515b8fa66a06">Forbes</a></div>
          </td>
        </tr>
        <tr>
          <td>
            <div>
              <h3>77</h3>
              <p>%</p>
            </div>
          </td>
          <td>
            <div>
              <h6>&amp;nbsp;</h6>
              <h3>&amp;nbsp;</h3>
              <p>of shoppers are more likely to make a purchase if delivery is promised in two days or less.</p>
            </div>
          </td>
          <td>
            <div><a href="https://ware2go.co/articles/defining-fast-shipping/">Ware2Go</a></div>
          </td>
        </tr>
      </table>

Model:

{
    "id": "fast-facts",
  },
  {
    "id": "fast-fact",
    "fields": [
      {
        "component": "text",
        "valueType": "string",
        "name": "number_number",
        "label": "Number"
      },
      {
        "component": "text",
        "valueType": "string",
        "name": "number_numberType",
        "value": "h3",
        "hidden": true
      },
      {
        "component": "text",
        "valueType": "string",
        "name": "number_unit",
        "label": "Unit"
      },
      {
        "component": "text",
        "valueType": "string",
        "name": "text_eyebrow",
        "label": "Eyebrow"
      },
      {
        "component": "text",
        "valueType": "string",
        "name": "text_eyebrowType",
        "hidden": true
      },
      {
        "component": "text",
        "name": "text_title",
        "label": "Title",
        "valueType": "string"
      },
      {
        "component": "text",
        "name": "text_titleType",
        "valueType": "string",
        "hidden": true
      },
      {
        "component": "richtext",
        "name": "text_text",
        "label": "Text",
        "valueType": "string"
      },
      {
        "component": "aem-content",
        "name": "link",
        "label": "Link",
        "valueType": "string"
      },
      {
        "component": "text",
        "name": "linkTitle",
        "label": "Link Title",
        "valueType": "string"
      },
      {
        "component": "text",
        "name": "linkText",
        "label": "Link Text",
        "valueType": "string"
      }
    ]
  },

Definition:

        {
          "title": "Fast Facts",
          "id": "fast-facts",
          "plugins": {
            "xwalk": {
              "page": {
                "resourceType": "core/franklin/components/block/v1/block",
                "template": {
                  "name": "Fast Facts",
                  "filter": "fast-facts",
                  "model": "fast-facts",
                  "item": {
                    "sling:resourceType": "core/franklin/components/block/v1/block/item",
                    "jcr:primaryType": "nt:unstructured",
                    "name": "Fast Fact",
                    "model": "fast-fact",
                    "text_eyebrowType": "h6",
                    "number_numberType": "h3",
                    "text_titleType": "h3"
                  }
                }
              }
            }
          }
        },
        {
          "title": "Fast Fact",
          "id": "fast-fact",
          "plugins": {
            "xwalk": {
              "page": {
                "resourceType": "core/franklin/components/block/v1/block/item",
                "template": {
                  "name": "Fast Fact",
                  "model": "fast-fact",
                  "text_eyebrowType": "h6",
                  "number_numberType": "h3",
                  "text_titleType": "h3"
                }
              }
            }
          }
        },