@@ -60,29 +60,52 @@ def output_items(self, label, items, url_callback):
60
60
if bibdata_output :
61
61
print (bibdata_output )
62
62
63
- # Output findings.
63
+ # Separate matches into "dashboard"- and "panels"-groups.
64
+ dashboard_matches = []
65
+ panel_matches = []
64
66
if "matches" in item .meta :
65
67
# print(' ', self.format_where(item))
66
- seen = {}
67
68
for match in item .meta .matches :
68
69
panel = self .get_panel (match )
69
- if panel is not None and panel .id not in seen :
70
- seen [panel .id ] = True
71
- print ()
70
+ if panel is not None :
71
+ panel_matches .append ((match , panel ))
72
+ else :
73
+ dashboard_matches .append (match )
72
74
73
- title = panel .title
74
- subsection = f"Panel »{ title } «"
75
- print (_ss (subsection ))
76
- print ("-" * len (subsection ))
77
-
78
- print (self .get_bibdata_panel (panel , url ))
79
- print (" Matches" )
80
- match = "- {path}: {value}" .format (path = _k (match .full_path ), value = _m (str (match .value ).strip ()))
81
- print (textwrap .indent (match , " " * 14 ))
75
+ # Output dashboard matches.
76
+ print ()
77
+ subsection = f"Global"
78
+ print (_ss (subsection ))
79
+ print ("-" * len (subsection ))
80
+ for match in dashboard_matches :
81
+ match_text = f"- { self .format_match (match )} "
82
+ print (match_text )
83
+
84
+ # Output panel bibdata with matches.
85
+ seen = {}
86
+ for match , panel in panel_matches :
87
+ if panel .id not in seen :
88
+ seen [panel .id ] = True
89
+ print ()
90
+
91
+ title = panel .title
92
+ subsection = f"Panel »{ title } «"
93
+ print (_ss (subsection ))
94
+ print ("-" * len (subsection ))
95
+
96
+ print (self .get_bibdata_panel (panel , url ))
97
+ print (" Matches" )
98
+
99
+ match_text = f"- { self .format_match (match )} "
100
+ print (textwrap .indent (match_text , " " * 14 ))
82
101
83
102
print ()
84
103
print ()
85
104
105
+ @staticmethod
106
+ def format_match (match ):
107
+ return "{path}: {value}" .format (path = _k (match .full_path ), value = _m (str (match .value ).strip ()))
108
+
86
109
def get_panel (self , node ):
87
110
"""
88
111
Find panel from jsonpath node.
0 commit comments