Skip to content

Commit

Permalink
add special classes attribute in the quarto_attributes hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jhidding committed Sep 16, 2024
1 parent c8bc681 commit af2e508
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ if __name__ == "__main__":
```
~~~

The `id` attribute is reserved for the code's identifier (normally indicated with `#`) and the `classes` attribute can be used to indicate a list of classes in addition to the language class already given.

## Brei
Entangled has a small build engine (similar to GNU Make) embedded, called Brei. You may give it a list of tasks (specified in TOML) that may depend on one another. Brei will run these when dependencies are newer than the target. Execution is lazy and in parallel. Brei supports:

Expand Down
6 changes: 5 additions & 1 deletion entangled/hooks/quarto_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from itertools import takewhile
import yaml

from ..properties import Attribute, Id
from ..properties import Attribute, Class, Id
from ..document import ReferenceId, ReferenceMap, CodeBlock
from .base import HookBase
from ..logging import logger
Expand Down Expand Up @@ -37,6 +37,10 @@ def on_read(self, code: CodeBlock):

if "id" in attrs:
code.properties.append(Id(attrs["id"]))

if "classes" in attrs:
code.properties.extend(Class(c) for c in attrs["classes"])

code.properties.extend(Attribute(k, v) for k, v in attrs.items())

log.debug("quarto attributes: %s", attrs)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "entangled-cli"
version = "2.1.4"
version = "2.1.5"
description = "Literate Programming toolbox"
repository = "https://github.com/entangled/entangled.py"
homepage = "https://entangled.github.io/"
Expand Down

0 comments on commit af2e508

Please sign in to comment.