From e18f45dba54af728318a6063b3e9f7cdc99278b5 Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Sun, 13 Apr 2025 00:15:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BSVG=E7=9A=84ToolTips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AstConv/AstImport.fs | 2 ++ AstConv/HtmlStruct.fs | 4 ++-- WsNovelParser/astprint.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AstConv/AstImport.fs b/AstConv/AstImport.fs index 0267142..cfa7da4 100644 --- a/AstConv/AstImport.fs +++ b/AstConv/AstImport.fs @@ -111,6 +111,8 @@ open System.Linq override this.members(): AstObject list = objs override this.address (): string = bind.GetAttribute "address" + override this.filePath (): string = + bind.GetAttribute "file-path" static member GenerateFromChildSibling(child: XmlNode): SliceChildType list = match child with diff --git a/AstConv/HtmlStruct.fs b/AstConv/HtmlStruct.fs index 77f8a07..7385239 100644 --- a/AstConv/HtmlStruct.fs +++ b/AstConv/HtmlStruct.fs @@ -951,11 +951,11 @@ open System.IO // 故事线声明 let story_decl = story_lines|> List.map(fun story -> - $"""node_{story.address()}[label="{story.name()}" shape="cds"] + $"""node_{story.address()}[label="{story.name()}" shape="cds" tooltip="{story.filePath()}"] """)|> List.reduce(fun a b -> a + b) // 情节节点声明 let points_decl = fragment_defs |> List.map(fun (_, node_def) -> - $"""node_{node_def.address()}[label="{node_def.name()}" shape="rect"] + $"""node_{node_def.address()}[label="{node_def.name()}" shape="rect" tooltip="{node_def.filePath()}"] """)|> List.reduce(fun a b -> a + b) // 所有的节点声明 let nodes_decl = story_decl + points_decl diff --git a/WsNovelParser/astprint.cpp b/WsNovelParser/astprint.cpp index 615466f..a857033 100644 --- a/WsNovelParser/astprint.cpp +++ b/WsNovelParser/astprint.cpp @@ -86,6 +86,7 @@ bool printer::AstGenerate::visit(std::shared_ptr s dom_slice.setAttribute("name", slice_node->name()); dom_slice.setAttribute("address", (qulonglong) slice_node.get()); + dom_slice.setAttribute("file-path", src_root.relativeFilePath(slice_node->filePath())); append_tokens(dom_slice, slice_node); }break;