entangled / entangled.py

Python port of Entangled
Apache License 2.0
33 stars 7 forks source link

Exceptions on malformed Quarto Attributes #55

Open loris-intergalactique opened 4 weeks ago

loris-intergalactique commented 4 weeks ago

Hello,

I started using Entangled.py, thanks a lot for maintaining it! I have tons of project ideas using it.

While setting it up I had issues with these two types of code samples:

#|file:yoo.py

print("hey!")
#|file:yoo.py
#|id:me

print("hey!")

I checked the code and it looks like the strings produced are considered strings by PyYAML and the attrs variable is assumed to be a list in entangled/hooks/quarto_attributes.py. PyYAML behaves correctly if there is a space after the colon.

I might be wrong because I do not know the code base enough to give suggestions, but just in case it can help: I suggest adding a check on the type of attrs and warning the user that their quarto attributes are malformed if it is not a dict. And maybe replace the last condition if "id" in attrs by if "id" in attrs.keys()