Skip to content

Commit 3fb1f7d

Browse files
committed
Add a docstring and tweak label canonicalize
1 parent a24cbf8 commit 3fb1f7d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

mathics/doc/latex_doc.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ def get_latex_escape_char(text):
325325

326326

327327
def latex_label_safe(s: str) -> str:
328-
s = s.replace("\\$", "")
329-
s = s.replace("$", "")
328+
s = s.replace("\\$", "slash-dollar-")
329+
s = s.replace("$", "dollar-")
330330
return s
331331

332332

@@ -533,6 +533,17 @@ def __str__(self):
533533
return self.test
534534

535535
def latex(self, doc_data: dict) -> str:
536+
"""
537+
Produces the LaTeX-formatted fragment that corresponds the
538+
test sequence and results for a single Builtin that has been run.
539+
540+
The key for doc_data is the part/chapter/section{/subsection} test number
541+
and the value contains Result object data turned into a dictionary.
542+
543+
In partuclar, each test in the test sequence includes the, input test,
544+
the result produced and any additional error output.
545+
The LaTeX-formatted string fragment is returned.
546+
"""
536547
if self.key is None:
537548
return ""
538549
output_for_key = doc_data.get(self.key, None)

0 commit comments

Comments
 (0)