From e99be8707faa7b94757f1cb2384e2175510126fd Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Mon, 5 Jan 2026 10:03:46 +0000 Subject: [PATCH 1/2] implement tag --- pyproject.toml | 2 +- test/test_markup.py | 6 ++++++ webtools/__init__.py | 2 +- webtools/markup.py | 13 ++++++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ea95484..2e1d604 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "website-build-tools" -version = "0.1.11" +version = "0.1.12" description = "tools for building websites, used by defelement.org and quadraturerules.org" readme = "README.md" requires-python = ">=3.8.0" diff --git a/test/test_markup.py b/test/test_markup.py index 5ee3eb0..322b979 100644 --- a/test/test_markup.py +++ b/test/test_markup.py @@ -11,3 +11,9 @@ def test_code_highlight_cpp(): assert "
    " in markup( "```python\nfor i in range(10):\n print(i)\n```\n", ) + + +def test_nomd(): + assert "[A](B)" not in markup("[A](B)[C](D)[E](F)") + assert "[C](D)" in markup("[A](B)[C](D)[E](F)") + assert "[E](F)" not in markup("[A](B)[C](D)[E](F)") diff --git a/webtools/__init__.py b/webtools/__init__.py index 95e3d21..7feec0c 100644 --- a/webtools/__init__.py +++ b/webtools/__init__.py @@ -1,3 +1,3 @@ """Website building tools.""" -__version__ = "0.1.11" +__version__ = "0.1.12" diff --git a/webtools/markup.py b/webtools/markup.py index d941185..5b97ff1 100644 --- a/webtools/markup.py +++ b/webtools/markup.py @@ -358,6 +358,13 @@ def markup(content: str, root_dir: str = "") -> str: content = preprocess(content) content = content.replace("\\vec", "\\mathbf") + nomd = [] + while "" in content: + before, after = content.split("", 1) + inner, after = after.split("", 1) + content = f"{before}{after}" + nomd.append(inner) + out = "" popen = False ulopen = False @@ -456,7 +463,11 @@ def markup(content: str, root_dir: str = "") -> str: ) out += "" - return insert_dates(out) + out = insert_dates(out) + + for i, t in enumerate(nomd): + out = out.replace(f"", t) + return out def code_include(matches: typing.Match[str]) -> str: From 017ec6d5d52b19ec1d34cce253eee7cc5efb3a62 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Mon, 5 Jan 2026 10:06:33 +0000 Subject: [PATCH 2/2] mypy --- pyproject.toml | 2 +- webtools/markup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2e1d604..2b5e157 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "website-build-tools" version = "0.1.12" description = "tools for building websites, used by defelement.org and quadraturerules.org" readme = "README.md" -requires-python = ">=3.8.0" +requires-python = ">=3.10.0" license = { file = "LICENSE" } authors = [ { name = "Matthew Scroggs", email = "defelement@mscroggs.co.uk" } diff --git a/webtools/markup.py b/webtools/markup.py index 5b97ff1..0415581 100644 --- a/webtools/markup.py +++ b/webtools/markup.py @@ -358,7 +358,7 @@ def markup(content: str, root_dir: str = "") -> str: content = preprocess(content) content = content.replace("\\vec", "\\mathbf") - nomd = [] + nomd: typing.List[str] = [] while "" in content: before, after = content.split("", 1) inner, after = after.split("", 1)