From fd890124c06b2824fd993991c68922693aa02549 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Mon, 18 Mar 2024 14:05:48 -0400 Subject: [PATCH] Fix escaping of special characters on index page --- gen_index.py | 3 ++- src/functions-reference/functions_index.qmd | 10 +++++----- src/html-index.lua | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gen_index.py b/gen_index.py index 9b174588a..046309004 100644 --- a/gen_index.py +++ b/gen_index.py @@ -52,7 +52,8 @@ def write_index_page(index): letter = start f.write(f"\n## {start.upper()}\n") - f.write(f"**{name}**:\n\n") + escaped_name = name.replace("\\", "\\\\").replace("*", "\\*") + f.write(f"**{escaped_name}**:\n\n") for link, entry in sorted(links): f.write(f" - [{entry}]({link})\n") f.write("\n\n") diff --git a/src/functions-reference/functions_index.qmd b/src/functions-reference/functions_index.qmd index 01d3f6c8d..05c4e7e98 100644 --- a/src/functions-reference/functions_index.qmd +++ b/src/functions-reference/functions_index.qmd @@ -2464,7 +2464,7 @@ pagetitle: Alphabetical Index - [`(row_vector x) : vector`](matrix_operations.qmd#index-entry-e3432686a771bad98175ab4a594d8156ab915492) -**operator***: +**operator\***: - [`(complex x, complex y) : complex`](complex-valued_basic_functions.qmd#index-entry-e3a6425a4fd372a6a28b66eb58c06245046f87ae) - [`(complex_vector x, complex y) : complex_vector`](complex_matrix_operations.qmd#index-entry-23a93f16e6035cc32b84ecf97c32845e9008702c) @@ -2493,7 +2493,7 @@ pagetitle: Alphabetical Index - [`(real x, real y) : real`](real-valued_basic_functions.qmd#index-entry-08f55cee893fdef254457be66b7a82c1d942ad0e) -**operator*=**: +**operator\*=**: - [`(complex x, complex y) : void`](complex-valued_basic_functions.qmd#index-entry-0c45a357fc47d9ccf6a7fb7780ee7d1ada6cc2bd) - [`(T x, U y) : void`](compound_arithmetic_and_assignment.qmd#index-entry-518f24c806ec47af7c7aa48506a1cd57ef3676df) @@ -2578,7 +2578,7 @@ pagetitle: Alphabetical Index - [`(T x, U y) : void`](compound_arithmetic_and_assignment.qmd#index-entry-e3beea1794e1e8704ae6177a2392b78fccebd4d4) -**operator.***: +**operator.\***: - [`(complex_row_vector x, complex_row_vector y) : complex_row_vector`](complex_matrix_operations.qmd#index-entry-8225aa3a59b24f94b5efa4533b49050ef65e64ca) - [`(complex_matrix x, complex_matrix y) : complex_matrix`](complex_matrix_operations.qmd#index-entry-8eb7c34b5da648cda9b6f992d4218d023c05d1da) @@ -2588,7 +2588,7 @@ pagetitle: Alphabetical Index - [`(vector x, vector y) : vector`](matrix_operations.qmd#index-entry-f6b9c926ae8c20a429454fbfd788a05c447ca21f) -**operator.*=**: +**operator.\*=**: - [`(T x, U y) : void`](compound_arithmetic_and_assignment.qmd#index-entry-549243a6af6a91c078444182753a8e8f435862e3) @@ -2701,7 +2701,7 @@ pagetitle: Alphabetical Index - [`(int x, int y) : int`](real-valued_basic_functions.qmd#index-entry-9d2656ef1df47087d225d2cfd011938c49677d09) -**operator\**: +**operator\\**: - [`(matrix A, matrix B) : matrix`](matrix_operations.qmd#index-entry-1a08f375cfc4067e97bfed98fae8490e8b6f0698) - [`(matrix A, vector b) : vector`](matrix_operations.qmd#index-entry-fc754907294117fa562e6fcaf1b8afcf0d2efabd) diff --git a/src/html-index.lua b/src/html-index.lua index 20a34c64c..14d257d53 100644 --- a/src/html-index.lua +++ b/src/html-index.lua @@ -5,7 +5,7 @@ -- to create a clickable index of all the functions in the documentation function extractIndexEntry(elementText) - if elementText:find(";-->$") ~= nil then + if elementText:find("%; %-%-%>$") ~= nil then return "index-entry-" .. tostring(pandoc.sha1(elementText)) end return nil