diff --git a/pyproject.toml b/pyproject.toml index db4a726..92c6411 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "website-build-tools" -version = "0.1.13" +version = "0.1.14" description = "tools for building websites, used by defelement.org and quadraturerules.org" readme = "README.md" requires-python = ">=3.10.0" diff --git a/webtools/__init__.py b/webtools/__init__.py index f578004..7fec3b7 100644 --- a/webtools/__init__.py +++ b/webtools/__init__.py @@ -1,3 +1,3 @@ """Website building tools.""" -__version__ = "0.1.13" +__version__ = "0.1.14" diff --git a/webtools/markup.py b/webtools/markup.py index a4ef822..f8a80bc 100644 --- a/webtools/markup.py +++ b/webtools/markup.py @@ -316,15 +316,15 @@ def insert_links(txt: str, root_dir: str = "") -> str: Returns: Text with links """ - txt = re.sub(r"\(\/([^\)]+)\.md\)", r"(\1.html)", txt) - txt = re.sub(r"\(\/([^\)]+)\.md#([^\)]+)\)", r"(\1.html#\2)", txt) + txt = re.sub(r"\(\/([^\(\)]+)\.md\)", r"(\1.html)", txt) + txt = re.sub(r"\(\/([^\(\)]+)\.md#([^\)]+)\)", r"(\1.html#\2)", txt) if root_dir == "": - txt = re.sub(r"\(([^\)]+)\.md\)", r"(/\1.html)", txt) - txt = re.sub(r"\(([^\)]+)\.md#([^\)]+)\)", r"(/\1.html#\2)", txt) + txt = re.sub(r"\(([^\(\)]+)\.md\)", r"(/\1.html)", txt) + txt = re.sub(r"\(([^\(\)]+)\.md#([^\)]+)\)", r"(/\1.html#\2)", txt) else: - txt = re.sub(r"\(([^\)]+)\.md\)", rf"(/{root_dir}/\1.html)", txt) - txt = re.sub(r"\(([^\)]+)\.md#([^\)]+)\)", rf"(/{root_dir}/\1.html#\2)", txt) - txt = re.sub(r"\[([^\]]+)\]\(([^\)]+)\)", r"\1", txt) + txt = re.sub(r"\(([^\(\)]+)\.md\)", rf"(/{root_dir}/\1.html)", txt) + txt = re.sub(r"\(([^\(\)]+)\.md#([^\)]+)\)", rf"(/{root_dir}/\1.html#\2)", txt) + txt = re.sub(r"\[([^\[\]]+)\]\(([^\(\)]+)\)", r"\1", txt) return txt