View Single Post
Old 06-05-2017, 01:02 PM   #3
Katja_hbg
Groupie
Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.
 
Posts: 183
Karma: 158116
Join Date: Oct 2015
Device: Kobo Glo HD (landscape), Kobo Aura One
I found a solution for my specific design for a catalog. Please find here some more details than only my workaround as I like the catalog function and hope I can help to encourage others to use it with getting their ideas solved.

If you don't know anything about catalog in calibre read this:
https://manual.calibre-ebook.com/catalogs.html
If you like to adjust more follow this: https://www.mobileread.com/forums/sh...d.php?t=118556

My final catalog should cover some specific information for each book. The focus is on the content than on the design.

In the catalog dialog I select EPUB with Option: author and genres (being tags).
To get a marker in front of each book prefix is "+" for read-pct being "any" and "-" for read-pct "undefined".

My custom column #cataloginfo concatenate e.g. download-date, number of pages, read-date and own rating, ...
My custom column #commentshort contain beginning of #mycomment resp. metadata-comment.

In the ...\resources\catalog\section_list_templates.py some rows are updated to the following:
# Books by Author
by_authors_normal_title_template = '{title} ; {#cataloginfo}'
by_authors_series_title_template = '[{series_index}] {title} ; {#cataloginfo}'
# Books by Genre
by_genres_normal_title_template = '{title} ; {#cataloginfo}; {#commentshort}'
by_genres_series_title_template = '[{series_index}] {title} ; {#cataloginfo}; {#commentshort}'

All looks and works well after creating the catalog beside that the comment is showing html tags e.g. <p>.

To solve this goto Preferences -> Advanced -> Template functions and enter
function: my_html2text with Arg count: 1 and Program code: (pay attention to the spaces)
def evaluate(self, formatter, kwargs, mi, locals, text):
from calibre.utils.html2text import html2text
return html2text(text)

#commentshort adjusted to:
{#mycomment:'test(field('#mycomment'), ' {#mycomment:.100}', ' KLAPPENTEXT: {comment:.300:my_html2text()}' )'}


Now it looks as I like. Nevertheless it is a workaround and I really hope that someone take over the good work started by GRiker.
Katja_hbg is offline   Reply With Quote