Wiki transformer changes media grouping when trailing space

Issue #61 wontfix
Craig Lawrence created an issue

Request A

[^undefined] \n\n[^undefined]

Typescript

{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "mediaGroup",
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "undefined",
            "type": "file",
            "collection": ""
          }
        },
        {
          "type": "media",
          "attrs": {
            "id": "undefined",
            "type": "file",
            "collection": ""
          }
        }
      ]
    }
  ]
}

adf-builder-java

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "mediaGroup",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "undefined",
        "collection" : ""
      }
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : " "                  <---- preserves space, and seperates media groups
    } ]
  }, {
    "type" : "mediaGroup",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "undefined",
        "collection" : ""
      }
    } ]
  } ]
}

Request B (remove trailing space)

[^undefined]\n\n[^undefined]

Typescript

{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "mediaGroup",
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "undefined",
            "type": "file",
            "collection": ""
          }
        }
      ]
    },
    {
      "type": "mediaGroup",       <----- now seperate media groups compared to typescript for request A
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "undefined",
            "type": "file",
            "collection": ""
          }
        }
      ]
    }
  ]

adf-builder-java

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "mediaGroup",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "undefined",
        "collection" : ""
      }
    } ]
  }, {
    "type" : "mediaGroup",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "undefined",
        "collection" : ""
      }
    } ]
  } ]
}

The space seems to make no difference on DC

Comments (4)

  1. Craig Lawrence reporter

    The library behaviour seems more sensible here, it doesn’t make much sense that adding a space would group media that was previously ungrouped.

  2. Log in to comment