From 4d285c4d27b0657ab2b083486562091db156afd5 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Mon, 26 Dec 2022 11:14:28 +0100 Subject: [PATCH] check: added search in header when '_image:NAME' in content --- src/var/lib/tyto/program/check.py | 10 ++++++++++ src/var/lib/tyto/program/tyto.py | 1 + 2 files changed, 11 insertions(+) diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 85af71c..ba355a2 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -526,6 +526,16 @@ def check_content(post_bottom): post_err = True + # Check for _image:NAME from content in header + #--------------------------------------------- + for ln, line in enumerate(post_bottom): + if line.startswith('_image:'): + image_id = line.rsplit(':', 1)[1].rsplit(' ')[0] + print(article_header) + if not re.search(r'^image:\s|%s'%image_id, article_header): + tyto.exiting("10", "image: %s"%image_id, True) + + #===============================================# # Create new article's database at each check ! # #-----------------------------------------------# diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index 2bce32d..654dfa5 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -449,6 +449,7 @@ def exiting(nbr, value, out): '7' : ':< Article is \033[1;31mnot valid yet\033[0;0m', '8' : ':< tags "%s" \033[1;31mnot paired\033[0;0m'%value, '9' : ':D Article has changed (wip is old)', + '10' : ':< \033[1;31mUnused "%s"\033[0;0m in article\'s header'%value, '20' : ':D Article already up-to-date on: %s'%value, '21' : ':D Article is valid and ready to wip', '255' : ':| Maybe later...'