Keeping line feeds in RTF export


#1

I am creating an action to export all the lyrics of selected songs. The lyrics, of course contain multiple lines of text.

If I export the data as a TXT file, the multiple lines and line breaks are retained.
If, however, I try to export the data as an RTF file, I lose all the line breaks.

How can I export the data as an RTF file and retain the line breaks in the exported file.


#2

It looks as though RTF does not interpret linebreaks.
So you can only get the linebreaks across if you add some information that either lets you replace this information with an RTF linebreak or insert the linebreak syntax into the lyrics field.
So you can either replace every $char(13)$char(10) with a "\par" prior to the export (and later replace it back)
So after a replace two lines of lyrics should look like this:
This the first line\par
and it sounds just fine\par


#3

Thanks! That worked like a charm.

Rather than replacing the tag and then replacing back, I used your help to put in a regular expression to convert inline in the export.

I put the line in the script:

Lyrics: \b $regexp($cutLeft(%unsyncedlyrics%,$add($strstr(%unsyncedlyrics%,||),1)),$char(13)$char(10),\\\\par )\b0\par

\par

The $cutLeft(%unsyncedlyrics%,$add($strstr(%unsyncedlyrics%,||),1)) is to get rid of the language designator that iTunes prepends the unsynecedlyrics tag with. For an English installation, iTunes prepends "eng||" to the tag.