Skip to content

config: replace the comma separator by new-line in ListAttribute #1626

Open
@Exirel

Description

@Exirel

Sopel 7.x task list:

Sopel 8.x and 9.x task list:

TL;DR: in Sopel 7.x, I want to detect \n to switch to a new mode that doesn't require a delimiter with escape character.

Disclaimer: an escape mechanism was brought in for Sopel 7.x by #1460 to allow comma-separated values. I think it's a great achievement but, sadly, also something that I may want to remove entirely. I'm fully aware that this may mean having to throw off the hard work put in by @HumorBaby and I want to re-assert how much respect I've for his works, past and present.

Current state in Sopel 6.6.x

As of today's version of Sopel 6.6.x branch, this config file:

[spam]
eggs = one, two, three, four, and a half
bacons = grilled
    burn out
    greasy, fat, and tasty

will be read as this:

>>> config.spam.eggs
['one', ' two', ' three', ' four', ' and a half']
>>> config.spam.bacons
['grilled\nburn out\ngreasy', 'fat', 'and tasty']

Current state in Sopel master

In the master branch, since #1460, it is possible to escape the comma, so it would be like that:

[spam]
eggs = one, two, three, four, and a half
eggs_safe = one, four\, and a half
bacons = grilled
    burn out
    greasy, fat, and tasty

which result in eggs_safe to be properly handled, but leaving bacons still in a poor state:

>>> config.spam.eggs_safe
['one', 'four, and a half']
>>> config.spam.bacons
['grilled\nburn out\ngreasy', 'fat', 'and tasty']

And now, if we want to throw regex pattern (that need to be escaped too), what do we have?

[spam]
regex_pattern = ^Full stop\, Period\\.$, also:? this pattern$
regex_multilines =
    ^Full stop, Period\.$
    also:? this pattern$

Sure thing, regex patterns are not the easiest things to read, but I found that the multi-lines version far more readable.

What's next? What's my plan?

If we take back the example for Sopel 6.6.x:

[spam]
eggs = one, two, three, four, and a half
bacons = grilled
    burn out
    greasy, fat, and tasty

I want that output:

>>> config.spam.eggs
['one', 'two', 'three', 'four', 'and a half']
>>> config.spam.bacons
['grilled', 'burn out', 'greasy, fat, and tasty']

For Sopel 7.x I want to implement that so:

  • no escape delimiter
  • single-line expressions will be split by comma, as it is today
  • multi-line expressions will be split by break-line, *without split by comma

Then in Sopel 8.x, I want to add a "deprecation warning" on single-line expressions.

Then in Sopel 9.x, I want to remove single-line expressions handling (ie. no more split by comma).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions