@@ -168,7 +168,7 @@ def run(self) -> List[Node]:
168168 return nodes_list
169169
170170 def _generate_summary_table (self , expectations_by_category , method_details ) -> List [Node ]:
171- """Generate summary table nodes. """
171+ """Generate summary as a two-level table """
172172 nodes_list = []
173173
174174 # Add section with title and proper ID
@@ -180,13 +180,17 @@ def _generate_summary_table(self, expectations_by_category, method_details) -> L
180180
181181 # Create table
182182 table = nodes .table ()
183+ table ['classes' ] = ['summary-table' ]
183184 tgroup = nodes .tgroup (cols = 3 )
184185 table += tgroup
185186
186187 # Add column specifications
187- for width in [30 , 25 , 45 ]:
188- colspec = nodes .colspec (colwidth = width )
189- tgroup += colspec
188+ colspec1 = nodes .colspec (colwidth = 25 )
189+ colspec2 = nodes .colspec (colwidth = 20 )
190+ colspec3 = nodes .colspec (colwidth = 55 )
191+ tgroup += colspec1
192+ tgroup += colspec2
193+ tgroup += colspec3
190194
191195 # Add table head
192196 thead = nodes .thead ()
@@ -197,48 +201,67 @@ def _generate_summary_table(self, expectations_by_category, method_details) -> L
197201
198202 for header in ["Category" , "Subcategory" , "Expectations" ]:
199203 entry = nodes .entry ()
204+ entry ['classes' ] = ['summary-table-header' ]
200205 row += entry
201- entry += nodes .paragraph ("" , header )
206+ para = nodes .paragraph ()
207+ para += nodes .Text (header )
208+ entry += para
202209
203210 # Add table body
204211 tbody = nodes .tbody ()
205212 tgroup += tbody
206213
207214 for category in sorted (expectations_by_category .keys ()):
208- for subcategory in sorted (expectations_by_category [category ].keys ()):
209- expectations = expectations_by_category [category ][subcategory ]
215+ subcategories = expectations_by_category [category ]
216+
217+ for idx , subcategory in enumerate (sorted (subcategories .keys ())):
218+ expectations = subcategories [subcategory ]
210219
211220 row = nodes .row ()
221+ row ['classes' ] = ['summary-table-row' ]
212222 tbody += row
213223
214- # Category cell
224+ # Category cell (only show on first subcategory)
215225 entry = nodes .entry ()
216- row += entry
217- entry += nodes .paragraph ("" , category )
226+ if idx == 0 :
227+ entry ['morerows' ] = len (subcategories ) - 1 # Span multiple rows
228+ entry ['classes' ] = ['summary-category-cell' ]
229+ para = nodes .paragraph ()
230+ para += nodes .Text (f"{ category } ({ sum (len (subcategories [s ]) for s in subcategories )} )" )
231+ entry += para
232+ row += entry
218233
219234 # Subcategory cell
220235 entry = nodes .entry ()
236+ entry ['classes' ] = ['summary-subcategory-cell' ]
237+ para = nodes .paragraph ()
238+ para += nodes .Text (f"{ subcategory } ({ len (expectations )} )" )
239+ entry += para
221240 row += entry
222- entry += nodes .paragraph ("" , subcategory )
223241
224- # Expectations cell
242+ # Expectations cell with badges
225243 entry = nodes .entry ()
226- row += entry
244+ entry ['classes' ] = ['summary-expectations-cell' ]
245+
246+ badges_container = nodes .container ()
247+ badges_container ['classes' ] = ['expectation-badges' ]
227248
228- exp_para = nodes .paragraph ()
229- for i , exp in enumerate (sorted (expectations )):
230- if i > 0 :
231- exp_para += nodes .Text (", " )
249+ for exp in sorted (expectations ):
250+ # Get description for tooltip
251+ details = method_details [exp ]
252+ clean_docstring = clean_docstring_from_metadata (details ["docstring" ])
253+ description = clean_docstring .split ('\n ' )[0 ] if clean_docstring else ""
232254
233- # Create clickable link to the card using raw HTML
234- raw_link = nodes .raw (
235- f'<a href="#card-{ exp } " class="expectation-link ">{ exp } </a>' ,
236- f'<a href="#card-{ exp } " class="expectation-link ">{ exp } </a>' ,
255+ # Create badge with link
256+ badge = nodes .raw (
257+ f'<a href="#card-{ exp } " class="expectation-badge" title=" { description } ">{ exp } </a>' ,
258+ f'<a href="#card-{ exp } " class="expectation-badge" title=" { description } ">{ exp } </a>' ,
237259 format = 'html'
238260 )
239- exp_para += raw_link
261+ badges_container += badge
240262
241- entry += exp_para
263+ entry += badges_container
264+ row += entry
242265
243266 summary_section += table
244267 nodes_list .append (summary_section )
0 commit comments