Skip to content

Commit

Permalink
removing blanks from url (#790)
Browse files Browse the repository at this point in the history
The same as in Mathics3/mathics-django#190

This single line PR is a proposal about how to handle long urls in
docstrings. With this patch

```
<url>:NetworkX:
     https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/\
      generated/networkx.algorithms.tree.mst.minimum_spanning_edges.html
</url>
```

the <url></url> tag is processed as
```
<a href=https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/generated/networkx.algorithms.tree.mst.minimum_spanning_edges.html>NetworkX</a>
```
  • Loading branch information
mmatera authored Feb 16, 2023
1 parent ab5c2f6 commit 9c068b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mathics/doc/latex_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ def repl_quotation(match):
def repl_hypertext(match) -> str:
tag = match.group("tag")
content = match.group("content")
#
# Sometimes it happens that the URL does not
# fit in 80 characters. Then, to avoid that
# flake8 complains, and also to have a
# nice and readable ASCII representation,
# we would like to split the URL in several,
# lines, having indentation spaces.
#
# The following line removes these extra
# characters, which would spoil the URL,
# producing a single line, space-free string.
#
content = content.replace(" ", "").replace("\n", "")
if tag == "em":
return r"\emph{%s}" % content
elif tag == "url":
Expand Down

0 comments on commit 9c068b4

Please sign in to comment.