From 9d296c8078f998ff5de76d74b92ac907ff4cc180 Mon Sep 17 00:00:00 2001 From: ada Date: Fri, 22 Aug 2025 17:32:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C=20?= =?UTF-8?q?=D1=83=D1=81=D1=82=D0=B0=D1=80=D0=B5=D0=B2=D1=88=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B3=D1=80=D0=B0=D1=84=D0=B0?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=82=D0=BE=D0=BA:=20=5Fpages/graph?= =?UTF-8?q?.md=20=D0=B8=20=5Fplugins/note=5Fgraph.rb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _pages/graph.md | 34 ---------------------------------- _plugins/note_graph.rb | 39 --------------------------------------- 2 files changed, 73 deletions(-) delete mode 100644 _pages/graph.md delete mode 100644 _plugins/note_graph.rb diff --git a/_pages/graph.md b/_pages/graph.md deleted file mode 100644 index 4278467..0000000 --- a/_pages/graph.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: single -title: "Граф заметок" -permalink: /graph/ ---- - -
- - - - - -
\ No newline at end of file diff --git a/_plugins/note_graph.rb b/_plugins/note_graph.rb deleted file mode 100644 index 61d54b1..0000000 --- a/_plugins/note_graph.rb +++ /dev/null @@ -1,39 +0,0 @@ -# _plugins/note_graph.rb -require "json" -require "fileutils" - -module NoteGraph - class Generator < Jekyll::Generator - safe true - priority :low - - def generate(site) - notes = (site.collections["notes"]&.docs) || [] - - nodes = [] - links = [] - - notes.each do |doc| - title = (doc.data["title"] || doc.basename_without_ext).to_s - nodes << { id: title, url: doc.url } - - # [[Note]] / [[Note|alias]] / [[Note#Heading]] / [[Note#Heading|alias]] - doc.content.to_s.scan(/\[\[([^\]|#]+)(?:#[^\]]*)?(?:\|[^\]]+)?\]\]/).flatten.each do |raw| - target = raw.strip - links << { source: title, target: target } - end - end - - graph = { nodes: nodes.uniq, links: links } - site.config["note_graph_json"] = JSON.pretty_generate(graph) - end - end -end - -# Пишем файл ПОСЛЕ сборки сайта -Jekyll::Hooks.register :site, :post_write do |site| - data = site.config["note_graph_json"] || "{}" - out_path = File.join(site.dest, "assets", "js", "graph-data.json") - FileUtils.mkdir_p(File.dirname(out_path)) - File.write(out_path, data) -end