Wiki transformer doesn't parse decimals in width

Issue #59 resolved
Craig Lawrence created an issue

This will likely effect others properties too like height.

Wiki

!image.png|width=34.5%!
!image.png|width=34%!
!image.png|width=34.5!
!image.png|width=34!

Typescript

{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "mediaSingle",
      "attrs": {
        "width": 34,
        "layout": "center"
      },
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "image.png",
            "type": "file",
            "collection": ""
          }
        }
      ]
    },
    {
      "type": "mediaSingle",
      "attrs": {
        "width": 34,
        "layout": "center"
      },
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "image.png",
            "type": "file",
            "collection": ""
          }
        }
      ]
    },
    {
      "type": "mediaSingle",
      "attrs": {
        "layout": "center"
      },
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "image.png",
            "type": "file",
            "collection": "",
            "width": 34,
            "height": 183
          }
        }
      ]
    },
    {
      "type": "mediaSingle",
      "attrs": {
        "layout": "center"
      },
      "content": [
        {
          "type": "media",
          "attrs": {
            "id": "image.png",
            "type": "file",
            "collection": "",
            "width": 34,
            "height": 183
          }
        }
      ]
    }
  ]
}

adf-builder-java

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "mediaSingle",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "image.png",
        "collection" : ""
      }
    } ],
    "attrs" : {
      "layout" : "center"            <----- width missing
    }
  }, {
    "type" : "mediaSingle",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "image.png",
        "collection" : ""
      }
    } ],
    "attrs" : {
      "layout" : "center",
      "width" : 34
    }
  }, {
    "type" : "mediaSingle",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "image.png",
        "collection" : "",
        "width" : 200,                 <---- wrong value
        "height" : 183
      }
    } ],
    "attrs" : {
      "layout" : "center"
    }
  }, {
    "type" : "mediaSingle",
    "content" : [ {
      "type" : "media",
      "attrs" : {
        "type" : "file",
        "id" : "image.png",
        "collection" : "",
        "width" : 34,
        "height" : 183
      }
    } ],
    "attrs" : {
      "layout" : "center"
    }
  } ]
}

Comments (5)

  1. Chris Fuller

    I don’t think it will affect height because there is no percentage height fields in ADF.

    What’s going on here is that pixel width and height go on media but that node does not support a percentage, so the percentage needs to be placed on the mediaSingle instead.

  2. Craig Lawrence reporter

    Sure, but in the case of !image.png|height=34.5! typescript still happily truncates the values to 34 whereas the lib ignores it completely.

  3. Log in to comment