entangled-cli 2.1.11__tar.gz → 2.1.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/PKG-INFO +1 -1
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/code_reader.py +4 -4
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/stitch.py +1 -1
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/document.py +3 -2
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/markdown_reader.py +6 -6
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/tangle.py +1 -1
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/text_location.py +2 -1
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/pyproject.toml +1 -1
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/.gitignore +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/LICENSE +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/README.md +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/__init__.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/__init__.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/brei.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/new.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/status.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/sync.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/tangle.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/commands/watch.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/config/__init__.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/config/language.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/config/templates.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/config/version.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/construct.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/errors/__init__.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/errors/internal.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/errors/user.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/filedb.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/hooks/__init__.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/hooks/base.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/hooks/build.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/hooks/quarto_attributes.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/hooks/shebang.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/hooks/task.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/logging.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/main.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/parsing.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/properties.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/py.typed +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/status.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/transaction.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/utility.py +0 -0
- {entangled_cli-2.1.11 → entangled_cli-2.1.12}/entangled/version.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from pathlib import Path
|
|
2
|
+
from pathlib import Path, PurePath
|
|
3
3
|
|
|
4
4
|
import mawk
|
|
5
5
|
import re
|
|
@@ -18,9 +18,9 @@ class Frame:
|
|
|
18
18
|
class CodeReader(mawk.RuleSet):
|
|
19
19
|
"""Reads an annotated code file."""
|
|
20
20
|
|
|
21
|
-
def __init__(self, path:
|
|
21
|
+
def __init__(self, path: PurePath, refs: ReferenceMap):
|
|
22
22
|
self.location = TextLocation(path, 0)
|
|
23
|
-
self.stack: list[Frame] = [Frame(ReferenceId("#root#", "", -1), "")]
|
|
23
|
+
self.stack: list[Frame] = [Frame(ReferenceId("#root#", PurePath("-"), -1), "")]
|
|
24
24
|
self.refs: ReferenceMap = refs
|
|
25
25
|
|
|
26
26
|
@property
|
|
@@ -56,7 +56,7 @@ class CodeReader(mawk.RuleSet):
|
|
|
56
56
|
|
|
57
57
|
self.stack.append(
|
|
58
58
|
Frame(
|
|
59
|
-
ReferenceId(m["ref_name"], m["source"], ref_count), m["indent"], content
|
|
59
|
+
ReferenceId(m["ref_name"], PurePath(m["source"]), ref_count), m["indent"], content
|
|
60
60
|
)
|
|
61
61
|
)
|
|
62
62
|
return []
|
|
@@ -57,7 +57,7 @@ def stitch(*, force: bool = False, show: bool = False):
|
|
|
57
57
|
logging.debug("reading `%s`", path)
|
|
58
58
|
t.update(path)
|
|
59
59
|
with open(path, "r") as f:
|
|
60
|
-
CodeReader(
|
|
60
|
+
CodeReader(path, refs).run(f.read())
|
|
61
61
|
|
|
62
62
|
for path in input_file_list:
|
|
63
63
|
t.write(path, stitch_markdown(refs, content[path]), [])
|
|
@@ -3,6 +3,7 @@ from dataclasses import dataclass, field
|
|
|
3
3
|
from collections import defaultdict
|
|
4
4
|
from functools import singledispatchmethod
|
|
5
5
|
from itertools import chain
|
|
6
|
+
from pathlib import PurePath
|
|
6
7
|
|
|
7
8
|
from .config import Language, AnnotationMethod, config
|
|
8
9
|
from .properties import Property, get_attribute
|
|
@@ -17,7 +18,7 @@ def length(iter: Iterable[Any]) -> int:
|
|
|
17
18
|
@dataclass
|
|
18
19
|
class ReferenceId:
|
|
19
20
|
name: str
|
|
20
|
-
file:
|
|
21
|
+
file: PurePath
|
|
21
22
|
ref_count: int
|
|
22
23
|
|
|
23
24
|
def __hash__(self):
|
|
@@ -71,7 +72,7 @@ class ReferenceMap:
|
|
|
71
72
|
|
|
72
73
|
return (self.map[r] for r in self.index[n])
|
|
73
74
|
|
|
74
|
-
def new_id(self, filename:
|
|
75
|
+
def new_id(self, filename: PurePath, name: str) -> ReferenceId:
|
|
75
76
|
c = length(filter(lambda r: r.file == filename, self.index[name]))
|
|
76
77
|
return ReferenceId(name, filename, c)
|
|
77
78
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
from copy import copy
|
|
3
|
-
from pathlib import Path
|
|
3
|
+
from pathlib import Path, PurePath
|
|
4
4
|
|
|
5
5
|
import re
|
|
6
6
|
import mawk
|
|
@@ -20,8 +20,8 @@ class MarkdownLexer(mawk.RuleSet):
|
|
|
20
20
|
content."""
|
|
21
21
|
def __init__(
|
|
22
22
|
self,
|
|
23
|
-
filename:
|
|
24
|
-
):
|
|
23
|
+
filename: Path
|
|
24
|
+
):
|
|
25
25
|
self.location = TextLocation(filename)
|
|
26
26
|
self.raw_content: list[RawContent] = []
|
|
27
27
|
self.inside_codeblock: bool = False
|
|
@@ -122,13 +122,13 @@ def read_markdown_file(
|
|
|
122
122
|
-> tuple[ReferenceMap, list[Content]]:
|
|
123
123
|
|
|
124
124
|
with open(path, "r") as f:
|
|
125
|
-
|
|
126
|
-
return read_markdown_string(f.read(),
|
|
125
|
+
rel_path = path.resolve().relative_to(Path.cwd())
|
|
126
|
+
return read_markdown_string(f.read(), rel_path, refs, hooks)
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
def read_markdown_string(
|
|
130
130
|
text: str,
|
|
131
|
-
path_str:
|
|
131
|
+
path_str: Path = Path("-"),
|
|
132
132
|
refs: ReferenceMap | None = None,
|
|
133
133
|
hooks: list[HookBase] | None = None) \
|
|
134
134
|
-> tuple[ReferenceMap, list[Content]]:
|
|
@@ -95,7 +95,7 @@ class AnnotatedTangler(Tangler):
|
|
|
95
95
|
if self.cb.header is not None:
|
|
96
96
|
result.append(self.cb.header)
|
|
97
97
|
result.append(
|
|
98
|
-
f"{self.cb.language.comment.open} ~/~ begin <<{self.ref.file}#{self.ref.name}>>[{count}]{self.close_comment}"
|
|
98
|
+
f"{self.cb.language.comment.open} ~/~ begin <<{self.ref.file.as_posix()}#{self.ref.name}>>[{count}]{self.close_comment}"
|
|
99
99
|
)
|
|
100
100
|
return result
|
|
101
101
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|