From b6193265d68b90755d57938c2ba1895841cf4b36 Mon Sep 17 00:00:00 2001 From: Princeton Ferro Date: Sat, 24 Sep 2022 18:07:27 -0400 Subject: [PATCH] fix regex for links in comments (#268) Closes #263 --- src/documentation/doccomment.vala | 2 +- src/documentation/girdocumentation.vala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/documentation/doccomment.vala b/src/documentation/doccomment.vala index 53bc2520..613cccaf 100644 --- a/src/documentation/doccomment.vala +++ b/src/documentation/doccomment.vala @@ -129,7 +129,7 @@ class Vls.DocComment { body = /{{{(\w+)?(.*?)}}}/s.replace (body, body.length, 0, "```\\1\\2```"); // images and links - body = /(\[\[|{{)([~:\/\\\w-.]+)(\|(.*?))?(\]\]|}})/ + body = /(\[\[|{{)([~:\/\\\w\-.]+)(\|(.*?))?(\]\]|}})/ .replace_eval (body, body.length, 0, 0, (match_info, result) => { string type = match_info.fetch (1) ?? ""; string href = match_info.fetch (2) ?? ""; diff --git a/src/documentation/girdocumentation.vala b/src/documentation/girdocumentation.vala index 93e0aaeb..36e8b7d7 100644 --- a/src/documentation/girdocumentation.vala +++ b/src/documentation/girdocumentation.vala @@ -356,7 +356,7 @@ class Vls.GirDocumentation { if (gtkdoc_dir != null) { // substitute image URLs // substitute relative paths in GIR comments for absolute paths to GTK-Doc resources - comment_data = /!\[(.*?)\]\(([~:\/\\\w-.]+)\)/ + comment_data = /!\[(.*?)\]\(([~:\/\\\w\-.]+)\)/ .replace_eval (comment_data, comment_data.length, 0, 0, (match_info, result) => { string link_label = match_info.fetch (1) ?? ""; string link_href = match_info.fetch (2) ?? ""; @@ -386,7 +386,7 @@ class Vls.GirDocumentation { }); // now, substitute references to sections - comment_data = /\[(.*?)\]\[([\w-\s]+)\]/ + comment_data = /\[(.*?)\]\[([\w\-\s]+)\]/ .replace_eval (comment_data, comment_data.length, 0, 0, (match_info, result) => { string link_label = match_info.fetch (1) ?? ""; string section = match_info.fetch (2) ?? "";