- π©π°Denmark ressa Copenhagen
Thanks for creating this issue @danflanagan8. I found it because you commented in the Migrate Plus issue π str_replace does not support strings with \n Closed: won't fix .
I found it while looking for hints to my issue π Preserve line breaks, to support importing Markdown format Active , where I am losing line breaks during a migration. Perhaps it is related to the YAML challenges outlined here?
I had hoped that a workaround could be to add an extra line break, something like this:
plugin: str_replace regex: true source: body search: /(\n)/ replace: $1$1
But it looks like the source value is put on a single line, before processing by Migrate:
$ drush migrate:import sub_nodes --update --migrate-debug 1^ "---------------------------------------------------------------------" 2^ "| $Source |" 3^ "---------------------------------------------------------------------" 4^ array:6 [ "nid" => 7086 "title" => "How to use Drupal" "body" => """ You can use Drupal for web site building. Here are some benefits (this list works):\n - Open source\n - Big community\n - A third reason\n Here are some benefits (end up on the same line ...):\n - Open source - Big community - A third reason\n [...]
A bit of the resulting source, with double line breaks via
str_replace
, but only for some lines, sadly not the list items:Here are some benefits (end up on the same line ...):\n \n - Open source - Big community - A third reason\n \n