99from collections import defaultdict
1010
1111# HTML elements
12- TD_START = '<td style="vertical-align:top; padding:6px; word-break:break-word; overflow-wrap:anywhere;"> '
12+ TD_START_BASE = 'style="vertical-align:top; padding:6px; word-break:break-word; overflow-wrap:anywhere;"'
1313START = '<img class="software-logo" src="assets/logos/'
1414P1 = '"><span class="software-title" style="white-space:nowrap;">'
1515P2 = ' <a href="'
1616P3 = '"><img class="git" src="assets/githubicon.svg"></a></span>'
1717
18- # Install block styling (key fix here)
18+ # Install block styling
1919DIV_START = '<div style="text-align:center; margin-top:4px;">'
2020LINE_STYLE = 'style="font-size:12px; font-family:monospace; height:18px; line-height:18px; white-space:nowrap;"'
2121
2525
2626DIV_END = '</div>'
2727
28- P4 = '<p style="padding-top:4px; margin:0;">'
28+ # Bold description
29+ P4 = '<p style="padding-top:4px; margin:0; font-weight:bold;">'
2930END = '</p></td>'
3031
3132def line (icon , text ):
32- """Return a fixed-height line"""
3333 if text :
3434 return f'<div { LINE_STYLE } >{ icon } { text } </div>'
3535 else :
3636 return f'<div { LINE_STYLE } > </div>'
3737
3838def downloads (lin , bio , dock ):
39- """Aligned 3-line install block"""
4039 return (
4140 DIV_START +
4241 line (LINUXBREW_ICON , lin ) +
@@ -47,10 +46,8 @@ def downloads(lin, bio, dock):
4746
4847
4948def write_html (softwareblurbs_path ):
50- """Write the software-content.html file with aligned layout"""
5149 categories = defaultdict (list )
5250
53- # Read tools
5451 for my_file in sorted (glob .glob ("*.txt" )):
5552 with open (my_file , 'r' ) as fin :
5653 lines = [line .strip () for line in fin .readlines ()]
@@ -62,13 +59,19 @@ def write_html(softwareblurbs_path):
6259 logofile , name , github , linuxbrew , bioconda , docker , desc , category = lines [:8 ]
6360 categories [category ].append ((logofile , name , github , linuxbrew , bioconda , docker , desc ))
6461
65- # Write HTML
6662 with open (os .path .join (softwareblurbs_path , "../_includes/software-content.html" ), "w+" ) as software :
6763
64+ # Add hover + row separator styles once
65+ software .write ('''
66+ <style>
67+ td.software-cell:hover { background-color:#F5F9FF; cursor:pointer; }
68+ tr.software-row { border-bottom:1px solid #E5E5E5; }
69+ </style>
70+ ''' )
71+
6872 software .write ('<table style="width:100%; table-layout:fixed; border-collapse:collapse;">\n ' )
6973
7074 for category in sorted (categories .keys ()):
71- # Header
7275 software .write (
7376 '<tr>'
7477 '<td colspan="3" style="background-color:#DCEEFF; '
@@ -83,7 +86,10 @@ def write_html(softwareblurbs_path):
8386 logofile , name , github , linuxbrew , bioconda , docker , desc = tool
8487
8588 if i % 3 == 0 :
86- software .write ("<tr>\n " )
89+ software .write ('<tr class="software-row">\n ' )
90+
91+ # ✅ Clickable cell via onclick (no nested <a> issue)
92+ TD_START = f'<td class="software-cell" onclick="window.open(\' { github } \' , \' _blank\' )" { TD_START_BASE } >'
8793
8894 html = (
8995 TD_START +
@@ -99,7 +105,6 @@ def write_html(softwareblurbs_path):
99105
100106 i += 1
101107
102- # Pad last row
103108 if i % 3 != 0 :
104109 remaining = 3 - (i % 3 )
105110 for _ in range (remaining ):
@@ -112,7 +117,6 @@ def write_html(softwareblurbs_path):
112117
113118
114119def main ():
115- """Generate the birollab.ca software html"""
116120 if len (sys .argv [1 :]) != 1 :
117121 print ("Usage:" , sys .argv [0 ], "<Full path to softwareblurbs directory>" )
118122 sys .exit ()
0 commit comments