plone / blocks-conversion-tool

A tool to convert HTML (as used in Plone Classic) to Blocks (as used on Volto)
7 stars 5 forks source link

Conversion of <a> tags missing hrefs #28

Closed steffenri closed 1 year ago

steffenri commented 1 year ago

Steps to reproduce:

We have this richtext data:

<h2 class=\"mceContentBody documentContent template-document_view portaltype-document site-dgsf_dev section-themen subsection-systemischer-kinderschutz subsection-systemischer-kinderschutz-xxx icons-on userrole-authenticated userrole-member userrole-contributor userrole-manager userrole-editor userrole-reader userrole-owner userrole-reviewer\"><a name=\"Austausch\"></a>Einladung zu fachlicher Kommentierung und Weiterentwicklung<i> <br /></i></h2>

When running the blocks-conversion-tool on that, we get the following:

 "2ddd37e8-ba7d-ce4a-96fa-ee154746263f": {
  "@type": "slate",
  "value": [
   {
    "type": "h2",
    "children": [
     {
      "type": "link",
      "data": {
       "url": null,
       "title": null,
       "target": null
      },
      "children": [
       {
        "text": ""
       }
      ]
     },
     {
      "text": "Einladung zu fachlicher Kommentierung und Weiterentwicklung"
     },
     {
      "type": "em",
      "children": [
       {
        "text": " \n"
       }
      ]
     }
    ]
   }
  ],
  "plaintext": "Einladung zu fachlicher Kommentierung und Weiterentwicklung "
 },

It's converted into a Link (although there is no Link, just the tag.) We should catch this and just create it as a normal p-tag.

davisagli commented 1 year ago

@steffenri This is a named anchor. It should ideally be converted into an id on the h2 tag, which can serve as the target for a link in the same way as a named anchor. It should not be converted into a p tag, which is not valid HTML inside h2 and would affect spacing badly if it was.

davisagli commented 1 year ago

@steffenri And, this looks like a duplicate of #15

steffenri commented 1 year ago

@davisagli It is. Closed.

It's already closed. I am going to bed :D