summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-02-25 13:42:51 +0100
committerIdan Horowitz <idan.horowitz@gmail.com>2022-02-26 20:05:06 +0200
commit9902e71f99ad4a00ae77b356540df175983ec0b1 (patch)
treeb71cadb67c73ebc45aa4d148b627c28e403b22e4 /Userland
parent112642a2623eca05dd7596bc37695eb9864143fd (diff)
downloadserenity-9902e71f99ad4a00ae77b356540df175983ec0b1.zip
Utilities: Allow link checking in markdown-check to fail during visit
With a special flag, we can now invalidate the links early on.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Utilities/markdown-check.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp
index e43ec3521d..a86b492d9d 100644
--- a/Userland/Utilities/markdown-check.cpp
+++ b/Userland/Utilities/markdown-check.cpp
@@ -71,6 +71,7 @@ public:
bool has_anchor(String const& anchor) const { return m_anchors.contains(anchor); }
HashTable<String> const& anchors() const { return m_anchors; }
+ bool has_invalid_link() const { return m_has_invalid_link; }
Vector<FileLink> const& file_links() const { return m_file_links; }
private:
@@ -81,6 +82,7 @@ private:
HashTable<String> m_anchors;
Vector<FileLink> m_file_links;
+ bool m_has_invalid_link { false };
};
MarkdownLinkage MarkdownLinkage::analyze(Markdown::Document const& document)
@@ -231,6 +233,12 @@ int main(int argc, char** argv)
outln("Checking links ...");
bool any_problems = false;
for (auto const& file_item : files) {
+ if (file_item.value.has_invalid_link()) {
+ outln("File '{}' has invalid links.", file_item.key);
+ any_problems = true;
+ continue;
+ }
+
auto file_lexical_path = LexicalPath(file_item.key);
auto file_dir = file_lexical_path.dirname();
for (auto const& file_link : file_item.value.file_links()) {