org-roam-ql icon indicating copy to clipboard operation
org-roam-ql copied to clipboard

Add more control over the title of columns in dynamic blocks

Open Delapouite opened this issue 11 months ago • 1 comments

Hello

Currently, while using dynamic blocks, the titles of columns of the resulting org-table are generated like this:

              (insert "|"
                      (if no-link "" "|")
                      (string-join (--map (pcase it
                                            ((pred symbolp) (capitalize (symbol-name it)))
                                            (`(,_ ,name) name))
                                          columns)
                                   " | ")
                      "|\n|-\n")

In some situations these titles of columns can be quite long, but the content of each cells in the columns very short (like boolean value true, false), so it fees like a the horizontal space could be reduced by renaming columns.

Example where Year-of-birth is a bit too long and could be renamed to simply Year in this context:

| Name | Year-of-birth |
|------+---------------|
| John |          1985 |
| Mary |          1974 |


| Name | Year |
|------+------|
| John | 1985 |
| Mary | 1974 |

What about some kind of optional plist mapping initial column names to desired column names given as parameter to the dblock? Or maybe a transformer function?

Thanks

Delapouite avatar Mar 21 '24 07:03 Delapouite

Thank you for the suggestion. I like this idea. I think such a function can also be extended to all values in the column.

However, it might take me some time for me to get around to this. If you have any suggestions or would like to submit a PR, I am open to it.

ahmed-shariff avatar Mar 25 '24 04:03 ahmed-shariff