Skip to content

Support line continuation in property values #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
F-Schmidt99 opened this issue Feb 15, 2025 · 0 comments
Open
3 tasks done

Support line continuation in property values #44

F-Schmidt99 opened this issue Feb 15, 2025 · 0 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@F-Schmidt99
Copy link

F-Schmidt99 commented Feb 15, 2025

Describe the request

The most prevalent use of the data format supported by this module is the Arduino library metadata file (library.properties). It is common for the value of some properties (especially paragraph) to be quite long.

🙂 It would be useful to support line continuation of property values to allow the value to be split into multiple lines for the sake of readability and maintainable of the data.

For example, this library.properties file:

name=Ulm_Weatherballoon
version=0.3.1
author=Falko Schmidt
maintainer=Falko Schmidt
sentence=Library for high altitude applications.
paragraph=This software is designed for high-altitude weather balloons, enabling them to reach the edge of space and collect data from the stratosphere. However, please note that not all implementations have been fully tested in actual flight conditions.
category=Sensors
url=https://gitlab.com/F-Schmidt/ulm_weatherballoon
architectures=rp2040,mbed_rp2040
depends=Adafruit NeoPixel,Adafruit SSD1306,Adafruit ADXL343,Adafruit MAX1704X,ENS160 - Adafruit Fork,Sensirion I2C SCD4x,Adafruit LIS3MDL,Adafruit BMP280 Library,Adafruit LPS2X,Adafruit RTClib,Sensirion I2C SHT4x,DallasTemperature,SdFat - Adafruit Fork

would be more readable and maintainable if it could be formatted like so:

name=Ulm_Weatherballoon
version=0.3.0
author=Falko Schmidt
maintainer=Falko Schmidt
sentence=Library for high altitude applications.
paragraph=This software can be used for high altitude weather balloons to reach the edge of space! Special classes \
  and algorithms are used to provide a successful ride reaching the stars. Please note, that not all implementations \
  are yet practically tested in a flight.
category=Sensors
url=https://gitlab.com/F-Schmidt/ulm_weatherballoon
architectures=rp2040,mbed_rp2040
depends=Adafruit NeoPixel,\
  Adafruit SSD1306,\
  Adafruit ADXL343,\
  Adafruit MAX1704X,\
  ENS160 - Adafruit Fork,\
  Sensirion I2C SCD4x,\
  Adafruit LIS3MDL,\
  Adafruit BMP280 Library,\
  Adafruit LPS2X,\
  Adafruit RTClib,\
  Sensirion I2C SHT4x,\
  DallasTemperature,\
  SdFat - Adafruit Fork

However, with the latter content in library.properties, the Arduino development tools will not recognize the library.

Describe the current behavior

Line continuation is not supported in property values, so the entire property definition must be placed on a single line.

If line continuation is attempted, the module can not load the data:

package main

import (
	"github.com/arduino/go-properties-orderedmap"
)

func main() {
	rawProperties := []byte(`
foo=bar \
baz
	`)
	propertiesMap, err := properties.LoadFromBytes(rawProperties)
	if err != nil {
		panic(err)
	}
	print(propertiesMap.Dump())
}
panic: error parsing data at line 2: invalid line format, should be 'key=value'

goroutine 1 [running]:
main.main()
        main.go:14 +0x69
exit status 2

🙁 This can result in excessively long lines, which harms readability.

github.com/arduino/go-properties-orderedmap version

d55cecc

Additional context

It appears that the Java "properties" file data format (which I would guess to be the ancestor of the Arduino "properties" data format) does support line continuation, using the standard \ line continuation marker:

https://en.wikipedia.org/wiki/.properties#Format

# Adding a backslash ('\') at the end of a line means that the value continues on the next line.
multiline = This line \
continues

Keywords

  • "carriage return"

  • "escape"

  • "line break"

  • "new line"

  • "newline"

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest version of the module
  • My request contains all necessary details
@F-Schmidt99 F-Schmidt99 added the type: imperfection Perceived defect in any part of project label Feb 15, 2025
@per1234 per1234 changed the title Properties-parser for libraries not working Support line continuation in property values Feb 15, 2025
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself and removed type: imperfection Perceived defect in any part of project labels Feb 15, 2025
@per1234 per1234 transferred this issue from arduino/arduino-ide Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants