McRogueFace/compare_html_docs.py

80 lines
3.0 KiB
Python

#!/usr/bin/env python3
"""Compare the original and improved HTML documentation."""
from pathlib import Path
def compare_docs():
"""Show key differences between the two HTML versions."""
print("HTML Documentation Improvements")
print("=" * 50)
# Read both files
original = Path("docs/api_reference.html")
improved = Path("docs/api_reference_improved.html")
if not original.exists() or not improved.exists():
print("Error: Documentation files not found")
return
with open(original, 'r') as f:
orig_content = f.read()
with open(improved, 'r') as f:
imp_content = f.read()
print("\n📊 File Size Comparison:")
print(f" Original: {len(orig_content):,} bytes")
print(f" Improved: {len(imp_content):,} bytes")
print("\n✅ Key Improvements:")
# Check newline handling
if '\\n' in orig_content and '\\n' not in imp_content:
print(" • Fixed literal \\n in documentation text")
# Check table of contents
if '[Classes](#classes)' in orig_content and '<a href="#classes">Classes</a>' in imp_content:
print(" • Converted markdown links to proper HTML anchors")
# Check headings
if '<h4>Args:</h4>' not in imp_content and '<strong>Arguments:</strong>' in imp_content:
print(" • Fixed Args/Attributes formatting (no longer H4 headings)")
# Check method descriptions
orig_count = orig_content.count('`Get bounding box')
imp_count = imp_content.count('get_bounds(...)')
if orig_count > imp_count:
print(f" • Reduced duplicate method descriptions ({orig_count}{imp_count})")
# Check Entity inheritance
if 'Entity.*Inherits from: Drawable' not in imp_content:
print(" • Fixed Entity class (no longer shows incorrect inheritance)")
# Check styling
if '.container {' in imp_content and '.container {' not in orig_content:
print(" • Enhanced visual styling with better typography and layout")
# Check class documentation
if '<h4>Arguments:</h4>' in imp_content:
print(" • Added detailed constructor arguments for all classes")
# Check automation
if 'automation.click</code></h4>' in imp_content:
print(" • Improved automation module documentation formatting")
print("\n📋 Documentation Coverage:")
print(f" • Classes: {imp_content.count('class-section')} documented")
print(f" • Functions: {imp_content.count('function-section')} documented")
method_count = imp_content.count('<h5><code class="method">')
print(f" • Methods: {method_count} documented")
print("\n✨ Visual Enhancements:")
print(" • Professional color scheme with syntax highlighting")
print(" • Responsive layout with max-width container")
print(" • Clear visual hierarchy with styled headings")
print(" • Improved code block formatting")
print(" • Better spacing and typography")
if __name__ == '__main__':
compare_docs()