DenisSalem / VenC

A static blog generator
GNU General Public License v3.0
13 stars 4 forks source link

Error to be caught for VenC #20

Closed JeremyBerry closed 3 years ago

JeremyBerry commented 3 years ago

Hello,

I am creating a new template for VenC, it is not finished yet (VenC patterns integration in progress). When I insert the .:GetEntryTitle:. pattern in the header.html file without using a conditional pattern (such as .:IfInThread:.), then when I export the blog with the venc -xb my_new_template command, I get the following error message:

jeremy@PC:~/Jérémy Berry$ venc -xb my_newtemplate VenC: ┌─ Chargement des données... VenC: ├─ Pré-traitement du théme et des publications... Traceback (most recent call last): File "/home/jeremy/.local/bin/venc", line 4, in __import_\('pkg_resources').run_script('VenC==2.0.0', 'venc') File "/usr/lib/python3/dist-packages/pkgresources/__init_\.py", line 667, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkgresources/__init_\.py", line 1470, in run_script exec(script_code, namespace, namespace) File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/EGG-INFO/scripts/venc", line 88, in File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/EGG-INFO/scripts/venc", line 80, in argv_handler File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/venc2/commands/export.py", line 190, in export_blog File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/venc2/commands/export.py", line 161, in process_non_contextual_patterns File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/venc2/patterns/processor.py", line 456, in process File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/venc2/patterns/processor.py", line 326, in runpattern File "/home/jeremy/.local/lib/python3.8/site-packages/VenC-2.0.0-py3.8.egg/venc2/datastore/__init_\.py", line 643, in get_entry_title IndexError: list index out of range

The IndexError indication is a bit esoteric and seeing line 643 of the __init__.py file doesn't help much. Catching the error to display a VenC more explicit message might be more convenient for other neophytes who want to develop their template as well. It could be something like:

Pattern .:GetEntryTitle:. used out of its context. It could happen when your blog is exported and you have at least one pattern used out of its context in your template. You could modify your template to use conditional pattern to specify when to use context-dependant pattern. More information in the documentation at URL.

Thanks you for your time and keep up the good work !

DenisSalem commented 3 years ago

Should be fixed