ScribusGenerator icon indicating copy to clipboard operation
ScribusGenerator copied to clipboard

Initial space after a delimiter it is ignored

Open fvollmer opened this issue 4 years ago • 2 comments

Initial space after a delimiter it is ignored.

Example

csv:

foo,bar
hello, and some more text

text:

This is some text%VAR_bar%.

This should be transformed into

This is some text and some more text.

but instead is transformed into

This is some textand some more text.

Workaround

Use quotes in csv (but not all tools support this) csv:

foo,bar
hello," and some more text"

Fix

Set skipinitialspace=False in https://github.com/berteh/ScribusGenerator/blob/master/ScribusGeneratorBackend.py#L559

I'm not sure why it was set to True. Is there any reason? If not I'm more than happy to provide a PR 😁

PS: Thanks for your nice script!

fvollmer avatar Sep 28 '20 21:09 fvollmer

Seems like skipinitialspace=True was introduced by ec0305030b5de5081a37c50a2e4268f6ba20f447.

Is skipinitialspace=True really necessary to support escaping quotes in data using double: ""?

fvollmer avatar Sep 29 '20 07:09 fvollmer

Thanks @fvollmer for your issue report and sorry for my late answer. No indeed I don't see why the skipinitialspace should be put to True by default... even if it sounded like a good idea at the time. fee free to put a PR to correct this. thanks !

berteh avatar Mar 07 '21 20:03 berteh