From 9c94647f9428c3154785cbf210fe48dae4a45c6a Mon Sep 17 00:00:00 2001 From: Thomas Weise Date: Thu, 2 Jun 2022 15:04:02 +0800 Subject: [PATCH] improved README.md conversation for Pypi --- moptipy/version.py | 2 +- setup.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/moptipy/version.py b/moptipy/version.py index 591c03b9e..b459ef9ee 100644 --- a/moptipy/version.py +++ b/moptipy/version.py @@ -1,4 +1,4 @@ """An internal file with the version of the moptipy package.""" from typing import Final -__version__: Final[str] = "0.8.11" +__version__: Final[str] = "0.8.12" diff --git a/setup.py b/setup.py index e93367f45..29ee66b0c 100644 --- a/setup.py +++ b/setup.py @@ -11,15 +11,15 @@ "rt", encoding='utf-8-sig') as reader: old_lines = reader.readlines() -# It seems that the myst parser now again drops the numerical prefixes of -# links, i.e., it tags `## 1.2. Hello` with id `hello` instead of -# `12-hello`. This means that we need to fix all references following the -# pattern `[xxx](#12-hello)` to `[xxx](#hello)`. We do this with a regular -# expression `regex_search`. +# It seems that the markdown parser does not auto-generate anchors. This means +# that we need to fix all references following the pattern `[xxx](#12-hello)` +# to `[xxx]({docu_url#hello)`, where `docu_url` is the url of our +# documentation. We do this with a regular expression `regex_search`. new_lines = [] in_code: bool = False # we only process non-code lines # detects strings of the form [xyz](#123-bla) and gives \1=xyz and \2=bla regex_search = re.compile("(\\[.+?])\\(#\\d+-(.+?)\\)") +regex_repl: str = "\\1(https://thomasweise.github.io/moptipy/index.html#\\2)" license_old: str = "https://github.com/thomasWeise/moptipy/blob/main/LICENSE" license_new: str = "https://thomasweise.github.io/moptipy/LICENSE.html" for line in old_lines: @@ -31,7 +31,7 @@ in_code = True # toggle to code else: # fix all internal urls # replace links of the form "#12-bla" to "#bla" - line = re.sub(regex_search, "\\1(#\\2)", line) + line = re.sub(regex_search, regex_repl, line) line = line.replace(license_old, license_new) new_lines.append(line)