entangled-cli 2.1.11__tar.gz → 2.1.13__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.
Files changed (43) hide show
  1. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/PKG-INFO +1 -1
  2. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/code_reader.py +4 -4
  3. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/stitch.py +1 -1
  4. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/config/__init__.py +1 -1
  5. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/config/templates.py +7 -0
  6. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/document.py +3 -2
  7. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/hooks/shebang.py +1 -1
  8. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/markdown_reader.py +6 -6
  9. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/tangle.py +1 -1
  10. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/text_location.py +2 -1
  11. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/pyproject.toml +1 -1
  12. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/.gitignore +0 -0
  13. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/LICENSE +0 -0
  14. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/README.md +0 -0
  15. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/__init__.py +0 -0
  16. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/__init__.py +0 -0
  17. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/brei.py +0 -0
  18. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/new.py +0 -0
  19. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/status.py +0 -0
  20. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/sync.py +0 -0
  21. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/tangle.py +0 -0
  22. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/commands/watch.py +0 -0
  23. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/config/language.py +0 -0
  24. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/config/version.py +0 -0
  25. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/construct.py +0 -0
  26. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/errors/__init__.py +0 -0
  27. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/errors/internal.py +0 -0
  28. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/errors/user.py +0 -0
  29. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/filedb.py +0 -0
  30. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/hooks/__init__.py +0 -0
  31. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/hooks/base.py +0 -0
  32. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/hooks/build.py +0 -0
  33. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/hooks/quarto_attributes.py +0 -0
  34. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/hooks/task.py +0 -0
  35. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/logging.py +0 -0
  36. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/main.py +0 -0
  37. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/parsing.py +0 -0
  38. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/properties.py +0 -0
  39. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/py.typed +0 -0
  40. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/status.py +0 -0
  41. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/transaction.py +0 -0
  42. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/utility.py +0 -0
  43. {entangled_cli-2.1.11 → entangled_cli-2.1.13}/entangled/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entangled-cli
3
- Version: 2.1.11
3
+ Version: 2.1.13
4
4
  Summary: Literate Programming toolbox
5
5
  Project-URL: Homepage, https://entangled.github.io/
6
6
  Project-URL: Repository, https://github.com/entangled/entangled.py
@@ -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: str, refs: ReferenceMap):
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(str(path), refs).run(f.read())
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]), [])
@@ -83,7 +83,7 @@ class Config(threading.local):
83
83
  languages: list[Language] = field(default_factory=list)
84
84
  markers: Markers = field(default_factory=lambda: copy(markers))
85
85
  watch_list: list[str] = field(default_factory=lambda: ["**/*.md"])
86
- ignore_list: list[str] = field(default_factory=lambda: ["README.md"])
86
+ ignore_list: list[str] = field(default_factory=list)
87
87
  annotation_format: Optional[str] = None
88
88
  annotation: AnnotationMethod = AnnotationMethod.STANDARD
89
89
  use_line_directives: bool = False
@@ -32,5 +32,12 @@ templates: list[Template] = [
32
32
  "gh:entangled/template-pandoc",
33
33
  "pandoc",
34
34
  "Supports HTML and PDF output, numbered equations and citations."
35
+ ),
36
+ Template(
37
+ "one-pager",
38
+ "One-page README",
39
+ "gh:entangled/template-one-pager",
40
+ "none",
41
+ "Everything in a single README, to be rendered on Github/Gitlab/etc."
35
42
  )
36
43
  ]
@@ -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: str
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: str, name: str) -> ReferenceId:
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
 
@@ -5,6 +5,6 @@ from .base import HookBase
5
5
  class Hook(HookBase):
6
6
  def on_read(self, code: CodeBlock):
7
7
  lines = code.source.splitlines()
8
- if lines[0].startswith("#!"):
8
+ if lines and lines[0].startswith("#!"):
9
9
  code.header = lines[0]
10
10
  code.source = "\n".join(lines[1:])
@@ -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: str
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
- path_str = str(path.resolve().relative_to(Path.cwd()))
126
- return read_markdown_string(f.read(), path_str, refs, hooks)
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: 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
 
@@ -1,9 +1,10 @@
1
1
  from dataclasses import dataclass
2
+ from pathlib import PurePath
2
3
 
3
4
 
4
5
  @dataclass
5
6
  class TextLocation:
6
- filename: str
7
+ filename: PurePath
7
8
  line_number: int = 0
8
9
 
9
10
  def __str__(self):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "entangled-cli"
3
- version = "2.1.11"
3
+ version = "2.1.13"
4
4
  description = "Literate Programming toolbox"
5
5
  authors = [{ name = "Johan Hidding", email = "j.hidding@esciencecenter.nl" }]
6
6
  requires-python = "~=3.11"
File without changes
File without changes