11#!/usr/bin/env python
22'''
33Generate and update the software-content.html file for birollab.ca
4- 3-column layout with improved styling, lighter headers, tighter spacing .
4+ 3-column layout with aligned install blocks and improved styling .
55'''
66import glob
77import os
1515P2 = ' <a href="'
1616P3 = '"><img class="git" src="assets/githubicon.svg"></a></span>'
1717
18- # Smaller, compact install block
19- DIV_START = '<div style="text-align:center; margin-top:4px;"><div class="downloadinfo" style="font-size:12px; font-family:monospace; white-space:nowrap;">'
20- LINUXBREW_DIV = '<br>{% include linuxbrew-icon.html%}'
21- CONDA_DIV = '<br>{% include bioconda-icon.html%}'
22- DOCKER_DIV = '<br>{% include docker-icon.html%}'
23- DIV_END = '</div></div>'
18+ # Install block styling (key fix here)
19+ DIV_START = '<div style="text-align:center; margin-top:4px;">'
20+ LINE_STYLE = 'style="font-size:12px; font-family:monospace; height:18px; line-height:18px; white-space:nowrap;"'
2421
25- P4 = '<p style="padding-top:4px; margin:0;">'
26- END = '</p></td>'
22+ LINUXBREW_ICON = '{% include linuxbrew-icon.html%}'
23+ CONDA_ICON = '{% include bioconda-icon.html%}'
24+ DOCKER_ICON = '{% include docker-icon.html%}'
2725
28- def downloads (lin , bio , dock ):
29- """Format string with installation options, preserving alignment"""
30- return_string = DIV_START
31-
32- if lin :
33- return_string += (LINUXBREW_DIV + lin )
34- else :
35- return_string += "<br> "
26+ DIV_END = '</div>'
3627
37- if bio :
38- return_string += (CONDA_DIV + bio )
39- else :
40- return_string += "<br> "
28+ P4 = '<p style="padding-top:4px; margin:0;">'
29+ END = '</p></td>'
4130
42- if dock :
43- return_string += (DOCKER_DIV + dock )
31+ def line (icon , text ):
32+ """Return a fixed-height line"""
33+ if text :
34+ return f'<div { LINE_STYLE } >{ icon } { text } </div>'
4435 else :
45- return_string += "<br > "
36+ return f'<div { LINE_STYLE } > </div>'
4637
47- return return_string + DIV_END
38+ def downloads (lin , bio , dock ):
39+ """Aligned 3-line install block"""
40+ return (
41+ DIV_START +
42+ line (LINUXBREW_ICON , lin ) +
43+ line (CONDA_ICON , bio ) +
44+ line (DOCKER_ICON , dock ) +
45+ DIV_END
46+ )
4847
4948
5049def write_html (softwareblurbs_path ):
51- """Write the software-content.html file with improved layout"""
50+ """Write the software-content.html file with aligned layout"""
5251 categories = defaultdict (list )
5352
5453 # Read tools
@@ -66,11 +65,10 @@ def write_html(softwareblurbs_path):
6665 # Write HTML
6766 with open (os .path .join (softwareblurbs_path , "../_includes/software-content.html" ), "w+" ) as software :
6867
69- # Tight table layout (removes spacing between cells)
7068 software .write ('<table style="width:100%; table-layout:fixed; border-collapse:collapse;">\n ' )
7169
7270 for category in sorted (categories .keys ()):
73- # Lighter header, larger font, black text
71+ # Header
7472 software .write (
7573 '<tr>'
7674 '<td colspan="3" style="background-color:#DCEEFF; '
@@ -101,7 +99,7 @@ def write_html(softwareblurbs_path):
10199
102100 i += 1
103101
104- # Pad final row
102+ # Pad last row
105103 if i % 3 != 0 :
106104 remaining = 3 - (i % 3 )
107105 for _ in range (remaining ):
0 commit comments