The discussion revolves around replacing BBCode [code] tags with backticks in Discourse posts. eboehnisch initially struggled with running rake posts:remap commands due to shell interpretation of backticks, later resolving it by using Postgres directly after failing to insert newlines with remap. sam suggests also replacing [/code] and notes the need to handle newlines, while AndyBr questions whether updates affect both raw and cooked versions and confirms the data explorer doesn’t support UPDATE operations.
I’ve just tried to run the many examples for a global find-and-replace here in this forum but struggled with two things:
How do I run these rake posts: ... commands? When I type the command at the command line I just end up with a new line showing a >. I’ve never done anything with Ruby so far.
How can I replace the string “[code]” with “```” followed by a newline?
Can I search also for a newline so that only replace “[code]” that follows a newline?
Sorry for all these noob questions but I’m new to Discourse and in the midde of a large website relaunch
I solved the problem (sleeping over it revealed the problem). I typed:
rake posts:remap["[code]","```"]
The three backticks where interpreted by the shell and so caused it to ask me to complete the command. Therefore the additional prompt that I confused for a rake prompt.
Done exactly that. I replaced [code] with \n and three backticks, and [/code] with three backticks and \n. Looks fine now. In the end I used Postgres instead of remap because I couldn’t get it to insert the newlines correctly.
I am unable to insert newlines either using rake posts:remap with the regex replace. No idea if it can even be done.
Q: If I do updates with via the database, do I need to edit both the raw and cooked versions, or if I update the raw will it update the cooked version automagically or do I need to do something to have it update?
I assume the data explorer plugin just does Queries and doesn’t do UPDATEs?