Logs for #nikola for 2020-10-08

21:55:18 <a-shepelev> ChrisWarrick: Hello, Chris. If you here, After several days I am still at a loss with my problem of replacing bare categories with they their human-readable descriptions on the category index page. For example, if I have a category named `words' and want it listed in the index as "All those words..." -- is it possible with Nikola?
21:56:19 <a-shepelev> The CATEGORY_TRANSLATIONS setting is not what I need because I am talking about a single language.
21:58:25 <a-shepelev> Judging from the description, POSTS_SECTION_NAME might be the setting for me if it worked with categories instead of sections, which are obsolete...
22:19:29 <a-shepelev> I have looked into tags.tmpl of the base theme, and it sure seems that what I need is impossible unless I redefine that template...
22:24:44 <a-shepelev> Can I access the TAG_TITLES dictionary from withing a template? I just tried and got UNDEFINED.
22:26:02 <ChrisWarrick> a-shepelev: tag_titles should work (lowercase)
22:26:09 <a-shepelev> Oh, let me try.
22:27:26 <a-shepelev> Does not seem to: I tried: ${tag_titles['ru'], and it says that the Undefined object is not subscriptable.
22:27:52 <a-shepelev> (append a closing curly bracket to the example above)
22:30:44 <a-shepelev> Of course, theoretially one can hard-code a dictionary into a template, but that would be rather ugly!
22:32:15 <a-shepelev> And I might need that dictionary in more than one template...
22:32:27 <ChrisWarrick> a-shepelev: you can put it in GLOBAL_CONTEXT
22:33:38 <a-shepelev> Do I understand correctly that the intended usage is to have categories specified in the native language and linked together where necessary?
22:34:20 <a-shepelev> I wanted a simple scheme where categories would be short words in Latin alphabet, but would be expanded for display.
22:34:31 <a-shepelev> Thanks, I will try GLOBAL_CONTEXT.
22:42:13 <a-shepelev> Yes, it works, but requires modification of several templates form the base theme...
22:43:22 <a-shepelev> Is it by design that I can't (seem to) access, at least for reading, an arbitrary setting in conf.py >?
22:47:01 <a-shepelev> I don't see at all how to make, say, a category in Cyrillic in a standard theme... Is it possible?
22:48:41 <a-shepelev> I see: Nikola transliterates them. That's good.
23:03:44 <a-shepelev> It dangerous for me to copy and modify standard templates for the base theme? Is there any risk that they break with a Nikola update, so that I shall have to merge changes?
23:05:48 <ChrisWarrick> 00:43:22 <a-shepelev> Is it by design that I can't (seem to) access, at least for reading, an arbitrary setting in conf.py >?
23:06:10 <ChrisWarrick> yes, this is by design, you can only access a few settings relevant to the page, and things in GLOBAL_CONTEXT
23:06:15 <ChrisWarrick> 01:03:44 <a-shepelev> It dangerous for me to copy and modify standard templates for the base theme? Is there any risk that they break with a Nikola update, so that I shall have to
23:06:17 <ChrisWarrick> merge changes?
23:06:23 <a-shepelev> Thanks.
23:06:32 <ChrisWarrick> I wouldn’t call it dangerous, but yes, you might have to edit your templates again when upgrading
23:07:37 <a-shepelev> Re: merging: When Nikola introduces a backwards-incompatible change (together with an updated base theme), I shall have to merge the changes to that theme into my local modified version of that theme.
23:08:57 <ChrisWarrick> yes
23:09:44 <a-shepelev> And if a write my theme from scratch, I will be entirely on my own. How frequent are such changes in general?
23:10:18 <a-shepelev> In other words, is it highly recommended that I rely on the base theme as much as I can?
23:10:54 <ChrisWarrick> If you need to change something, just do it
23:11:24 <ChrisWarrick> but if what base does is good (enough) for your site, keep the base version (inheriting from base/base-jinja is mandatory)
23:12:17 <a-shepelev> Whereas nominal inheritance is mandatory, I am not required to inherit from it de-facto.
23:12:34 <ChrisWarrick> you probably don’t want to override all templates
23:12:40 <a-shepelev> Sure.
23:14:01 <a-shepelev> But since tags and categories are quite permeating, my desired change includes small changes to several templates, which I think cannot be done by inheritance or accurate code injection: I have to copy those templates locally and modify them.
23:15:24 <a-shepelev> My general idea is to define categories in terms of keys and values, instead of using the same string as key (for reference) and value (for display).
23:16:33 <ChrisWarrick> tag_titles are applied in some of the places
23:18:20 <a-shepelev> I failed to access them via ${tag_titles[lang][text]}...
23:18:59 <a-shepelev> So I believe it is used at the level of Nikola rather than at the level of templates...
23:20:04 <ChrisWarrick> yes, that’s what I meant
23:20:18 <a-shepelev> I see, thanks.
23:23:53 <a-shepelev> Can you help me with a specific problem: is that header tag name available in tagindex.tmpl alongside its title (in `title')?
23:24:46 <a-shepelev> The problem is, the title already contains "Post about..." unless I redefine it. And my dictionary maps bare tag names to their display representations.
23:25:43 <a-shepelev> Therefore, my dictionary works well in tags.tmpl, but not at all in tagindex.tmpl.
23:26:31 <ChrisWarrick> you can provide 'tag', see the template variables doc (or tasks/tags.py) for details
23:28:22 <a-shepelev> Thanks, `tag' is already available.
23:29:03 <a-shepelev> This: ${CATS[tag][lang]|h} works for me.
23:29:26 <a-shepelev> Where CATS is my dictionary for categories.
23:30:02 <a-shepelev> Do you refer me to Python sources as to documentation about the passing of variables into templates?
23:30:30 <ChrisWarrick> not necessarily
23:30:37 <ChrisWarrick> there’s also a template variables doc with this
23:31:12 <a-shepelev> Oh, you mean the document, not the `doc' variable. I misunderstood you.
23:34:57 <ChrisWarrick> the plugin system doesn’t support user extensibility or inheritance
23:35:33 <a-shepelev> Well, I have some "hooks" in templates.
23:35:40 <a-shepelev> * I have seen some hooks.
23:36:09 <ChrisWarrick> to change title, you would need to change the task_tags plugin
23:36:24 <a-shepelev> Oh... I would rather modify the template.
23:37:23 <a-shepelev> Thanks again for the great consultation, Chris.  It is the time for me to turn in again, so good-bye.
23:37:32 <ChrisWarrick> you’re welcome, goodbye