Skip to content

Line ending backslash in """ causes later line breaks to also be removed #372

@JoelColledge

Description

@JoelColledge

Hi, I'm having trouble with breaking long lines in """ delimited strings using a backslash. This is called a "line ending backslash" in the toml spec.

Reproducer:

package main

import (
	"fmt"
	"os"

	"github.com/BurntSushi/toml"
)

const in = `f = """
a\
b
c
"""`

func main() {
	var out map[string]string
	if _, err := toml.Decode(in, &out); err != nil {
		fmt.Fprintf(os.Stderr, "error: %v\n", err)
		os.Exit(1)
	}

	fmt.Println(out["f"])
}

Expected output, which is generated with BurntSushi/toml v0.3.1:

ab
c

Output with BurntSushi/toml v1.2.1:

abc

Any chance of fixing this? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions