Remove unused documents.traces_for_lesson, overlay.wrap_rule_body and HOUSE_WIDTH; a test fails on any new dead function. done / next: fix 4 (down --until time)
This commit is contained in:
1 parent
b114b29221
commit
e34dabfdb0
3 files changed
+35
-29
No files matched your search
@@ -22,10 +22,6 @@ def check_rule_text(text, rid=None):
|
||||
return r
|
||||
|
||||
|
||||
def traces_for_lesson(lesson_id):
|
||||
return [] # the per-lesson trace regime is retired; provenance lives on the learning record
|
||||
|
||||
|
||||
def trace_lines(kind, entry_id):
|
||||
return []
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ from . import paths
|
||||
# games must not load more text. A learning round still may not grow the book without shortening.
|
||||
MAX_LINES = 200
|
||||
MAX_CHARS = 12000
|
||||
HOUSE_WIDTH = 100
|
||||
KINDS = ("rule", "verifier", "recipe")
|
||||
ID_TAIL = re.compile(r"\s*\{#([A-Za-z0-9][A-Za-z0-9_-]*)\}\s*$")
|
||||
NUM = re.compile(r"^\d+\.\s+")
|
||||
@@ -98,30 +97,6 @@ def rule_text(r):
|
||||
return "## %s\n\n%s\n" % (r["title"], r["body"])
|
||||
|
||||
|
||||
def wrap_rule_body(body, width=HOUSE_WIDTH):
|
||||
"""Re-wrap rule prose to the house width, preserving paragraphs, bullets and code fences."""
|
||||
import textwrap
|
||||
out, in_fence = [], False
|
||||
for line in (body or "").split("\n"):
|
||||
if line.strip().startswith("```"):
|
||||
in_fence = not in_fence
|
||||
out.append(line)
|
||||
continue
|
||||
if in_fence or not line.strip():
|
||||
out.append(line)
|
||||
continue
|
||||
stripped = line.lstrip()
|
||||
indent = ""
|
||||
if stripped.startswith(("- ", "* ")):
|
||||
indent = " "
|
||||
elif re.match(r"^\d+\.\s", stripped):
|
||||
indent = " "
|
||||
wrapped = textwrap.wrap(line, width=width, subsequent_indent=indent,
|
||||
break_long_words=False, break_on_hyphens=False)
|
||||
out.extend(wrapped or [""])
|
||||
return "\n".join(out).strip("\n")
|
||||
|
||||
|
||||
def _read(p):
|
||||
with open(p, encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
Reference in new issue
Block a user