From d518efef5c53b5141209fdca00c9776911679750 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Wed, 4 Sep 2024 20:55:58 +0200 Subject: [PATCH] #1717 backlinks: don't detect checkboxes as part of links Signed-off-by: Patrizio Bekerle --- CHANGELOG.md | 5 +++++ src/entities/note.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61922d9475..1f683f9d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # QOwnNotes Changelog +## 24.9.2 +- The **backlink widget** link detection was improved + (for [#1717](https://github.com/pbek/QOwnNotes/issues/1717)) + - In checkbox lists the checkboxes will now not be detected as part of the links + ## 24.9.1 - The **backlink widget** in the navigation panel now also shows the links in the notes to the current note (for [#1717](https://github.com/pbek/QOwnNotes/issues/1717)) diff --git a/src/entities/note.cpp b/src/entities/note.cpp index ab6aeab10d..cb9879306f 100644 --- a/src/entities/note.cpp +++ b/src/entities/note.cpp @@ -3185,7 +3185,7 @@ QHash> Note::findReverseLinkNotes() { // search legacy links addTextToBacklinkNoteHashIfFound(note, QStringLiteral("<") + noteUrl + QStringLiteral(">")); addTextToBacklinkNoteHashIfFound( - note, QRegularExpression(QStringLiteral(R"(\[(.+)\]\()") + + note, QRegularExpression(QStringLiteral(R"(\[([^\[\]]+?)\]\()") + QRegularExpression::escape(noteUrl) + QStringLiteral(R"(\))"))); // search for legacy links ending with "@" @@ -3206,11 +3206,11 @@ QHash> Note::findReverseLinkNotes() { addTextToBacklinkNoteHashIfFound( note, QStringLiteral("<") + relativeFilePath + QStringLiteral(">")); addTextToBacklinkNoteHashIfFound( - note, QRegularExpression(QStringLiteral(R"(\[(.+)\]\()") + + note, QRegularExpression(QStringLiteral(R"(\[([^\[\]]+?)\]\()") + QRegularExpression::escape(relativeFilePath) + - QStringLiteral(R"(\))"))); + QStringLiteral(R"(\))"), QRegularExpression::MultilineOption)); addTextToBacklinkNoteHashIfFound( - note, QRegularExpression(QStringLiteral(R"(\[(.+)\]\()") + + note, QRegularExpression(QStringLiteral(R"(\[([^\[\]]+?)\]\()") + QRegularExpression::escape(relativeFilePath) + QStringLiteral(R"(#.+\))"))); }