Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Inconsistent callout handling #13

Open
tsievert opened this issue Jul 2, 2024 · 1 comment
Open

[Bug] Inconsistent callout handling #13

tsievert opened this issue Jul 2, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tsievert
Copy link

tsievert commented Jul 2, 2024

I was testing how this works with my workflow and noticed inconsistent behaviors with callouts.

Here the code without trying to serialize it:

> [!Experiments]+
> - # In-Progress
>
> ```dataview
> LIST FROM "01 Research/Lab Notebook" AND #experiment WHERE contains(status, "in-progress")
> ```

Now with serialization that does not get recognized:

> [!Experiments]+
> - # In-Progress
>
><!-- QueryToSerialize: LIST FROM "01 Research/Lab Notebook" AND #experiment WHERE contains(status, "in-progress") -->

Then I tried it outside of the callout, and suddenly the part inside the callout gets recognized:

<!-- QueryToSerialize: LIST FROM "01 Research/Lab Notebook" AND #experiment WHERE contains(status, "in-progress") -->
<!-- SerializedQuery: LIST FROM "01 Research/Lab Notebook" AND #experiment WHERE contains(status, "in-progress") -->
- [[01 Research/Lab Notebook/2023-09-08 Camera calibration.md|2023-09-08 Camera calibration]]
- [[01 Research/Lab Notebook/2023-09-15 Reactions to conspecific and heterospecific bedding in Peromyscus.md|2023-09-15 Reactions to conspecific and heterospecific bedding in Peromyscus]]
<!-- SerializedQuery END -->

> [!Experiments]+
> - # In-Progress
>
><!-- QueryToSerialize: LIST FROM "01 Research/Lab Notebook" AND #experiment WHERE contains(status, "in-progress") -->
<!-- SerializedQuery: LIST FROM "01 Research/Lab Notebook" AND #experiment WHERE contains(status, "in-progress") -->
- [[01 Research/Lab Notebook/2023-09-08 Camera calibration.md|2023-09-08 Camera calibration]]
- [[01 Research/Lab Notebook/2023-09-15 Reactions to conspecific and heterospecific bedding in Peromyscus.md|2023-09-15 Reactions to conspecific and heterospecific bedding in Peromyscus]]
<!-- SerializedQuery END -->

It messes up the callout, but somehow it suddenly kinda works.

@tsievert tsievert changed the title [Bug} Inconsistent callout handling [Bug] Inconsistent callout handling Jul 2, 2024
@dsebastien
Copy link
Owner

dsebastien commented Jul 2, 2024

The replacement logic is a bit finicky, and I'm not a master of Regular expressions, unfortunately.
I will keep this ticket open because improvements would be very valuable to make this plugin more versatile.

The first example fails because, for now, the plugin expects the line containing a query to start with <!-- QueryToSerialize: ...
The second one is harder to explain. When the plugin processes a file, it first looks for all the queries it can find. Then, it removes existing query outputs, then it serializes the queries and adds the outputs. I suppose that something goes wrong during the removal phase

@dsebastien dsebastien added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants