provide linking to pages/rfcs for ls012
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 9 Apr 2023 10:25:03 +0000 (11:25 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 9 Apr 2023 10:25:03 +0000 (11:25 +0100)
openpower/sv/rfc/ls012_optable.py

index 846819ed0f799bec4cb21e551e7819ab9f238c21..22822f8b3298af230a1537bdf40278e4b0193ebf 100644 (file)
@@ -125,10 +125,21 @@ def print_table(title, header, areas, sortby):
             for row in rows:
                 # adjust row (add same spaces as header width)
                 r = []
-                for (value, col_len) in zip(row.values(), cols.values()):
-                    value = value.replace("_", "\_") # latex, duh
-                    n_spaces = col_len - len(value)
-                    r.append(value + " " * n_spaces)
+                for key in row.keys():
+                    col_len, value = cols[key], row[key]
+                    if key == 'page':
+                        prefix = 'https://libre-soc.org/openpower/'
+                        v = value.replace("_", "\_") # latex, duh
+                        url = '[%s](%s%s)' % (value, prefix, v)
+                        r.append(url)
+                    elif key == 'rfc' and value.startswith('ls'):
+                        prefix = 'https://libre-soc.org/openpower/sv/rfc/'
+                        url = '[%s](%s%s)' % (value, prefix, value)
+                        r.append(url)
+                    else:
+                        value = value.replace("_", "\_") # latex, duh
+                        n_spaces = col_len - len(value)
+                        r.append(value + " " * n_spaces)
                 # write row
                 write_mdwn_row(f, r)
             f.write("\n\n")