uhd-urz / elAPI

An extensible API client for eLabFTW
GNU Affero General Public License v3.0
5 stars 0 forks source link

New experiments plugin - [merged] #83

Closed alexander-haller closed 2 months ago

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 7, 2024, 03:07

Merges add-experiments-plugin -> dev

Experiment plugin

append

The append command appends text content to existing experiments. append accepts the following arguments.

$ elapi experiments append --help

image

We elaborate the details and a few corner cases in brief details. We use the experiment 16 to demonstrate our examples.

1. Normal use-case

Passing any text content to --text is appended to the experiment without any change to the content.

Before: image

$ python -m src.elapi.cli experiments append --id 16 -t "New content."
Successfully appended content to experiment.

After: image

2. Multi-line text

Passing multi-line text on the terminal via --text is possible depending on the terminal.

Before: image

$ elapi experiments append --id 16 -t "New # <- new line
# <- new line
# <- new line
content."

After: image

3. Markdown to HTML

experiments plugin support converting markdown content to HTML. eLabFTW's editor supports rendering HTML text either in HTML editor mode or in markdown mode.

Before: image

$ python -m src.elapi.cli experiments append --id 16 -M -t "**New content.**"
Successfully appended content to experiment.

After: image

Downsides of markdown conversion

One (one of many perhaps!) downside with the -M flag is when a file is a passed with --path and the file's contents aren't markdown. This, of course, isn't the intended the use-case, and mainly a mistake from the user's end. Consider the following Chemikalienverzeichnis_Beispiel.csv file:

4;Glutamin;Merck;L202312-04;fest;angelegt;Kategorie 1;56-85-9

If this CSV file was appended with -M (elapi experiments append -P ./Chemikalienverzeichnis_Beispiel.csv) then above CSV row will be parsed as:

<p>4;Glutamin;Merck;L202312-04;fest;angelegt;Kategorie 1;56-85-9</p>

The output is simple wrapped in <p> tag. If the above CSV row however had un-escaped markdown syntax, -M will try to parse the text in markdown. I.e., If Chemikalienverzeichnis_Beispiel.csv file contained:

4;**Glutamin**;Merck;### L202312-04;fest;angelegt;Kategorie 1;56-85-9

It will be parsed as:

<p>4;<strong>Glutamin</strong>;Merck;### L202312-04;fest;angelegt;Kategorie 1;56-85-9</p>
     ^^^^^^^^^^^^^^^^^^^^^^^^^

In other words, --markdown-to-html is safest to use with only markdown (.md) and HTML files/content.

Also fixes #16.

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 8, 2024, 17:46

requested review from @alexander-haller

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 9, 2024, 18:05

To-do:

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 11, 2024, 16:40

added 6 commits

Compare with previous version

alexander-haller commented 6 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 11, 2024, 16:47

added 1 commit

Compare with previous version

alexander-haller commented 6 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 11, 2024, 17:37

added 33 commits

Compare with previous version

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 11, 2024, 17:39

Screenshot_2024-03-11_at_5.38.32_PM

These commits are force push of the same commits. Some commits weren't properly signed due to mess up before.

alexander-haller commented 6 months ago

approved this merge request

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 12, 2024, 17:06

Thanks for approving. I still need to polish some things up (to-dos above) and squash open bugs before it's finally ready.

alexander-haller commented 5 months ago

In GitLab by @mhxion on Mar 14, 2024, 03:02

added 13 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 14, 2024, 18:45

added 5 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 14, 2024, 18:51

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 14, 2024, 18:55

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 14, 2024, 18:58

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 15, 2024, 20:53

added 4 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 15, 2024, 20:58

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 15, 2024, 21:10

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 16, 2024, 24:30

added 2 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 16, 2024, 18:25

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 16, 2024, 21:08

added 2 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 16, 2024, 21:29

added 2 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @mhxion on Mar 19, 2024, 01:30

added 4 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 19, 2024, 02:05

added 2 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 19, 2024, 02:32

added 2 commits

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @project_994_bot_1f89ebd5af89f5e987c71c650dd64895 on Mar 19, 2024, 02:38

added 1 commit

Compare with previous version

alexander-haller commented 5 months ago

In GitLab by @mhxion on Mar 19, 2024, 02:45

We will do a rush merge for sake of FDM Workshop. Development on this branch will continue later.

alexander-haller commented 5 months ago

In GitLab by @mhxion on Mar 19, 2024, 02:45

marked this merge request as ready

alexander-haller commented 5 months ago

In GitLab by @mhxion on Mar 19, 2024, 02:46

approved this merge request

alexander-haller commented 3 months ago

In GitLab by @mhxion on Jun 9, 2024, 15:33

We have made a lot of changes. We will delete this branch, and continue with a new branch.