From fc1c059fda16cf9b3274e618da9fe25819205d01 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Sun, 18 Dec 2022 14:56:36 +0100 Subject: [PATCH] New code cleaned. Indev: wip. Some converting done --- src/var/lib/tyto/program/wip.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 696f48c..f9e4fb2 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -214,17 +214,21 @@ def wip_images(): image_link = '%s' image_show = '%s' + # Check each line for ln, line in enumerate(article_bottom.rsplit('\n')): + # match line if line.startswith('_image:'): values = line.rsplit(' ') - #print(values) + # search match tag in DB for i in range(1, uniq_images + 1): image = 'image_%s'%i target = width = height = False set_css = tyto.domain_css + '_image' + imag_html = '' if eval(image)[0] == values[0]: + # Get parameters from match line for value in values: if 't=' in value: target = value.rsplit('=',1)[1] @@ -249,10 +253,12 @@ def wip_images(): else: style = '' + # set from parameter image_src = image_show%( set_css, eval(image)[1], eval(image)[2], style ) + # Set link for image if target: image_tgt = image_link%( set_css, image_target, eval(image)[2], '%s' @@ -260,8 +266,10 @@ def wip_images(): else: image_tgt = '%s' + # Set HTML to replace line number image_html = image_tgt%image_src - - article_bottom = article_bottom.replace( - article_bottom.rsplit('\n')[ln], image_html - ) + + article_bottom = article_bottom.replace( + article_bottom.rsplit('\n')[ln], image_html + ) +