cooklang/cooklang-ts

[BUG] Metadata is not parsed correctly with CRLF line endings

Closed this issue · 3 comments

If you have CRLF ("\r\n") line endings enabled (i.e. on a windows machine), the following input:

>> source: example.com
step

parses as:

{
    "ingredients": [],
    "cookwares": [],
    "metadata": {
        "source": "example.com"
    },
    "steps": [
        [
            {
                "type": "text",
                "value": "\r"
            }
        ],
        [
            {
                "type": "text",
                "value": "step"
            }
        ]
    ],
    "shoppingList": {}
}

When LF ("\n") line endings are enabled it parses correctly as:

{
    "ingredients": [],
    "cookwares": [],
    "metadata": {
        "source": "example.com"
    },
    "steps": [
        [
            {
                "type": "text",
                "value": "step"
            }
        ]
    ],
    "shoppingList": {}
}

I'll look into it, probably will be another quick regex fix.

Fixed in 604b494.

Great, thanks!