Skip to content

line wrapping in properties files #34

Description

@pohutukawa

I've been looking and trying like crazy, but I can't find an option to allow for value continuation in the following line by adding backslash \ at the end of a line.

This is specified and allowed in the Java .properties specification, and we're using a .properties file between Java and TypeScript properties as a common/shared set of test vectors to keep the implementations consistent. Unfortunately this package doesn't support that feature (e.g. for keeping JSON values tidy across several lines), so there's always the danger of introducing errors through this.

Is there a possibility this feature may make its way into the properties module?

Activity

  1. gagle commented on Nov 12, 2020

    @gagle
    Owner
  2. pohutukawa commented on Nov 16, 2020

    @pohutukawa
    Author

    I would if I had the skills for JS/TS. I'm more of a Python or Java person.
    I had looked at node-properties as it advertises to be spec compatible, and the test vectors in the .properties file come from Java.

    However, I have been able to solve the problem with a work-around. Maybe it helps others with the same kind of problems.

    let propContent = fs.readFileSync('./test/test-data.properties', 'utf8');
    propContent = propContent.replace(`\\$`, '\n');
    const myProperties = properties.parse(propContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions