a408f434abb09575b4735f71224cfca9cb8c90dc
max
  Wed Apr 19 05:09:47 2023 -0700
allowing longer descriptions in .as field labels. Even if there are any pre-existing as files with | characters in them, they will still show up nicely, just on a new line. no redmine yet

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 8025f6c..692f79e 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -1735,30 +1735,50 @@
     if (strchr(tmp->name, '|'))
         {
         title = strchr(fieldName, '|');
         *title++ = 0;
         }
     struct embeddedTbl *new;
     AllocVar(new);
     new->field = fieldName;
     new->title = title != NULL ? cloneString(title) : fieldName;
     slAddHead(retList, new);
     slNameAddHead(retFieldNames, fieldName);
     hashAdd(embeddedTblHash, fieldName, new);
     }
 }
 
+void printFieldLabel(char *entry)
+/* print the field label, the first column in the table, as a <td>. Allow a
+ * longer description after a |-char, as some fields are not easy to
+ * understand. */
+{
+char *afterPipe = strchr(entry, '|');
+if (afterPipe)
+    *afterPipe = 0;
+
+printf("<tr><td>%s", entry);
+
+if (afterPipe)
+    {
+    afterPipe++; // skip past | character
+    printf("<br><span class='bedExtraTblNote'>%s</small>", afterPipe);
+    }
+
+puts("</td>");
+}
+
 #define TDB_STATICTABLE_SETTING "extraDetailsTable"
 #define TDB_STATICTABLE_SETTING_2 "detailsStaticTable"
 int extraFieldsPrintAs(struct trackDb *tdb,struct sqlResult *sr,char **fields,int fieldCount, struct asObject *as)
 // Any extra bed or bigBed fields (defined in as and occurring after N in bed N + types.
 // sr may be null for bigBeds.
 // Returns number of extra fields actually printed.
 {
 // We are trying to print extra fields so we need to figure out how many fields to skip
 int start = extraFieldsStart(tdb, fieldCount, as);
 
 struct asColumn *col = as->columnList;
 char *urlsStr = trackDbSettingClosestToHomeOrDefault(tdb, "urls", NULL);
 struct hash* fieldToUrl = hashFromString(urlsStr);
 boolean skipEmptyFields = trackDbSettingOn(tdb, "skipEmptyFields");
 
@@ -1878,31 +1898,32 @@
     if (printCount == 0)
         printf("<br><table class='bedExtraTbl'>");
 
     // split this table to separate current row from the previous one, if the trackDb option is set
     if (sepFields && slNameInList(sepFields, fieldName))
         printf("</tr></table>\n<p>\n<table class='bedExtraTbl'>");
 
     // field description
     char *entry;
     if (sameString(fieldName, "cdsStartStat") && sameString("enum('none','unk','incmpl','cmpl')", col->comment))
         entry = "Status of CDS start annotation (none, unknown, incomplete, or complete)";
     else if (sameString(fieldName, "cdsEndStat") && sameString("enum('none','unk','incmpl','cmpl')", col->comment))
         entry = "Status of CDS end annotation (none, unknown, incomplete, or complete)";
     else
         entry = col->comment;
-    printf("<tr><td>%s</td>", entry); // bold style now in HGStyle.css
+
+    printFieldLabel(entry);
 
     if (col->isList || col->isArray || col->lowType->stringy || asTypesIsInt(col->lowType->type))
         printIdOrLinks(col, fieldToUrl, tdb, fields[ix]);
     else if (asTypesIsFloating(col->lowType->type))
         {
         double valDouble = strtod(fields[ix],NULL);
         if (errno == 0 && valDouble != 0)
             printf("<td>%g</td></tr>\n", valDouble);
         else
             printf("<td>%s</td></tr>\n", fields[ix]); // decided not to print error
         }
     else
         printf("<td>%s</td></tr>\n", fields[ix]);
     printCount++;
     }