The problem turns out to involve, amongst other things, a bug or fossil in AppleScript behaviour, which creates a non-compliant (\r
delimited rather than \n
delimited) plain text sequence from your clipboard-rewriting incantation.
(It looks like Bike may need to allow for the pasting of unexpected \r
delimited outlines)
If we copy a simple outline like this:
We get a Bike clipboard with three types of paste-board items: Bike XML, OPML, and Plain Text:
Expand disclosure triangle to view a representation of the Bike clipboard
{
"com.hogbaysoftware.bike.xml as string": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n </head>\n <body>\n <ul id=\"EKfuLIfK\">\n <li id=\"my\">\n <p>Alpha</p>\n <ul>\n <li id=\"eG\">\n <p>Beta</p>\n </li>\n <li id=\"UB\">\n <p>Gamma</p>\n </li>\n <li id=\"PR\">\n <p>Delta</p>\n </li>\n </ul>\n </li>\n </ul>\n </body>\n</html>\n",
"org.opml.opml as string": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<opml>\n <head>\n <meta charset=\"utf-8\"/>\n </head>\n <body id=\"EKfuLIfK\">\n <outline id=\"my\" text=\"Alpha\">\n <outline id=\"eG\" text=\"Beta\"/>\n <outline id=\"UB\" text=\"Gamma\"/>\n <outline id=\"PR\" text=\"Delta\"/>\n </outline>\n </body>\n</opml>\n",
"public.plain-text as string": "Alpha\n\tBeta\n\tGamma\n\tDelta",
"public.utf8-plain-text as string": "Alpha\n\tBeta\n\tGamma\n\tDelta",
"public.data as string": "Alpha\n\tBeta\n\tGamma\n\tDelta",
"com.hogbaysoftware.bike.references as string": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html>\n <head>\n <meta charset=\"utf-8\"/>\n </head>\n <body>\n <ul id=\"EKfuLIfK\">\n <li id=\"my\">\n <unknown/>\n </li>\n </ul>\n </body>\n</html>\n"
}
Whereas if we copy four lines with tab-indents from a standards-compliant plain text editor we get just \n
delimited plain text:
{
"public.utf8-plain-text as string": "Alpha\n\tBeta\n\tGamma\n\tDelta",
}
Look, however, at what that AppleScript incantation overwrites the Bike clipboard with:
{
"public.utf16-plain-text as string": "A\u0000l\u0000p\u0000h\u0000a\u0000\r\u0000\t\u0000B\u0000e\u0000t\u0000a\u0000\r\u0000\t\u0000G\u0000a\u0000m\u0000m\u0000a\u0000\r\u0000\t\u0000D\u0000e\u0000l\u0000t\u0000a\u0000",
"public.utf8-plain-text as string": "Alpha\r\tBeta\r\tGamma\r\tDelta",
"com.apple.traditional-mac-plain-text as string": "Alpha\r\tBeta\r\tGamma\r\tDelta",
"dyn.ah62d4rv4gk81g7d3ru as string": "\u0001\u0000\u0000\u0000\u0000\u0000\u0010\u0000\u000e\u0000\u0003\u0000\u0000\u0000\f\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
}
Bike XML has been lost, and the public.utf8-plain-text
pasteboard item, which should still be \n
delimited, has now been overwritten with \r
delimiters.
(Not sure if this is the kind of cleaning you had intended, but it’s not what macOS expects, these days).
Possibly worth flagging to Apple, though maintenance of AppleScript seems to have moved into a sunset phase now.