diff --git a/pyproject.toml b/pyproject.toml index ea95484..2b5e157 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [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" +requires-python = ">=3.10.0" license = { file = "LICENSE" } authors = [ { name = "Matthew Scroggs", email = "defelement@mscroggs.co.uk" } 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..0415581 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: typing.List[str] = [] + 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: