From a6f4583445295f6f699a5dc1e1c24a04e81af5c6 Mon Sep 17 00:00:00 2001
From: FZill <florian.zill@ufz.de>
Date: Tue, 17 Dec 2024 11:14:14 +0100
Subject: [PATCH] [scripts] fix refs

---
 scripts/doc/linked-xml-file.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/scripts/doc/linked-xml-file.py b/scripts/doc/linked-xml-file.py
index bef1083fc24..26d1db2fe45 100755
--- a/scripts/doc/linked-xml-file.py
+++ b/scripts/doc/linked-xml-file.py
@@ -54,12 +54,12 @@ def format_if_documented(
 def replace_prefix(tag: str, typetag: str) -> str:
     "Replaces prefix to match the different docs structure for some tags."
 
-    type_prefix = "" if typetag is None else typetag + "."
-    if (prefix := "prj.processes.process.constitutive_relation.") in tag:
-        tag = tag.replace(prefix, "material.solid.constitutive_relation." + type_prefix)
+    type_prefix = "" if typetag is None else typetag + "__"
+    if (prefix := "prj__processes__process__constitutive_relation__") in tag:
+        tag = tag.replace(prefix, "material.solid.constitutive_relation__" + type_prefix)
 
-    for prefix_end in ["phases.phase.", "phases.", ""]:
-        if (prefix := "prj.media.medium." + prefix_end) in tag:
+    for prefix_end in ["phases__phase__", "phases__", ""]:
+        if (prefix := "prj__media__medium__" + prefix_end) in tag:
             if "property" not in tag:  # excludes parent tags
                 return tag
             tag = tag.replace(prefix, "")
@@ -70,7 +70,7 @@ def replace_prefix(tag: str, typetag: str) -> str:
 def get_tagpath(
     page_name: str, typetag: str, typetag_levels_up: int
 ) -> tuple[str, str, bool]:
-    tag_path = replace_prefix(page_name.replace("__", "."), typetag)
+    tag_path = replace_prefix(page_name, typetag).replace("__", ".")
     is_doc = (tag_path, True) in documented_tags_attrs
     if not is_doc and typetag:
         tag_path_parts = tag_path.split(".")
@@ -80,6 +80,8 @@ def get_tagpath(
         if is_doc:
             tag_path = tagpath_new
             page_name = tag_path.replace(".", "__")
+    else:
+        page_name = tag_path.replace(".", "__")
 
     return tag_path, page_name, is_doc
 
@@ -214,7 +216,6 @@ with open(
             method = line[6]
             is_tag = method.find("Attribute") == -1
             documented_tags_attrs.add((tagpath, is_tag))
-            # print_(tagpath, is_tag)
 
 
 def has_prj_file_in_subdirs(rel_dirpath: str) -> bool:
-- 
GitLab