Skip to content

JSON renderer sometimes set <ins> and <del> tags into lines #40

@phoenixgao

Description

@phoenixgao

This is an return value example I've got:

[{
    "new": {
        "lines": ["菲灵", "Elmex", "夏依"],
        "offset": 0
    },
    "old": {
        "lines": ["菲灵", "Elmex", "夏依"],
        "offset": 0
    },
    "tag": "eq"
}, {
    "new": {
        "lines": ["<ins>福来恩</ins>"],
        "offset": 3
    },
    "old": {
        "lines": ["<del>百吉福</del>"],
        "offset": 3
    },
    "tag": "rep"
}, {
    "new": {
        "lines": ["乐高"],
        "offset": 4
    },
    "old": {
        "lines": ["乐高"],
        "offset": 4
    },
    "tag": "eq"
}, {
    "new": {
        "lines": [""],
        "offset": 5
    },
    "old": {
        "lines": ["天维美/国内"],
        "offset": 5
    },
    "tag": "del"
}, {
    "new": {
        "lines": ["皇家京东", "九木杂物社淘宝", "网鱼网咖", "味全", "英雄联盟旗舰店"],
        "offset": 5
    },
    "old": {
        "lines": ["皇家京东", "九木杂物社淘宝", "网鱼网咖", "味全", "英雄联盟旗舰店"],
        "offset": 6
    },
    "tag": "eq"
}]

with the following options:

$diffJson = DiffHelper::calculate($old, $new, "Json",
            [
                'context' => 2048
            ],
            [
                'outputTagAsString' => true,
            ]
        );

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions