Page MenuHomePhabricator

Diff - alternate patch for returning byteOffsetStart objects from wikidiff2
Closed, ResolvedPublic

Description

Per section title / section location wikidiff2 patch feedback, this subtask is a placeholder for an alternate approach.

Event Timeline

Change 548837 had a related patch set uploaded (by Tsevener; owner: Tsevener):
[mediawiki/php/wikidiff2@master] Remove previous section title logic, return byteOffsetStart objects

https://gerrit.wikimedia.org/r/548837

Change 548837 merged by jenkins-bot:
[mediawiki/php/wikidiff2@master] Remove previous section title logic, return byteOffsetStart objects

https://gerrit.wikimedia.org/r/548837

I've updated my change with one that bundles section offset information, it's ready for review. Sample output showing added text after a multi-line heading:

{
  "from": {
    "id": 1529,
    "slot_role": "main",
    "sections": [
      {
        "level": 2,
        "title": "==One==",
        "offset": 6
      },
      {
        "level": 2,
        "title": "==Two==",
        "offset": 15
      },
      {
        "level": 2,
        "title": "==With comment in h <!--\n--> ==",
        "offset": 24
      }
    ]
  },
  "to": {
    "id": 1530,
    "slot_role": "main",
    "sections": [
      {
        "level": 2,
        "title": "==One==",
        "offset": 6
      },
      {
        "level": 2,
        "title": "==Two==",
        "offset": 15
      },
      {
        "level": 2,
        "title": "==With comment in h <!--\n--> ==",
        "offset": 24
      }
    ]
  },
  "diff": [
    {
      "type": 0,
      "lineNumber": 7,
      "text": "==With comment in h <!--",
      "offset": {
        "from": 24,
        "to": 24
      }
    },
    {
      "type": 0,
      "lineNumber": 8,
      "text": "--> ==",
      "offset": {
        "from": 49,
        "to": 49
      }
    },
    {
      "type": 1,
      "lineNumber": 9,
      "text": "aa",
      "offset": {
        "from": null,
        "to": 56
      }
    }
  ]
}

I renamed "title" to "heading" in the section info objects.