Skip to content

Commit f130951

Browse files
committed
refactor(docs): improve function variants display format
Changed "See Also" section to "Variants" with cleaner formatting: 1. Renamed section from "See Also" to "Variants" - more accurately describes function overloads and is clearer for users 2. Strip schema prefix from variant references to match function title format: - Before: `eql_v2."->"(eql_v2_encrypted, text)` - After: `->(eql_v2_encrypted, text)` 3. Add "(not documented)" label for missing variants instead of keeping raw reference text Updated tests to reflect new terminology and behavior.
1 parent ea52974 commit f130951

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

tasks/docs/generate/test_xml_to_markdown.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
These tests verify critical parsing fixes:
66
1. Operator function names extracted from brief description
7-
2. See Also links don't self-reference when exact match missing
7+
2. Variants links don't self-reference when exact match missing
88
3. Parameter name/type extraction handles SQL backwards syntax
99
"""
1010

@@ -50,12 +50,12 @@ def test_operator_name_extraction():
5050

5151
print("✓ Operator name extraction test passed")
5252

53-
def test_see_also_no_self_reference():
54-
"""Test that See Also doesn't link to itself when variant missing"""
53+
def test_variants_no_self_reference():
54+
"""Test that Variants doesn't link to itself when variant missing"""
5555

5656
# Simulate scenario:
5757
# - Function: bloom_filter(eql_v2_encrypted)
58-
# - See Also: eql_v2.bloom_filter(jsonb)
58+
# - Variants: eql_v2.bloom_filter(jsonb)
5959
# - But bloom_filter(jsonb) doesn't exist in docs
6060

6161
all_functions = [
@@ -88,7 +88,7 @@ def test_see_also_no_self_reference():
8888
assert 'bloom_filter(eql_v2_encrypted)' in func_by_sig
8989
assert 'bloom_filter(jsonb)' not in func_by_sig
9090

91-
print("✓ See Also no self-reference test passed")
91+
print("✓ Variants no self-reference test passed")
9292

9393
def test_param_name_type_swap():
9494
"""Test that SQL parameter name/type are correctly swapped"""
@@ -160,7 +160,7 @@ def test_schema_qualified_type():
160160

161161
try:
162162
test_operator_name_extraction()
163-
test_see_also_no_self_reference()
163+
test_variants_no_self_reference()
164164
test_param_name_type_swap()
165165
test_schema_qualified_type()
166166

tasks/docs/generate/xml-to-markdown.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,14 @@ def linkify_type(type_text, type_map):
417417
# No match found, return with backticks
418418
return f"`{type_text.strip('`')}`"
419419

420-
def convert_see_also_to_links(see_also_text, all_functions):
421-
"""Convert function references in 'See Also' to markdown links
420+
def convert_variants_to_links(variants_text, all_functions):
421+
"""Convert function references in 'Variants' to markdown links
422422
423423
Only creates links for functions that actually exist in the documentation.
424424
References to missing overloaded functions are kept as plain text.
425+
Strips schema prefix to match function title format.
425426
"""
426-
if not see_also_text:
427+
if not variants_text:
427428
return ""
428429

429430
# Build a comprehensive map of functions by name and signature
@@ -443,7 +444,7 @@ def convert_see_also_to_links(see_also_text, all_functions):
443444

444445
lines = []
445446
# Split by newlines and process each reference
446-
for line in see_also_text.strip().split('\n'):
447+
for line in variants_text.strip().split('\n'):
447448
line = line.strip()
448449
if not line:
449450
continue
@@ -453,7 +454,7 @@ def convert_see_also_to_links(see_also_text, all_functions):
453454
# Match patterns: schema.function(params) or function(params)
454455
match = re.match(r'(?:`?([^`\s]+)`?\.)?`?"?([^`"\s(]+)"?`?\(([^)]*)\)?', line)
455456
if match:
456-
schema = match.group(1) # might be None
457+
schema = match.group(1) # might be None (we'll strip it anyway)
457458
func_name = match.group(2)
458459
params_str = match.group(3) if match.group(3) else ""
459460

@@ -473,10 +474,13 @@ def convert_see_also_to_links(see_also_text, all_functions):
473474

474475
if matched_func:
475476
anchor = generate_anchor(matched_func['signature'])
477+
# Use signature without schema prefix to match title format
476478
lines.append(f"- [`{matched_func['signature']}`](#{anchor})")
477479
else:
478480
# Keep original text if function not found (likely missing from Doxygen output)
479-
lines.append(f"- {line}")
481+
# But strip schema prefix to match title format
482+
display_sig = f"{func_name}({params_str})" if params_str else f"{func_name}()"
483+
lines.append(f"- `{display_sig}` (not documented)")
480484
else:
481485
# Keep original if pattern doesn't match
482486
lines.append(f"- {line}")
@@ -562,12 +566,12 @@ def generate_markdown(func, all_functions=None, type_map=None):
562566
lines.append(func['warnings'])
563567
lines.append("")
564568

565-
# See Also - convert references to links
569+
# Variants - convert references to links
566570
if func.get('see_also'):
567-
lines.append("### See Also")
571+
lines.append("### Variants")
568572
lines.append("")
569573
if all_functions:
570-
lines.append(convert_see_also_to_links(func['see_also'], all_functions))
574+
lines.append(convert_variants_to_links(func['see_also'], all_functions))
571575
else:
572576
lines.append(func['see_also'])
573577
lines.append("")

0 commit comments

Comments
 (0)