Remplacement global du bbcode [code] par des accents graves

Dear all,

I’ve just tried to run the many examples for a global find-and-replace here in this forum but struggled with two things:

  1. 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.
  2. How can I replace the string “[code]” with “```” followed by a newline?
  3. 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 :confused:

Eric

1 « J'aime »

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.

Replacing now.

Eric

5 « J'aime »

I think you are also going to need to replace [/code] also maybe you need a newline.

1 « J'aime »

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.

3 « J'aime »

We do want to get that sorted in our remap somehow, for sure.

3 « J'aime »

Je ne parviens pas non plus à insérer de sauts de ligne en utilisant rake posts:remap avec le remplacement par regex. Je ne sais pas si c’est même possible.

Q : Si j’effectue des mises à jour via la base de données, dois-je modifier à la fois les versions brutes et cuites, ou si je mets à jour la version brute, la version cuite sera-t-elle mise à jour automatiquement, ou dois-je faire quelque chose pour que cela se produise ?

Je suppose que le plugin Data Explorer se contente d’exécuter des requêtes et n’effectue pas de mises à jour (UPDATE) ?