I have this to display icons for formats, and an unknown icon if none are present:
Code:
program:
formats = approximate_formats();
strcat
(
if "azw3" inlist formats then 'formats_azw3.png:' fi,
if "cbz" inlist formats then 'formats_cbz.png:' fi,
if "epub" inlist formats then 'formats_epub.png:' fi,
if "html" inlist formats then 'formats_html.png:' fi,
if "mobi" inlist formats then 'formats_mobi.png:' fi,
if "paperbook" inlist formats then 'formats_paperbook.png:' fi,
if "pdf" inlist formats then 'formats_pdf.png:' fi,
if "txt" inlist formats then 'formats_txt.png:' fi,
if "(overdrive|paperloan)" inlist formats then 'formats_overdrive.png:' fi,
if list_difference(formats, 'azw3, cbz, epub, html, mobi, paperbook, pdf, txt, overdrive, paperloan', ',') then 'formats_unknown.png' fi
)
Very repetitive. Except for paperloan, Is there a way to regex this to a single line, and would be any faster?