ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 31 forks source link

Escape underscores on template labels #529

Closed Rdornier closed 11 months ago

Rdornier commented 1 year ago

Fix part of issue #486, related to

I didn't change much because I think the markdown reading need to be preserved (see PR https://github.com/ome/omero-figure/pull/481#issuecomment-1288570316).

For each label added from a template (tags, channel name and key-values only ; image and dataset name are correctly handled), the underscore is escaped with a backslah replaceAll("_", "\\_"). This enables a correct display of the label in omero.figure and it is compatible with Figure-to-pdf.py (_ and \_ are identically interpretated in the script).

I've also integrated this feature in the PR #528.

snoopycrimecop commented 1 year ago

Conflicting PR. Removed from build OMERO-plugins-push#311. See the console output for more details. Possible conflicts:

--conflicts

snoopycrimecop commented 1 year ago

Conflicting PR. Removed from build OMERO-plugins-push#312. See the console output for more details. Possible conflicts:

--conflicts Conflict resolved in build OMERO-plugins-push#319. See the console output for more details.

will-moore commented 1 year ago

@Rdornier can you now rebase or merge in the master branch to fix the merge conflicts here (now that #528 is merged)? thx

Rdornier commented 12 months ago

I have a question regarding the documentation in the "Tips". It is written that to make a text italic, you need to use one start *italic* but it is also working with underscores _italic_. Should we add the two options in the tips ? And should we also inicate how to escape the underscores to not be interpreted as markdown formatting ?

will-moore commented 12 months ago

Yes, tips improvements sounds good. 👍

will-moore commented 11 months ago

I just had a final thought/question before I merge this... I wonder if we only need to escape underscores if there are more than 1 in the label? E.g. If my tag is dead_cell then this won't be understood as markdown. But if I have KV pair as my_key: my_value then this would need to be escaped.

I'm undecided by this:

So, I'm happy to stick with the existing behaviour, but just thought I'd ask the question?

Also, I think once this is merged, we are close to getting all this work released as https://github.com/ome/omero-figure/milestone/16. Just a couple of my PRs to get reviewed and merged...

We could consider https://github.com/ome/omero-figure/pull/524 too (needs merge conflicts fixed).

Rdornier commented 11 months ago

I see your point... Preferentially, I would keep the current implementation because it is quite simple and consistant. However, if you really see an issue with escaping all underscores, then I can implement the counting. We can also ask the question to @jburel

I'm also thinking about a different solution to use the markdown. By default, nothing is interpretated as markdown. If the user introduce md: at the beginning, then the label is markdown compatible. I don't know if this solution could be good / feasible ; it just comes out of the mind. It will however introduce a major change and we should open a need issue / PR to discuss about it.

will-moore commented 11 months ago

OK, agreed. 👍