View Single Post
Old 09-14-2022, 10:30 AM   #1
01100001
Enthusiast
01100001 began at the beginning.
 
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
Question Display tags as an unordered list (HTML) using a custom column

I created a custom column of type Column built from other columns and intend to use it to display Tags as an unordered HTML list.

By unordered HTML list, I mean something like this:

Code:
<ul>
    <li>Tag1</li>
    <li>Tag2</li>
    <li>Tag3</li>
</ul>
I'd like to ask for help w.r.t. the code required in the Template field of the custom column.

What I've tried

I don't know python, but using the documentation and some googling, I came up with this:

Code:
program:
  before = '<ul>';
  after = '</ul>';
  j = '';
  for i in 'tags':
    j += i;
  rof;
  before + j + after;
Then turned it into a one-liner and added it to the Template field of the custom column creation dialog box.

Code:
program: before = '<ul>'; after = '</ul>'; j = ''; for i in 'tags': j += i; rof; before + j + after;
I also made sure to check the Show as HTML in Book details option.

The Error

Here's the output I see for the custom column/field in the Book details sidebar:

Code:
TEMPLATE ERROR Formatter: Expected an expression, found '=' near '+' on line 1
Any help is most appreciated!
01100001 is offline   Reply With Quote