Line breaks changed to \n when using templates

Asked by Brian on 2017-08-22

When I use a template, that day's entry in the month text file has all its line breaks converted to \n.

If I just enter text into a day without using a template then the line breaks are preserved in the month text file. This is very much my preference as it preserves readability in plain text.

If I add a template after a basic entry, then the entire day has its line breaks converted to \n also.

Is there a reason for this behaviour, and is there any way that an option could be added to a future version to preserve line breaks in the plain text file regardless of template use?

Many thanks for a great program

Brian

Question information

Language:
English Edit question
Status:
Solved
For:
RedNotebook Edit question
Assignee:
No assignee Edit question
Solved by:
Jendrik Seipp
Solved:
2017-08-23
Last query:
2017-08-23
Last reply:
2017-08-23
Brian (brianmanton) said : #1

I've just spotted a previous question that was asking about this: https://answers.launchpad.net/rednotebook/+question/224456

The previous thread didn't note that the problem only occurs when using templates (at least this has been my experience).

Hopefully this will make it easier to find the cause of the issue.

Brian

Brian (brianmanton) said : #2

On further reading of that thread, it may be the extra line breaks at the end of my templates that are causing this for me.

Jendrik Seipp (jendrikseipp) said : #3

I can't reproduce this with RedNotebook 2.1.5. Which version and OS are you using?

Probably, this doesn't have anything to do with templates, but just that the template contents contain special characters that need to be escaped. In these cases the month files cannot preserve line breaks, but need to use \n. Maybe this issue also just goes away once you use RedNotebook 2.x (only available for Linux at the moment).

Brian (brianmanton) said : #4

I'm using 2.1.5 on Xubuntu 16.04 & 1.15 on Windows 8. Same thing happens on both versions.

You're right that it's not the use of templates. I've done further testing and unfortunately can't figure out what is triggering the change.

I can't see that it's special characters. All I am using are / : and * for bolding.

Brian (brianmanton) said : #5

I think the issue may be if there is a space at the end of a line.

I've been able to reproduce this a few times now. It may not be the only trigger but It's the only one I can find.

Best Jendrik Seipp (jendrikseipp) said : #6

Good catch! A space at the end triggers this for me as well. The underlying library probably has good reasons for its behaviour. Therefore, your best option is to avoid spaces at the end of lines.

Brian (brianmanton) said : #7

Thanks Jendrik Seipp, that solved my question.