BBcode [quote] tag truncates attributions after the first comma

AI-generated summary

The BBcode [quote] tag in Discourse truncates attributions after the first comma, which affects users migrating content from external platforms like WordPress that use commas in attribution strings (e.g., “Foo foo@bar.quux, on 2020-10-24 11:31, wrote”). avatar reported this as an edge case, noting that while commas can be removed as a workaround, it’s inconvenient for automated migrations. pfaffman clarified that Discourse’s [quote] tag expects a specific format: [quote="username, post:ID, topic:ID, username:username"], and anything not matching this structure is not guaranteed to work. avatar had assumed Discourse would fall back to displaying the raw attribution text if parsing failed, but this is not the case. They suggested it would be useful to have a dedicated quote tag for external sources. pfaffman proposed a plugin-based solution or embedding attribution info directly into raw post text to ensure compatibility without requiring plugins. The issue highlights a gap in handling non-Discourse quote attributions, especially during content migrations.

When quoting someone using the BBcode [quote] tag with an attribution, and that attribution includes a comma, i.e. [quote=“foo, bar”], everything following the comma is truncated, thus:

This is, admittedly, a rather odd use case and one which I only ran into because I’m migrating old WordPress comments over to Discourse and as such had a bunch of generated attributions along the lines of “Foo <foo@bar.quux>, on 2020-10-24 11:31, wrote”.

Easy workaround: lose the commas. But I figured it was worth posting just in case anyone else runs into the same thing.

This is how the quote tag works in discourse, so after the comma it’s expecting post, topic, and username. If your put something else, it’s not expected to work.

[quote="Alistair Young, post:1, topic:336217, username:avatar"]

Sometimes it’s possible to track down the correct post to attribute, but others it’s not. If you have the id of the post it’s referring to you could do a lookup and get the info.

I knew about the Discourse-specific format, but I was also somehow under the impression that it would - as an intentional behavior - default to just displaying the tag-text for anything that didn’t parse properly in that format as a way of quoting things from outside Discourse?

I guess that I’m incorrect in that belief, and that being the case, the behavior is explained. Although it would be awfully convenient if there was a quote tag equivalent for quoting from extra-Discourse places.

You could do it with a plugin that would bake the stuff into the posts. If a client asked me to do it, I’d likely do it by moving the quote info into the raw text (like the line above) so that it would work without a plugin.