Typescript wiki transformer adds trailing `/` to some links

Issue #42 resolved
Craig Lawrence created an issue

Investigation:

These unmarked up links are handled by LinkTextParser.

The slash at the end of TLDs is probably just a quirk of how the typescript classes build URIs… maybe this can be another FF patch, because it’s still valid without.


Wiki links without markup, and with only a TLD, get a trailing / added to the href attribute by the Typescript wiki transformer.

Wiki:

[google|http://www.google.com]

http://www.google.com               <-- this one is different in output

http://www.google.com/

http://www.google.com/a

The second case converts differently:

Typescript ADF:

{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "google",
          "marks": [
            {
              "type": "link",
              "attrs": {
                "href": "http://www.google.com"
              }
            }
          ]
        }
      ]
    },
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "http://www.google.com",
          "marks": [
            {
              "type": "link",
              "attrs": {
                "href": "http://www.google.com/"
              }
            }
          ]
        }
      ]
    },
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "http://www.google.com/",
          "marks": [
            {
              "type": "link",
              "attrs": {
                "href": "http://www.google.com/"
              }
            }
          ]
        }
      ]
    },
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "http://www.google.com/a",
          "marks": [
            {
              "type": "link",
              "attrs": {
                "href": "http://www.google.com/a"
              }
            }
          ]
        }
      ]
    }
  ]
}

Library ADF:

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "google",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "http://www.google.com"
        }
      } ]
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "http://www.google.com",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "http://www.google.com"
        }
      } ]
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "http://www.google.com/",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "http://www.google.com/"
        }
      } ]
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "http://www.google.com/a",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "http://www.google.com/a"
        }
      } ]
    } ]
  } ]
}

Comments (8)

  1. Log in to comment